token

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2025 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrFailedToSignToken = credstackError.NewError(500, "ERR_FAILED_TO_SIGN", "token: Failed to sign token due to an internal error")

ErrFailedToSignToken - An error that gets wrapped when jwt.Token.SignedString returns an error

View Source
var ErrMarshalTokenResponse = credstackError.NewError(400, "ERR_MARSHAL_TOKEN_RESPONSE", "token: Failed to marshal token into token response")

ErrMarshalTokenResponse - An error that gets returned

View Source
var ErrTokenCollision = credstackError.NewError(500, "ERR_TOKEN_COLLISION", "token: A duplicate access token was issued")

ErrTokenCollision - An error that gets returned when a duplicate access token is created. This should realistically never return as JWT access tokens are unique

Functions

func MarshalTokenResponse

func MarshalTokenResponse(accessToken string, expiration uint32) (*tokenModel.TokenResponse, error)

MarshalTokenResponse - Converts jwt.Token structures into response.TokenResponse structures so that they can be returned effectively

TODO: Need support for id tokens and refresh tokens here TODO: Expires in is not rendering properly, showing expiration instead of token lifetime TODO: This function feels kind of clunky...

func NewToken added in v1.3.1

func NewToken(serv *server.Server, api *apiModel.API, app *applicationModel.Application, claims jwt.RegisteredClaims) (*tokenModel.TokenResponse, error)

NewToken - Generates a token according to the algorithm provided by the API passed as a parameter. Any tokens generated with this function are stored in the database, and are automatically converted to a token response.

Types

This section is empty.

Jump to

Keyboard shortcuts

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