Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
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
var ErrMarshalTokenResponse = credstackError.NewError(400, "ERR_MARSHAL_TOKEN_RESPONSE", "token: Failed to marshal token into token response")
ErrMarshalTokenResponse - An error that gets returned
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.