jwtmanager

package
v0.40.0 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cache *cache.Cache

Cache in memory temporary store for responses from /validate for jwt

View Source
var StandardClaims jwt.StandardClaims

StandardClaims jwt.StandardClaims implementation

Functions

func Configure added in v0.9.0

func Configure()

Configure see main.go configure()

func FindJWT added in v0.12.0

func FindJWT(r *http.Request) string

FindJWT look for JWT in Cookie, JWT Header, Authorization Header (OAuth2 Bearer Token) and Query String in that order

func JWTCacheHandler added in v0.12.0

func JWTCacheHandler(next http.Handler) http.Handler

JWTCacheHandler looks for a JWT and... returns a cached response or passes the request to /validate all tests for JWTCacheHandler are present in `handlers/validate_test.go` to avoid circular imports

func NewVPJWT added in v0.21.0

func NewVPJWT(u structs.User, customClaims structs.CustomClaims, ptokens structs.PTokens) (string, error)

NewVPJWT issue a signed Vouch Proxy JWT for a user

func ParseTokenString

func ParseTokenString(tokenString string) (*jwt.Token, error)

ParseTokenString converts signed token to jwt struct

func SiteInToken

func SiteInToken(site string, token *jwt.Token) bool

SiteInToken searches does the token contain the site?

Types

type VouchClaims added in v0.4.0

type VouchClaims struct {
	Username     string `json:"username"`
	CustomClaims map[string]interface{}
	PAccessToken string
	PIdToken     string
	jwt.StandardClaims
}

VouchClaims jwt Claims specific to vouch

func ClaimsFromJWT added in v0.12.0

func ClaimsFromJWT(jwt string) (*VouchClaims, error)

ClaimsFromJWT parse the jwt and return the claims

func PTokenClaims

func PTokenClaims(ptoken *jwt.Token) (*VouchClaims, error)

PTokenClaims get all the claims

func (*VouchClaims) SiteInAudience added in v0.21.0

func (claims *VouchClaims) SiteInAudience(site string) bool

SiteInAudience does the claim contain the value?

Jump to

Keyboard shortcuts

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