Class IdcsRoleMapperProviderBase
java.lang.Object
io.helidon.security.providers.idcs.mapper.IdcsRoleMapperProviderBase
- All Implemented Interfaces:
SecurityProvider,SubjectMappingProvider
- Direct Known Subclasses:
IdcsMtRoleMapperProvider,IdcsRoleMapperProvider
Common functionality for IDCS role mapping using
Http1Client.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classReactive token for app access to IDCS.static classFluent API builder forIdcsRoleMapperProviderBase. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final StringJson key for token to be retrieved from IDCS response when requesting application token.static final StringClient subject type used when requesting roles from IDCS.static final StringUser subject type used when requesting roles from IDCS.protected static final StringProperty sent with JAX-RS requests to override parent span context in outbound calls.protected static final StringJson key for app roles to be retrieved from IDCS response.protected static final StringJson key for group roles to be retrieved from IDCS response. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedConfigures the needed fields from the provided builder. -
Method Summary
Modifier and TypeMethodDescriptionprotected SubjectbuildSubject(Subject originalSubject, List<? extends Grant> grants) Updates original subject with the list of grants.protected StringDefault subject type to use when requesting data from IDCS.protected abstract Subjectenhance(ProviderRequest request, AuthenticationResponse previousResponse, Subject subject) Enhance subject with IDCS roles, reactive.map(ProviderRequest authenticatedRequest, AuthenticationResponse previousResponse) Map grants from authenticated request (e.g.protected OidcConfigAccess toOidcConfigso the field is not duplicated by classes that extend this provider.processRoleRequest(HttpClientRequest request, Object entity, String subjectName) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.helidon.security.spi.SecurityProvider
supportedAnnotations, supportedAttributes, supportedConfigKeys, supportedCustomObjects
-
Field Details
-
IDCS_SUBJECT_TYPE_USER
User subject type used when requesting roles from IDCS. An attempt is made to obtain it from JWT claimsub_type. If not defined, default is used as configured inIdcsRoleMapperProviderBase.Builder.- See Also:
-
IDCS_SUBJECT_TYPE_CLIENT
Client subject type used when requesting roles from IDCS. An attempt is made to obtain it from JWT claimsub_type. If not defined, default is used as configured inIdcsRoleMapperProviderBase.Builder.- See Also:
-
ROLE_GROUP
Json key for group roles to be retrieved from IDCS response.- See Also:
-
ROLE_APPROLE
Json key for app roles to be retrieved from IDCS response.- See Also:
-
ACCESS_TOKEN_KEY
Json key for token to be retrieved from IDCS response when requesting application token.- See Also:
-
PARENT_CONTEXT_CLIENT_PROPERTY
Property sent with JAX-RS requests to override parent span context in outbound calls. We cannot use the constant declared inClientTracingFilter, as it is not a required dependency.- See Also:
-
-
Constructor Details
-
IdcsRoleMapperProviderBase
Configures the needed fields from the provided builder.- Parameters:
builder- builder with oidcConfig and other needed fields.
-
-
Method Details
-
map
public AuthenticationResponse map(ProviderRequest authenticatedRequest, AuthenticationResponse previousResponse) Description copied from interface:SubjectMappingProviderMap grants from authenticated request (e.g. one or both ofProviderRequest.subject()orProviderRequest.service()returns a non-empty value) to a new authentication response. The provider can change/add/remove grants (such as groups, scopes, permissions) or change the subject to a different one. This method is only invoked after a successful authentication.- Specified by:
mapin interfaceSubjectMappingProvider- Parameters:
authenticatedRequest- request to get user and service subjects frompreviousResponse- response from previous authentication or subject mapping provider- Returns:
- a new authentication response with updated user and/or service subjects
-
enhance
protected abstract Subject enhance(ProviderRequest request, AuthenticationResponse previousResponse, Subject subject) Enhance subject with IDCS roles, reactive.- Parameters:
request- provider requestpreviousResponse- authenticated responsesubject- subject to enhance- Returns:
- future with enhanced subject
-
buildSubject
Updates original subject with the list of grants.- Parameters:
originalSubject- as was created by authentication providergrants- grants added by this role mapper- Returns:
- new subject
-
processRoleRequest
protected List<? extends Grant> processRoleRequest(HttpClientRequest request, Object entity, String subjectName) -
oidcConfig
Access toOidcConfigso the field is not duplicated by classes that extend this provider.- Returns:
- open ID Connect configuration (also used to configure access to IDCS)
-
defaultIdcsSubjectType
Default subject type to use when requesting data from IDCS.- Returns:
- configured default subject type or
IDCS_SUBJECT_TYPE_USER
-