diff --git a/chiauth/chiauth.go b/chiauth/chiauth.go index 815bfc7..305eec6 100644 --- a/chiauth/chiauth.go +++ b/chiauth/chiauth.go @@ -28,17 +28,16 @@ type VerificationParams struct { // 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) -// }) +// 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) +// }) func NewTokenVerifier(opts VerificationParams) func(http.Handler) http.Handler { return func(next http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { diff --git a/libauth.go b/libauth.go index cdfdcae..da39c0b 100644 --- a/libauth.go +++ b/libauth.go @@ -28,8 +28,9 @@ type IssuerList = keyfetch.Whitelist // create a trusted IssuerList of public and/or internal issuer URLs. // // Example: -// OIDC_ISSUERS='https://example.com/ https://therootcompany.github.io/libauth/' -// OIDC_ISSUERS_INTERNAL='http://localhost:3000/ http://my-service-name:8080/' +// +// OIDC_ISSUERS='https://example.com/ https://therootcompany.github.io/libauth/' +// OIDC_ISSUERS_INTERNAL='http://localhost:3000/ http://my-service-name:8080/' func ParseIssuerEnvs(issuersEnvName, internalEnvName string) (IssuerList, error) { if len(issuersEnvName) > 0 { issuersEnvName = oidcIssuersEnv @@ -49,7 +50,8 @@ func ParseIssuerEnvs(issuersEnvName, internalEnvName string) (IssuerList, error) // ParseIssuerListString will Split comma- and/or space-delimited list into a slice // // Example: -// "https://example.com/, https://therootcompany.github.io/libauth/" +// +// "https://example.com/, https://therootcompany.github.io/libauth/" func ParseIssuerListString(issuerList string) []string { issuers := []string{}