doc updates
This commit is contained in:
parent
a0d19dd83c
commit
ce652e0590
|
@ -5,7 +5,7 @@ via OIDC-style (https://example.com/.well-known/openid-configuration)
|
||||||
and Auth0-style (https://example.com/.well-known/jwks.json)
|
and Auth0-style (https://example.com/.well-known/jwks.json)
|
||||||
URLs. It uses the keypairs package to encode to JWK format.
|
URLs. It uses the keypairs package to encode to JWK format.
|
||||||
|
|
||||||
Basic usage:
|
Basic Usage
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"crypto/ecdsa"
|
"crypto/ecdsa"
|
||||||
|
@ -19,12 +19,16 @@ Basic usage:
|
||||||
pub := key.Public()
|
pub := key.Public()
|
||||||
|
|
||||||
handlers := &keyserve.Middleware{
|
handlers := &keyserve.Middleware{
|
||||||
|
|
||||||
// the self-reference used for building the openid-configuration url
|
// the self-reference used for building the openid-configuration url
|
||||||
BaseURL: "https://example.com/",
|
BaseURL: "https://example.com/",
|
||||||
|
|
||||||
// public keys used to verify token signatures
|
// public keys used to verify token signatures
|
||||||
Keys: []keypairs.PublicKey{ keypairs.NewPublicKey(pub) }
|
Keys: []keypairs.PublicKey{ keypairs.NewPublicKey(pub) }
|
||||||
|
|
||||||
// how long clients should cache your public key
|
// how long clients should cache your public key
|
||||||
ExpiresIn: 72 * time.Hour
|
ExpiresIn: 72 * time.Hour
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
You can then use the handlers anywhere http.HandleFunc is allowed:
|
You can then use the handlers anywhere http.HandleFunc is allowed:
|
||||||
|
|
|
@ -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
|
// others to receive a cached version of the malicious response rather than
|
||||||
// hitting the server and getting the correct response. Unlikely that that's
|
// 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
|
// 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) {
|
func (m *Middleware) WellKnownOIDC(w http.ResponseWriter, r *http.Request) {
|
||||||
var baseURL url.URL
|
var baseURL url.URL
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue