be more consistent with URLs
This commit is contained in:
parent
163511db7e
commit
0704d0df64
|
@ -83,7 +83,8 @@ func JWKs(jwksurl string) (publicKeysMap, error) {
|
||||||
if maps, keys, err := uncached.JWKs(jwksurl); nil != err {
|
if maps, keys, err := uncached.JWKs(jwksurl); nil != err {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else {
|
} else {
|
||||||
cacheKeys(maps, keys, strings.Replace(jwksurl, ".well-known/jwks.json", "", 1))
|
iss := strings.Replace(jwksurl, ".well-known/jwks.json", "", 1)
|
||||||
|
cacheKeys(maps, keys, iss)
|
||||||
return keys, err
|
return keys, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -197,6 +198,7 @@ func cacheKeys(maps map[string]map[string]string, keys map[string]keypairs.Publi
|
||||||
if "" != m["iss"] {
|
if "" != m["iss"] {
|
||||||
iss = m["iss"]
|
iss = m["iss"]
|
||||||
}
|
}
|
||||||
|
iss = normalizeIssuer(iss)
|
||||||
cacheKey(m["kid"], iss, m["exp"], key)
|
cacheKey(m["kid"], iss, m["exp"], key)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -241,5 +243,5 @@ func clear() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func normalizeIssuer(iss string) string {
|
func normalizeIssuer(iss string) string {
|
||||||
return strings.TrimRight(iss, "/") + "/"
|
return strings.TrimRight(iss, "/")
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,11 +36,8 @@ func OIDCJWKs(baseURL string) (map[string]map[string]string, map[string]keypairs
|
||||||
// WellKnownJWKs calls JWKs with baseURL + /.well-known/jwks.json as constructs the jwks_uri
|
// WellKnownJWKs calls JWKs with baseURL + /.well-known/jwks.json as constructs the jwks_uri
|
||||||
func WellKnownJWKs(baseURL string) (map[string]map[string]string, map[string]keypairs.PublicKey, error) {
|
func WellKnownJWKs(baseURL string) (map[string]map[string]string, map[string]keypairs.PublicKey, error) {
|
||||||
baseURL = normalizeBaseURL(baseURL)
|
baseURL = normalizeBaseURL(baseURL)
|
||||||
if '/' == baseURL[len(baseURL)-1] {
|
|
||||||
baseURL = baseURL[:len(baseURL)-1]
|
|
||||||
}
|
|
||||||
|
|
||||||
return JWKs(baseURL + "/.well-known/jwks.json")
|
return JWKs(baseURL + ".well-known/jwks.json")
|
||||||
}
|
}
|
||||||
|
|
||||||
// JWKs fetches and parses a jwks.json (assuming well-known format)
|
// JWKs fetches and parses a jwks.json (assuming well-known format)
|
||||||
|
|
Loading…
Reference in New Issue