Documentation ¶
Index ¶
- Variables
- func Configure()
- func CreateUserTokenString(u structs.User, customClaims structs.CustomClaims, ptokens structs.PTokens) string
- func FindJWT(r *http.Request) string
- func JWTCacheHandler(next http.Handler) http.Handler
- func PTokenToUsername(ptoken *jwt.Token) (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 Sites []string
Sites added to VouchClaims
var StandardClaims jwt.StandardClaims
StandardClaims jwt.StandardClaims implementation
Functions ¶
func CreateUserTokenString ¶
func CreateUserTokenString(u structs.User, customClaims structs.CustomClaims, ptokens structs.PTokens) string
CreateUserTokenString converts user to signed jwt
func FindJWT ¶ added in v0.12.0
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
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 PTokenToUsername ¶ added in v0.2.6
PTokenToUsername returns the Username in the validated ptoken
func ParseTokenString ¶
ParseTokenString converts signed token to jwt struct
func SiteInToken ¶
SiteInToken searches does the token contain the site?
Types ¶
type VouchClaims ¶ added in v0.4.0
type VouchClaims struct { Username string `json:"username"` Sites []string `json:"sites"` // tempting to make this a map but the array is fewer characters in the jwt 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) SiteInClaims ¶ added in v0.12.0
func (claims *VouchClaims) SiteInClaims(site string) bool
SiteInClaims does the claim contain the value?