token

package
v1.20.0 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Now = time.Now

current time

Functions

func Create

func Create(claim jwt.Claims, jwtKey string) (string, error)

Create takes claim and jwtkey and returns a signed token

func ValidateScopes

func ValidateScopes(claims jwt.MapClaims, scheme *security.JWTScheme) error

ValidateScopes takes user scopes and checks if it has the scope which is required for accessing the api

func Verify

func Verify(token string, jwtKey string) (jwt.MapClaims, error)

Verify takes jwt and key and verify if jwt is valid and not expired

Types

type Request

type Request struct {
	User      *model.User
	Scopes    []string
	JWTConfig *app.JWTConfig
	Provider  string
}

func (*Request) AccessJWT

func (r *Request) AccessJWT() (string, int64, error)

func (*Request) AgentJWT

func (r *Request) AgentJWT() (string, error)

func (*Request) RefreshJWT

func (r *Request) RefreshJWT() (string, int64, error)

Jump to

Keyboard shortcuts

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