Documentation ¶
Index ¶
- Variables
- func Configure()
- func FindJWT(r *http.Request) string
- func JWTCacheHandler(next http.Handler) http.Handler
- func NewVPJWT(u structs.User, customClaims structs.CustomClaims, ptokens structs.PTokens) (string, error)
- func ParseTokenString(tokenString string) (*jwt.Token, error)
- func SiteInToken(site string, token *jwt.Token) bool
- func TokenIsValid(token *jwt.Token, err error) bool
- type VouchClaims
Constants ¶
This section is empty.
Variables ¶
var Cache *cache.Cache
Cache in memory temporary store for responses from /validate for jwt
var StandardClaims jwt.StandardClaims
StandardClaims jwt.StandardClaims implementation
Functions ¶
func FindJWT ¶
FindJWT look for JWT in Cookie, JWT Header, Authorization Header (OAuth2 Bearer Token) and Query String in that order
func JWTCacheHandler ¶
JWTCacheHandler looks for a JWT and... returns a cached response or passes the JWT in the context tests for JWTCacheHandler are present in `handlers/validate_test.go` to avoid circular imports
func NewVPJWT ¶
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 ¶
ParseTokenString converts signed token to jwt struct
func SiteInToken ¶
SiteInToken searches does the token contain the site?
Types ¶
type VouchClaims ¶
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 ¶
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 ¶
func (claims *VouchClaims) SiteInAudience(site string) bool
SiteInAudience does the claim contain the value?
func (*VouchClaims) SiteInGroups ¶
func (claims *VouchClaims) SiteInGroups(site string) bool
Check for Site matching group in the PAcess Token