google

package
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 12, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidEmail      = errors.New("invalid email")
	ErrUnauthorizedEmail = errors.New("unauthorized email")
)

Functions

This section is empty.

Types

type Authorizer

type Authorizer struct {
	// contains filtered or unexported fields
}

Authorizer verifies a user is in a Google Group or Groups and sets those groups in the returned Context

func New

func New(jsonPath, impersonateUser string, allowedGroups []string, opts ...Option) (*Authorizer, error)

New returns a new Authorizer with the given service account json path, user to impersonate, and list of groups (by group email)

func (*Authorizer) AuthorizeSession

func (a *Authorizer) AuthorizeSession(ctx context.Context, _ *header.MachineInfo, _ *oauth2.Token, idToken *oidc.IDToken) (enrollprofile.Context, error)

AuthorizeSession authorizes the user/device session and returns an EnrollContext that can be passed to an EnrollmentGenerator. If the request is not authorized, an error of type AuthorizationError is returned.

type Option

type Option func(a *Authorizer)

func WithLogger

func WithLogger(logger *slog.Logger) Option

WithLogger configures the authorizer with the given logger If left unconfigured, logging will be disabled

func WithWorkerLimit

func WithWorkerLimit(limit int) Option

WithWorkerLimit configures the authorizer to limit the number of concurrent API requests across all AuthorizeSession calls. If left unconfigured, there is no limit enforced

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL