Class AbstractOAuth2Authenticator
java.lang.Object
org.frankframework.lifecycle.servlets.AbstractServletAuthenticator
org.frankframework.lifecycle.servlets.AbstractOAuth2Authenticator
- All Implemented Interfaces:
IAuthenticator, org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware
- Direct Known Subclasses:
BearerOnlyAuthenticator, OAuth2Authenticator
Abstract base class for OAuth2-based authenticators, providing shared configuration fields
for JWT/OIDC-based authentication flows.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected StringSets the expected audience claim of the JWT token to validate.protected StringThe claim name in the JWT token that contains the authorities of the user.protected StringThe issuer identifier URI of the authorization server.protected StringThe URI of the JSON Web Key (JWK) set containing the public keys used to verify any JWT token issued by the authorization server.protected StringThe URI of the user info endpoint used to retrieve information about the authenticated user.protected StringThe attribute name used to extract the username from the OAuth2 user information or JWT token.Fields inherited from class AbstractServletAuthenticator
ALLOW_FORWARDED_HEADERS_PASSTHROUGH_REQUESTS_KEY, ALLOW_OPTIONS_REQUESTS_KEY, DEFAULT_IBIS_ROLES, DEFAULT_ROLE_PREFIX, log -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidconfigureBearerTokenResourceServer(org.springframework.security.config.annotation.web.builders.HttpSecurity http) Enables bearer-token (JWT) validation as an OAuth2 resource server on the givenHttpSecurity.protected org.springframework.security.authentication.AbstractAuthenticationTokenjwtAuthenticationTokenConverter(org.springframework.security.oauth2.jwt.Jwt jwt) Our own implementation similar to Spring'sJwtAuthenticationConverter.Methods inherited from class AbstractServletAuthenticator
build, configure, configureHttpSecurity, getAuthorizationManager, getEnvironmentProperties, getPrivateEndpoints, registerServlet, setApplicationContext
-
Field Details
-
audience
Sets the expected audience claim of the JWT token to validate. If set, the JWT token must contain this value in itsaudclaim. -
issuerUri
The issuer identifier URI of the authorization server. This is used to validate the issuer claim in ID tokens.e.g.
https://accounts.google.com -
jwkSetUri
The URI of the JSON Web Key (JWK) set containing the public keys used to verify any JWT token issued by the authorization server.e.g.
https://www.googleapis.com/oauth2/v3/certs -
userInfoUri
The URI of the user info endpoint used to retrieve information about the authenticated user.This is optional, as all required user info might already be present in the JWT token.
e.g.
https://www.googleapis.com/oauth2/v3/userinfo -
userNameAttributeName
The attribute name used to extract the username from the OAuth2 user information or JWT token. Different OAuth2 providers may use different attribute names to identify the user.Common values include:
sub- The subject identifieremail- The user's email addresspreferred_username- The user's preferred username
-
authoritiesClaimName
The claim name in the JWT token that contains the authorities of the user. Defaults to any of
JwtGrantedAuthoritiesConverter#WELL_KNOWN_AUTHORITIES_CLAIM_NAMESwhen this value is not set.For keycloak, "realm_access.roles" is the standard claim, this is a 'nested' value. When we encounter a dot (.) in the claim name, we assume it is a nested claim and use the custom mapper.
-
-
Constructor Details
-
AbstractOAuth2Authenticator
public AbstractOAuth2Authenticator()
-
-
Method Details
-
configureBearerTokenResourceServer
protected void configureBearerTokenResourceServer(org.springframework.security.config.annotation.web.builders.HttpSecurity http) Enables bearer-token (JWT) validation as an OAuth2 resource server on the givenHttpSecurity. Validates the JWT configuration and installs the shared decoder + authority converter. -
jwtAuthenticationTokenConverter
protected org.springframework.security.authentication.AbstractAuthenticationToken jwtAuthenticationTokenConverter(org.springframework.security.oauth2.jwt.Jwt jwt) Our own implementation similar to Spring'sJwtAuthenticationConverter. Unlike Spring's Converter this one is capable of:- Enriching the JWT claimset by calling the 'UserInfo' endpoint.
- Splitting nested roles, eg.
realm_access.roles. - Splitting a claim String on both `comma's` and `spaces`.
- Splitting a single entry Claim list on both `comma's` and `spaces`.
- Validating if the found Authorities may access the target resource.
-