Class JkuVerificationKeyResolver
java.lang.Object
io.confluent.kafka.clients.plugins.auth.jwt.JkuVerificationKeyResolver
- All Implemented Interfaces:
CloseableVerificationKeyResolver,Closeable,AutoCloseable,org.jose4j.keys.resolvers.VerificationKeyResolver
public final class JkuVerificationKeyResolver
extends Object
implements CloseableVerificationKeyResolver
Inspired by Confluent's Schroedinger https://github.com/confluentinc/schroedinger
JkuVerificationKeyResolver extracts jku from the JWT header and validates
that it is from an authorized domain.
It then finds the cached
AsyncHttpsJwksVerificationKeyResolver and
uses it for key verification.-
Constructor Summary
ConstructorsConstructorDescriptionJkuVerificationKeyResolver(Collection<String> domainWhitelist) JkuVerificationKeyResolver(Collection<String> domainWhitelist, boolean unsafeAllowed) JkuVerificationKeyResolver(Function<String, AsyncHttpsJwks> httpsJwksSupplier, Collection<String> domainWhitelist, boolean disambiguateKey, boolean unsafeAllowed) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()static booleanhasValidJkuDomain(Collection<String> domainWhitelist, String requiredProtocol, String jku) resolveKey(org.jose4j.jws.JsonWebSignature jws, List<org.jose4j.jwx.JsonWebStructure> nestingContext)
-
Constructor Details
-
JkuVerificationKeyResolver
-
JkuVerificationKeyResolver
-
JkuVerificationKeyResolver
public JkuVerificationKeyResolver(Function<String, AsyncHttpsJwks> httpsJwksSupplier, Collection<String> domainWhitelist, boolean disambiguateKey, boolean unsafeAllowed)
-
-
Method Details
-
resolveKey
public Key resolveKey(org.jose4j.jws.JsonWebSignature jws, List<org.jose4j.jwx.JsonWebStructure> nestingContext) throws org.jose4j.lang.UnresolvableKeyException - Specified by:
resolveKeyin interfaceorg.jose4j.keys.resolvers.VerificationKeyResolver- Throws:
org.jose4j.lang.UnresolvableKeyException
-
hasValidJkuDomain
public static boolean hasValidJkuDomain(Collection<String> domainWhitelist, String requiredProtocol, String jku) -
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-