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 Details

    • 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 Details

    • AbstractKeyLocationResolver

      public AbstractKeyLocationResolver(JWTAuthContextInfo authContextInfo) throws org.jose4j.lang.UnresolvableKeyException
      Throws:
      org.jose4j.lang.UnresolvableKeyException
  • Method Details

    • 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 configuredAlgo) throws org.jose4j.lang.UnresolvableKeyException
      Throws:
      org.jose4j.lang.UnresolvableKeyException
    • getHttpsJwk

      protected org.jose4j.jwk.JsonWebKey getHttpsJwk(String kid, String algo)
    • getJsonWebKey

      protected org.jose4j.jwk.JsonWebKey getJsonWebKey(String kid, String algo)
    • tryJWKContent

      protected org.jose4j.jwk.JsonWebKey tryJWKContent(String content, String keyId, String algo, boolean encoded)
    • loadJWKContent

      protected void loadJWKContent(String content)
    • 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)