Package io.smallrye.jwt.auth.principal
Class AbstractKeyLocationResolver
- java.lang.Object
-
- io.smallrye.jwt.auth.principal.AbstractKeyLocationResolver
-
- Direct Known Subclasses:
DecryptionKeyLocationResolver,KeyLocationResolver,X509KeyLocationResolver
public class AbstractKeyLocationResolver extends Object
This implements the MP-JWT 1.1 mp.jwt.verify.publickey.location config property resolution logic
-
-
Field Summary
Fields Modifier and Type Field Description protected JWTAuthContextInfoauthContextInfoprotected ObjectforcedRefreshLockprotected org.jose4j.jwk.HttpsJwkshttpsJwksprotected List<org.jose4j.jwk.JsonWebKey>jsonWebKeysprotected Keykeyprotected longlastForcedRefreshTime
-
Constructor Summary
Constructors Constructor Description AbstractKeyLocationResolver(JWTAuthContextInfo authContextInfo)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleanforcedHttpsJwksRefresh()protected org.jose4j.http.GetgetHttpGet()protected org.jose4j.jwk.JsonWebKeygetHttpsJwk(String kid, String algo)protected org.jose4j.jwk.HttpsJwksgetHttpsJwks(String location)protected org.jose4j.jwk.JsonWebKeygetJsonWebKey(String kid, String algo)protected static org.jose4j.jwk.JsonWebKeygetJsonWebKey(String kid, List<org.jose4j.jwk.JsonWebKey> keys, String algo)protected static StringgetKid(org.jose4j.jwx.JsonWebStructure jws)protected KeygetSecretKeyFromJwk(org.jose4j.jwk.JsonWebKey jwk)protected ResourceUtils.UrlStreamResolvergetUrlResolver()protected org.jose4j.jwk.HttpsJwksinitializeHttpsJwks(String location)protected booleanisHttpsJwksInitialized(String keyLocation)protected static booleanisMatchingJwkAvailable(List<org.jose4j.jwk.JsonWebKey> keys, String kid)protected org.jose4j.jwk.JsonWebKeyloadFromJwk(String content, String keyId, String algo)protected static X509CertificateloadPEMCertificate(String content)protected StringreadKeyContent(String keyLocation)protected static voidreportLoadKeyException(String keyContent, String keyLocation, Exception e)protected static voidreportUnresolvableKeyException(String keyContent, String keyLocation)protected org.jose4j.jwk.JsonWebKeytryAsJwk(org.jose4j.jwx.JsonWebStructure jws, String algo)protected org.jose4j.jwk.JsonWebKeytryJWKContent(String content, String keyId, String algo, boolean encoded)protected static voidverifyKid(org.jose4j.jwx.JsonWebStructure jws, String expectedKid)
-
-
-
Field Detail
-
key
protected Key key
-
jsonWebKeys
protected List<org.jose4j.jwk.JsonWebKey> jsonWebKeys
-
httpsJwks
protected org.jose4j.jwk.HttpsJwks httpsJwks
-
lastForcedRefreshTime
protected long lastForcedRefreshTime
-
forcedRefreshLock
protected Object forcedRefreshLock
-
authContextInfo
protected JWTAuthContextInfo authContextInfo
-
-
Constructor Detail
-
AbstractKeyLocationResolver
public AbstractKeyLocationResolver(JWTAuthContextInfo authContextInfo) throws org.jose4j.lang.UnresolvableKeyException
- Throws:
org.jose4j.lang.UnresolvableKeyException
-
-
Method Detail
-
isMatchingJwkAvailable
protected static boolean isMatchingJwkAvailable(List<org.jose4j.jwk.JsonWebKey> keys, String kid)
-
verifyKid
protected static void verifyKid(org.jose4j.jwx.JsonWebStructure jws, String expectedKid) throws org.jose4j.lang.UnresolvableKeyException- Throws:
org.jose4j.lang.UnresolvableKeyException
-
getKid
protected static String getKid(org.jose4j.jwx.JsonWebStructure jws)
-
initializeHttpsJwks
protected org.jose4j.jwk.HttpsJwks initializeHttpsJwks(String location) throws IOException
- Throws:
IOException
-
getHttpsJwks
protected org.jose4j.jwk.HttpsJwks getHttpsJwks(String location)
-
getHttpGet
protected org.jose4j.http.Get getHttpGet()
-
isHttpsJwksInitialized
protected boolean isHttpsJwksInitialized(String keyLocation) throws IOException
- Throws:
IOException
-
forcedHttpsJwksRefresh
protected boolean forcedHttpsJwksRefresh()
-
readKeyContent
protected String readKeyContent(String keyLocation) throws IOException
- Throws:
IOException
-
getUrlResolver
protected ResourceUtils.UrlStreamResolver getUrlResolver()
-
getJsonWebKey
protected static org.jose4j.jwk.JsonWebKey getJsonWebKey(String kid, List<org.jose4j.jwk.JsonWebKey> keys, String algo)
-
reportLoadKeyException
protected static void reportLoadKeyException(String keyContent, String keyLocation, Exception e) throws org.jose4j.lang.UnresolvableKeyException
- Throws:
org.jose4j.lang.UnresolvableKeyException
-
reportUnresolvableKeyException
protected static void reportUnresolvableKeyException(String keyContent, String keyLocation) throws org.jose4j.lang.UnresolvableKeyException
- Throws:
org.jose4j.lang.UnresolvableKeyException
-
tryAsJwk
protected org.jose4j.jwk.JsonWebKey tryAsJwk(org.jose4j.jwx.JsonWebStructure jws, String algo) throws org.jose4j.lang.UnresolvableKeyException- Throws:
org.jose4j.lang.UnresolvableKeyException
-
tryJWKContent
protected org.jose4j.jwk.JsonWebKey tryJWKContent(String content, String keyId, String algo, boolean encoded)
-
loadFromJwk
protected org.jose4j.jwk.JsonWebKey loadFromJwk(String content, String keyId, String algo)
-
getSecretKeyFromJwk
protected Key getSecretKeyFromJwk(org.jose4j.jwk.JsonWebKey jwk)
-
loadPEMCertificate
protected static X509Certificate loadPEMCertificate(String content)
-
-