auth

package
v0.0.0-...-70bfa02 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 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 AuthInterface

type AuthInterface interface {
	GetToken(AuthTokenClaims) (string, error)
	VerifyToken(tokenString string) (AuthTokenClaims, error)
	NewAuthTokenClaims(userID uint32, userName string, tokenValiditySeconds uint32) AuthTokenClaims
}

type AuthJWT

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

func NewAuthJWT

func NewAuthJWT(tokenIssuer string, tokenSigningSecret string, defaultTokenValiditySeconds uint32, maximumTokenValiditySeconds uint32) *AuthJWT

func (*AuthJWT) GetToken

func (a *AuthJWT) GetToken(claims AuthTokenClaims) (string, error)

func (*AuthJWT) NewAuthTokenClaims

func (a *AuthJWT) NewAuthTokenClaims(userID uint32, userName string, requestedTokenValiditySeconds uint32) AuthTokenClaims

func (*AuthJWT) VerifyToken

func (a *AuthJWT) VerifyToken(tokenString string) (AuthTokenClaims, error)

type AuthTokenClaims

type AuthTokenClaims struct {
	ID       uint32 `json:"id"`
	Username string `json:"username"`
	jwt.StandardClaims
}

Jump to

Keyboard shortcuts

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