jwt

package
v0.0.0-...-693f06b Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Authorizer

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

func NewAuthorizer

func NewAuthorizer(config Config) Authorizer

func (Authorizer) CreateTokens

func (a Authorizer) CreateTokens(username string) (Tokens, error)

func (Authorizer) Validate

func (a Authorizer) Validate(token string) (bool, string, error)

func (Authorizer) ValidateAndUpdate

func (a Authorizer) ValidateAndUpdate(token string) (Tokens, error)

type Config

type Config struct {
	JwtSecretKey         string `env:"JWT_SECRET_KEY"`
	JwtAccessTokenHours  int64  `env:"JWT_ACCESS_TOKEN_HOURS"  envDefault:"24"`
	JwtRefreshTokenHours int64  `env:"JWT_REFRESH_TOKEN_HOURS" envDefault:"168"`
}

type Tokens

type Tokens struct {
	AccessToken  string
	RefreshToken string
}

Jump to

Keyboard shortcuts

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