doc updates

This commit is contained in:
AJ ONeal 2019-03-06 20:18:21 -07:00
parent a0d19dd83c
commit ce652e0590
2 changed files with 6 additions and 2 deletions

View File

@ -5,7 +5,7 @@ via OIDC-style (https://example.com/.well-known/openid-configuration)
and Auth0-style (https://example.com/.well-known/jwks.json)
URLs. It uses the keypairs package to encode to JWK format.
Basic usage:
Basic Usage
import (
"crypto/ecdsa"
@ -19,12 +19,16 @@ Basic usage:
pub := key.Public()
handlers := &keyserve.Middleware{
// the self-reference used for building the openid-configuration url
BaseURL: "https://example.com/",
// public keys used to verify token signatures
Keys: []keypairs.PublicKey{ keypairs.NewPublicKey(pub) }
// how long clients should cache your public key
ExpiresIn: 72 * time.Hour
}
You can then use the handlers anywhere http.HandleFunc is allowed:

View File

@ -84,7 +84,7 @@ func (m *Middleware) Handler(w http.ResponseWriter, r *http.Request) bool {
// others to receive a cached version of the malicious response rather than
// hitting the server and getting the correct response. Unlikely that that's
// you (and if it is you have much bigger problems), but I feel the need to
// warn you all the same.
// warn you all the same - so just be sure to specify BaseURL.
func (m *Middleware) WellKnownOIDC(w http.ResponseWriter, r *http.Request) {
var baseURL url.URL