ucjwt

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateToken

func CreateToken(ctx context.Context,
	privateKey *rsa.PrivateKey,
	keyID string,
	tokenID uuid.UUID,
	claims oidc.TokenClaims,
	jwtIssuerURL string,
	validFor int64) (string, error)

CreateToken creates a new JWT

func ExtractBearerToken

func ExtractBearerToken(h *http.Header) (string, error)

ExtractBearerToken extracts a bearer token from an HTTP request or returns an error if none is found or if it's malformed. NOTE: this doesn't enforce that it's a JWT, much less a valid one.

func IsExpired

func IsExpired(jwt string) (bool, error)

IsExpired returns `true, nil` if the supplied JWT has valid claims and is expired, `false, nil` if it has valid claims and is unexpired, and `true, err` if the claims aren't parseable. NOTE: It does NOT validate the token's signature!

func ParseClaimsUnverified

func ParseClaimsUnverified(token string) (*oidc.TokenClaims, error)

ParseClaimsUnverified extracts the claims from a token without validating its signature or anything else.

func ParseClaimsVerified

func ParseClaimsVerified(token string, key *rsa.PublicKey) (*oidc.TokenClaims, error)

ParseClaimsVerified extracts the claims from a token and verifies the signature, expiration, etc.

Types

This section is empty.

Jump to

Keyboard shortcuts

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