auth

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth

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

func NewAuth

func NewAuth(config Config) *Auth

func (*Auth) Guest

func (a *Auth) Guest() *jwt.Token

func (*Auth) Required

func (a *Auth) Required() fiber.Handler

func (*Auth) RoleRequired

func (a *Auth) RoleRequired(roles ...string) fiber.Handler

type Config

type Config struct {
	jwtware.Config
	RoleRequire func(roles ...string) fiber.Handler
	Guest       *jwt.Token
}

type JwtPayload

type JwtPayload struct {
	IssuedAt  time.Time `json:"iat,omitempty"`
	ExpiredAt time.Time `json:"exp,omitempty"`
	NotBefore time.Time `json:"nbf,omitempty"`
}

func (JwtPayload) GetAudience

func (t JwtPayload) GetAudience() (jwt.ClaimStrings, error)

func (JwtPayload) GetExpirationTime

func (t JwtPayload) GetExpirationTime() (*jwt.NumericDate, error)

func (JwtPayload) GetIssuedAt

func (t JwtPayload) GetIssuedAt() (*jwt.NumericDate, error)

func (JwtPayload) GetIssuer

func (t JwtPayload) GetIssuer() (string, error)

func (JwtPayload) GetNotBefore

func (t JwtPayload) GetNotBefore() (*jwt.NumericDate, error)

func (JwtPayload) GetSubject

func (t JwtPayload) GetSubject() (string, error)

Jump to

Keyboard shortcuts

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