auth

package
v0.0.0-...-9e1b7c1 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const NaisDeviceApprovalGroup = "ffd89425-c75c-4618-b5ab-67149ddbbc2d"

Variables

This section is empty.

Functions

func GetEmail

func GetEmail(ctx context.Context) string

func MockTokenValidator

func MockTokenValidator() func(next http.Handler) http.Handler

func UserInNaisdeviceApprovalGroup

func UserInNaisdeviceApprovalGroup(claims map[string]any) bool

func WithEmail

func WithEmail(ctx context.Context, email string) context.Context

Types

type Azure

type Azure struct {
	ClientID string
	Tenant   string
	// contains filtered or unexported fields
}

func (Azure) Issuer

func (a Azure) Issuer() string

func (Azure) JwksEndpoint

func (a Azure) JwksEndpoint() string

func (*Azure) JwtOptions

func (a *Azure) JwtOptions() []jwt.ParseOption

func (*Azure) KeySetFrom

func (a *Azure) KeySetFrom(_ jwt.Token) (jwk.Set, error)

func (*Azure) SetupJwkSetAutoRefresh

func (a *Azure) SetupJwkSetAutoRefresh(ctx context.Context) error

func (*Azure) TokenValidatorMiddleware

func (a *Azure) TokenValidatorMiddleware() TokenValidator

type Google

type Google struct {
	ClientID       string
	AllowedDomains []string
	// contains filtered or unexported fields
}

func (*Google) JwtOptions

func (g *Google) JwtOptions() []jwt.ParseOption

func (*Google) KeySetFrom

func (g *Google) KeySetFrom(t jwt.Token) (jwk.Set, error)

func (*Google) ParseAndValidateToken

func (g *Google) ParseAndValidateToken(token string) (*User, error)

func (*Google) SetupJwkSetAutoRefresh

func (g *Google) SetupJwkSetAutoRefresh(ctx context.Context) error

func (*Google) TokenValidatorMiddleware

func (g *Google) TokenValidatorMiddleware() TokenValidator

type TokenValidator

type TokenValidator func(http.Handler) http.Handler

type User

type User struct {
	ID     string
	Email  string
	Groups []string
}

Jump to

Keyboard shortcuts

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