auth

package
v0.11.2 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProviderOIDC = "oidc"

	ProviderParamTypeToken = "token"
)
View Source
const (
	MetadataAuthorizationKey = "authorization"
	TokenPrefix              = "Bearer "
)
View Source
const (
	DefaultUserNameCalm         = "sub"
	AllowedAudienceDefaultValue = ""
)

Variables

View Source
var (
	ErrUnsupportedProvider              = errors.New("unsupported authentication provider")
	ErrUnMatchedAuthenticationParamType = errors.New("unmatched authentication parameter type")
	ErrEmptyToken                       = errors.New("empty token")
	ErrMalformedToken                   = errors.New("malformed token")
)
View Source
var (
	ErrEmptyIssueURL         = errors.New("empty issue URL")
	ErrEmptyAllowedAudiences = errors.New("empty allowed audiences")
	ErrUnknownIssuer         = errors.New("unknown issuer")
	ErrUserNameNotFound      = errors.New("username not found")
	ErrForbiddenAudience     = errors.New("forbidden audience")
)
View Source
var Disabled = Options{}
View Source
var (
	ErrMetadataFetchFailed = errors.New("metadata fetch failed")
)

Functions

This section is empty.

Types

type AuthenticationProvider

type AuthenticationProvider interface {
	AcceptParamType() string
	Authenticate(ctx context.Context, param any) (string, error)
}

todo: add metrics

func NewAuthenticationProvider

func NewAuthenticationProvider(ctx context.Context, options Options) (AuthenticationProvider, error)

func NewOIDCProvider

func NewOIDCProvider(ctx context.Context, jsonParam string) (AuthenticationProvider, error)

type GrpcAuthenticationDelegator

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

func NewGrpcAuthenticationDelegator

func NewGrpcAuthenticationDelegator(provider AuthenticationProvider) (*GrpcAuthenticationDelegator, error)

func (*GrpcAuthenticationDelegator) GetStreamInterceptor

func (delegator *GrpcAuthenticationDelegator) GetStreamInterceptor() grpc.StreamServerInterceptor

func (*GrpcAuthenticationDelegator) GetUnaryInterceptor

func (delegator *GrpcAuthenticationDelegator) GetUnaryInterceptor() grpc.UnaryServerInterceptor

type OIDCOptions

type OIDCOptions struct {
	AllowedIssueURLs string `json:"allowedIssueURLs,omitempty"`
	AllowedAudiences string `json:"allowedAudiences,omitempty"`
	UserNameClaim    string `json:"userNameClaim,omitempty"`
}

func (*OIDCOptions) Validate

func (op *OIDCOptions) Validate() error

type OIDCProvider

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

func (*OIDCProvider) AcceptParamType

func (*OIDCProvider) AcceptParamType() string

func (*OIDCProvider) Authenticate

func (p *OIDCProvider) Authenticate(ctx context.Context, param any) (string, error)

type Options

type Options struct {
	ProviderName   string
	ProviderParams string
}

func (*Options) IsEnabled

func (op *Options) IsEnabled() bool

type ProviderWithVerifier

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

Jump to

Keyboard shortcuts

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