oauth2

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrMissingToken = errors.New("token is missing")

ErrMissingToken indicates, that a specific part of a oauth2.Token is not populated, e.g., typically, refresh token are not returned when acquiring an access token through an OIDC client-credentials flow.

Functions

This section is empty.

Types

type TokenWrapper

type TokenWrapper oauth2.Token

TokenWrapper provides JSON marshaling and JWT parsing as well as easy access to a potential id-token to an oauth2.Token. For each of the, potentially, three tokens in an oauth2.Token, i.e., access token, id-token, and refresh token an AsString(), AsJSON(), and AsJWT() function is providing the corresponding

func (*TokenWrapper) AccessTokenAsJSON

func (t *TokenWrapper) AccessTokenAsJSON(options ...jwt.ParseOption) string

AccessTokenAsJWT attempts to parse an access token as JWT and then to marshal the token into JSON. For the plethora of ParseOptions, see github.com/lestrrat-go/jwx.

func (*TokenWrapper) AccessTokenAsJWT

func (t *TokenWrapper) AccessTokenAsJWT(options ...jwt.ParseOption) (jwt.Token, error)

AccessTokenAsJWT attempts to parse an access token as JWT. For the plethora of ParseOptions, see github.com/lestrrat-go/jwx.

func (*TokenWrapper) AccessTokenAsString

func (t *TokenWrapper) AccessTokenAsString() string

AccessTokenAsString returns an access token string.

func (*TokenWrapper) IDTokenAsJSON

func (t *TokenWrapper) IDTokenAsJSON(options ...jwt.ParseOption) string

IDTokenAsJWT attempts to parse an id-token as JWT and then to marshal the token into JSON. For the plethora of ParseOptions, see github.com/lestrrat-go/jwx.

func (*TokenWrapper) IDTokenAsJWT

func (t *TokenWrapper) IDTokenAsJWT(options ...jwt.ParseOption) (jwt.Token, error)

IDTokenAsJWT attempts to parse an id-token as JWT. For the plethora of ParseOptions, see github.com/lestrrat-go/jwx.

func (*TokenWrapper) IDTokenAsString

func (t *TokenWrapper) IDTokenAsString() string

IDTokenAsString returns an id-token string.

func (*TokenWrapper) RefreshTokenAsJSON

func (t *TokenWrapper) RefreshTokenAsJSON(options ...jwt.ParseOption) string

RefreshTokenAsJWT attempts to parse an id-token as JWT and then to marshal the token into JSON. For the plethora of ParseOptions, see github.com/lestrrat-go/jwx.

func (*TokenWrapper) RefreshTokenAsJWT

func (t *TokenWrapper) RefreshTokenAsJWT(options ...jwt.ParseOption) (jwt.Token, error)

RefreshTokenAsJWT attempts to parse a refresh token as JWT. For the plethora of ParseOptions, see github.com/lestrrat-go/jwx.

func (*TokenWrapper) RefreshTokenAsString

func (t *TokenWrapper) RefreshTokenAsString() string

RefreshTokenAsString returns a refresh token string.

Jump to

Keyboard shortcuts

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