Class OIDCSupport
java.lang.Object
org.apache.activemq.artemis.spi.core.security.jaas.oidc.OIDCSupport
Services and helpers used by OIDCLoginModule.
login modules are instantiated on each LoginContext.login(),
so this class delegates to XXXAccess interfaces which may provide caching for better performance.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumstatic final recordRecord for returning values fromstringArrayForPath(JWTClaimsSet, String)with indication if the path was correct. -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionOIDCSupport(Map<String, ?> options, boolean debug) Construct a helper object to support singleLoginContext.login(). -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanbooleanOption(OIDCSupport.ConfigKey configKey, Map<String, ?> options) com.nimbusds.jose.proc.JWKSecurityContextReturn aSecurityContextwith keys recently synchronized with the provider.static StringgetThumbprint(com.nimbusds.jwt.JWTClaimsSet claims) static StringgetTokenSummary(com.nimbusds.jwt.JWTClaimsSet claims) Having parsed, but not necessarily validated token, this method returns some String reference to identify the token for logging purposevoidInitialize theOIDCSupport, so we can do more configuration after calling the constructorstatic intintOption(OIDCSupport.ConfigKey configKey, Map<String, ?> options) mappingOption(OIDCSupport.ConfigKey configKey, Map<String, ?> options) voidsetHttpClientAccess(HttpClientAccess httpClientAccess) voidsetOidcMetadataAccess(OIDCMetadataAccess oidcMetadataAccess) static OIDCSupport.JWTStringArraystringArrayForPath(com.nimbusds.jwt.JWTClaimsSet claims, String path) Handy utility method to extract String array values (single or multi element) from the "claim set" of a JWT token.static String[]stringArrayOption(OIDCSupport.ConfigKey configKey, Map<String, ?> options) static StringstringOption(OIDCSupport.ConfigKey configKey, Map<String, ?> options) static booleantlsCertificateMatching(X509Certificate[] peerCertificates, com.nimbusds.jwt.JWTClaimsSet claims, boolean debug) Method which implements RFC 8705 OAuth 2.0 Mutual-TLS Client Authentication and Certificate-Bound Access Tokens.
-
Field Details
-
LOG
public static final org.slf4j.Logger LOG
-
-
Constructor Details
-
OIDCSupport
Construct a helper object to support singleLoginContext.login(). Scoped to the lifetime of a single JAAS login operation.- Parameters:
options- options passed toLoginModule.initialize(Subject, CallbackHandler, Map, Map)debug- verbosity flag
-
-
Method Details
-
stringOption
-
booleanOption
-
intOption
-
stringArrayOption
-
mappingOption
-
initialize
public void initialize()Initialize theOIDCSupport, so we can do more configuration after calling the constructor -
stringArrayForPath
public static OIDCSupport.JWTStringArray stringArrayForPath(com.nimbusds.jwt.JWTClaimsSet claims, String path) Handy utility method to extract String array values (single or multi element) from the "claim set" of a JWT token. Used after basic token validation - mostly to extract roles for fields likerealm_access.roles. The extracted value should be a String or String array.- Parameters:
claims-JWTClaimsSetfor a JWTpath- JSON path for extracting specific values from the token- Returns:
OIDCSupport.JWTStringArraywith the extracted value and the flag for marking if the value was found
-
tlsCertificateMatching
public static boolean tlsCertificateMatching(X509Certificate[] peerCertificates, com.nimbusds.jwt.JWTClaimsSet claims, boolean debug) Method which implements RFC 8705 OAuth 2.0 Mutual-TLS Client Authentication and Certificate-Bound Access Tokens. TheJWTshould containcnf/x5t#256field matching the SHA-256 of a certificate from the transport layer.- Parameters:
peerCertificates- X.509 certificate for (client) peer certificatesclaims-JWTClaimsSetfrom the token which doesn't have to be fully validated (yet)debug- verbose flag- Returns:
- whether the
cnf/x5t#256matches SHA256 digest of the peer certificate
-
getThumbprint
-
getTokenSummary
Having parsed, but not necessarily validated token, this method returns some String reference to identify the token for logging purpose- Parameters:
claims- token claims to investigate- Returns:
- some information from the token for logging purpose
-
setHttpClientAccess
-
setOidcMetadataAccess
-
currentContext
public com.nimbusds.jose.proc.JWKSecurityContext currentContext()Return aSecurityContextwith keys recently synchronized with the provider.- Returns:
JWKSecurityContextwith currently known public keys
-