authn

package
v0.0.0-...-6a4a312 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrMissingIssuerEndpoint defines the error if an issuer endpoint is missing.
	ErrMissingIssuerEndpoint = fmt.Errorf("missing issuer endpoint")

	// ErrMissingToken defines the error if a token is missing while exchange.
	ErrMissingToken = fmt.Errorf("missing token after exchange")
)

Functions

This section is empty.

Types

type Authn

type Authn struct {
	Providers map[string]*Provider
	// contains filtered or unexported fields
}

Authn initializes the authn provider handling.

func New

func New(opts ...Option) (*Authn, error)

New initializes the authn provider handling.

type Option

type Option func(o *Options)

Option defines a single option function.

func WithConfig

func WithConfig(v string) Option

WithConfig provides a function to set the config option.

type Options

type Options struct {
	Config string
}

Options defines the available options for this package.

type Provider

type Provider struct {
	Config   *config.AuthProvider
	OAuth2   *oauth2.Config
	OpenID   *oidc.Provider
	Verifier *oidc.IDTokenVerifier
	Logger   zerolog.Logger
}

Provider defines a single authentication provider.

func (*Provider) Claims

func (p *Provider) Claims(ctx context.Context, token *oauth2.Token) (user *User, err error)

Claims tries to map all provider claims properly to the wrapper model.

type User

type User struct {
	Ident string
	Login string
	Name  string
	Email string
	Roles []string
	Raw   map[string]interface{}
}

User defines a model filles by the authentication provider.

Jump to

Keyboard shortcuts

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