auth

package module
v0.3.7 Latest Latest
Warning

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

Go to latest
Published: May 7, 2024 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetJWTHeaderContext

func GetJWTHeaderContext(c ctx) *jwt.Header

func GetJWTPayloadContext

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

func JWTGuardMiddleware

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

func WithJWT

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

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

ConfigJWT jwt config model

func (*ConfigJWT) Default

func (v *ConfigJWT) Default()

func (*ConfigJWT) Validate

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

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

type JWTGuardMiddlewareConfig

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
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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