auth

package
v0.12.5 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2023 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetJWTHeaderContext added in v0.11.6

func GetJWTHeaderContext(c ctx) *jwt.Header

func GetJWTPayloadContext added in v0.11.6

func GetJWTPayloadContext(c ctx, payload interface{}) error

func JWTGuardMiddleware added in v0.9.0

func JWTGuardMiddleware(j JWT, c JWTGuardMiddlewareConfig) web.Middleware

func WithJWT added in v0.9.0

func WithJWT() plugins.Plugin

WithJWT init jwt provider

func WithOAuth

func WithOAuth() plugins.Plugin

WithOAuth init oauth providers

Types

type Code

type Code string

type ConfigJWT added in v0.9.0

type ConfigJWT struct {
	JWT []jwt.Config `yaml:"jwt"`
}

ConfigJWT jwt config model

func (*ConfigJWT) Default added in v0.9.0

func (v *ConfigJWT) Default()

func (*ConfigJWT) Validate added in v0.9.0

func (v *ConfigJWT) Validate() error

type ConfigOAuth

type ConfigOAuth struct {
	Providers []oauth.ConfigItem `yaml:"oauth"`
}

ConfigOAuth oauth config model

func (*ConfigOAuth) Default

func (v *ConfigOAuth) Default()

type JWT added in v0.9.0

type JWT interface {
	Sign(payload interface{}, ttl time.Duration) (string, error)
	Verify(token string, payload interface{}) (*jwt.Header, error)
}

type JWTGuardMiddlewareConfig added in v0.11.6

type JWTGuardMiddlewareConfig struct {
	AcceptHeader bool
	AcceptCookie string
}

type OAuth

type OAuth interface {
	RequestHandler(code string) func(web.Context)
	CallbackHandler(code string, handler func(web.Context, OAuthUser, Code)) func(web.Context)
}

type OAuthUser

type OAuthUser interface {
	GetName() string
	GetEmail() string
	GetIcon() string
}

Jump to

Keyboard shortcuts

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