middleware

package
v0.0.0-...-ff8180c Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OauthCookieState         = "oauth_state"
	OauthCookieNonce         = "oauth_nonce"
	OauthCookieAccessToken   = "oauth_access_token"
	OauthCookieRefreshToken  = "oauth_refresh_token"
	OauthRefreshTokenTimeout = 30 * 24 * time.Hour
)

Variables

View Source
var UserClaims = "oidcClaims"

Functions

func NewOIDC

func NewOIDC(auth *Auth) echo.MiddlewareFunc

func OapiValidator

func OapiValidator(spec *openapi3.T, opts ...ValidatorOption) echo.MiddlewareFunc

func SlogRequestID

func SlogRequestID() echo.MiddlewareFunc

Types

type Auth

type Auth struct {
	Provider    *oidc.Provider
	Verifier    *oidc.IDTokenVerifier
	OAuthConfig *oauth2.Config
}

func NewOIDCAuth

func NewOIDCAuth(ctx context.Context, config *Config) (*Auth, error)

func (*Auth) CallbackHandler

func (auth *Auth) CallbackHandler(c echo.Context) error

func (*Auth) LogoutHandler

func (auth *Auth) LogoutHandler(c echo.Context) error

func (*Auth) RedirectHandler

func (auth *Auth) RedirectHandler(e echo.Context) error

func (*Auth) RefreshHandler

func (auth *Auth) RefreshHandler(c echo.Context) error

type Claims

type Claims map[string]any

func GetClaims

func GetClaims(c echo.Context) (Claims, error)

type Config

type Config struct {
	IssuerURL    string
	ClientID     string
	ClientSecret string
	RedirectURL  string
	Scopes       []string
}

type Validator

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

func (*Validator) AuthenticatorFunc

func (v *Validator) AuthenticatorFunc() openapi3filter.AuthenticationFunc

type ValidatorOption

type ValidatorOption func(*Validator)

func BasicAuthWithConfig

func BasicAuthWithConfig(config middleware.BasicAuthConfig) ValidatorOption

func ErrorHandler

func ErrorHandler(fn oapimw.ErrorHandler) ValidatorOption

func JWTAuth

func JWTAuth(signingKey any) ValidatorOption

func JWTAuthWithConfig

func JWTAuthWithConfig(config echojwt.Config) ValidatorOption

func KeyAuthWithConfig

func KeyAuthWithConfig(config middleware.KeyAuthConfig) ValidatorOption

func MultiError

func MultiError() ValidatorOption

func MultiErrorHandler

func MultiErrorHandler(fn oapimw.MultiErrorHandler) ValidatorOption

func OpenIDConnect

func OpenIDConnect(auth *Auth) ValidatorOption

func WithSkipperFunc

func WithSkipperFunc(skipFn middleware.Skipper) ValidatorOption

Jump to

Keyboard shortcuts

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