Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var JWSKey = ctxKey("jws")
JWSKey is used to get the InspectableToken from http.Request.Context().Value(chiauth.JWSKey)
Functions ¶
func NewTokenVerifier ¶
func NewTokenVerifier(opts VerificationParams) func(http.Handler) http.Handler
NewTokenVerifier returns a token-verifying middleware
tokenVerifier := chiauth.NewTokenVerifier(chiauth.VerificationParams{
Issuers: keyfetch.Whitelist([]string{"https://accounts.google.com"}),
Optional: false,
})
r.Use(tokenVerifier)
r.Post("/api/users/profile", func(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
jws, ok := ctx.Value(chiauth.JWSKey).(*libauth.JWS)
})
Types ¶
type VerificationParams ¶
VerificationParams specify the Issuer and whether or not the token is Optional (if provided, it must pass verification)
Click to show internal directories.
Click to hide internal directories.