provider

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2026 License: MIT Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInitialization = errors.New("error in initialization")
View Source
var ErrNoAuth = errors.New("no auth supplied")
View Source
var ErrNotAuthorized = errors.New("not authorized")
View Source
var ErrTokenExpired = errors.New("token is expired")

Functions

func BindAuth

func BindAuth(ctx context.Context, auth *ProviderAuth) context.Context

func EnsureErr

func EnsureErr(err error, varErrType error) error

Types

type OidcProviderConfig

type OidcProviderConfig struct {
	// REQUIRED
	Issuer string

	// REQUIRED
	ClientId string

	// REQUIRED
	ClientSecret string

	// FULLY QUALIFIED Oauth2 Callback path
	RedirectUri string

	// OPTIONAL, will be defaulted if unspecified
	Scopes []string

	// OPTIONAL
	// If set, limit the allowed signing args to this list
	// defaults to RS256,RS512
	SupportedSigningAlgs []string
}

type OidcProviders

type OidcProviders struct {
	OidcProviderConfig OidcProviderConfig
	// contains filtered or unexported fields
}

func (*OidcProviders) GoOidcProvider

func (obj *OidcProviders) GoOidcProvider(ctx context.Context) (*gooidc.Provider, error)

func (*OidcProviders) IdTokenVerifier

func (obj *OidcProviders) IdTokenVerifier(ctx context.Context) (*gooidc.IDTokenVerifier, error)

func (*OidcProviders) Initialize

func (obj *OidcProviders) Initialize(ctx context.Context) error

func (*OidcProviders) Oauth2Config

func (obj *OidcProviders) Oauth2Config(ctx context.Context) (*oauth2.Config, error)

func (*OidcProviders) ValidateJwt

func (obj *OidcProviders) ValidateJwt(ctx context.Context, jwt string, refreshToken string) (*ProviderAuth, error)

type ProviderAuth

type ProviderAuth struct {
	Valid    bool
	RawToken string
	// contains filtered or unexported fields
}

func GetAuth

func GetAuth(ctx context.Context) *ProviderAuth

func (*ProviderAuth) GetIdToken

func (p *ProviderAuth) GetIdToken() *gooidc.IDToken

func (*ProviderAuth) GetOauth2Token

func (p *ProviderAuth) GetOauth2Token() *oauth2.Token

type Providers

type Providers interface {
	// FiberOidc uses lazy initialization - call this if you're eager!
	Initialize(ctx context.Context) error

	// validate an inbound auth
	// N.B. this does NOT bind ProviderAuth to a context on success
	ValidateJwt(ctx context.Context, jwt string, refreshToken string) (*ProviderAuth, error)

	// individual provider components
	GoOidcProvider(ctx context.Context) (*gooidc.Provider, error)
	Oauth2Config(ctx context.Context) (*oauth2.Config, error)
	IdTokenVerifier(ctx context.Context) (*gooidc.IDTokenVerifier, error)
}

Jump to

Keyboard shortcuts

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