Class IdcsRoleMapperProvider
java.lang.Object
io.helidon.security.providers.idcs.mapper.IdcsRoleMapperProviderBase
io.helidon.security.providers.idcs.mapper.IdcsRoleMapperProvider
- All Implemented Interfaces:
SecurityProvider, SubjectMappingProvider
public class IdcsRoleMapperProvider
extends IdcsRoleMapperProviderBase
implements SubjectMappingProvider
SubjectMappingProvider to obtain roles from IDCS server for a user.
Supports multi tenancy in IDCS.-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class IdcsRoleMapperProviderBase
IdcsRoleMapperProviderBase.AppTokenModifier and TypeClassDescriptionprotected static classReactive token for app access to IDCS. -
Field Summary
Fields inherited from class IdcsRoleMapperProviderBase
ACCESS_TOKEN_KEY, IDCS_SUBJECT_TYPE_CLIENT, IDCS_SUBJECT_TYPE_USER, PARENT_CONTEXT_CLIENT_PROPERTY, ROLE_APPROLE, ROLE_GROUPModifier 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 client 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
ConstructorsModifierConstructorDescriptionprotectedIdcsRoleMapperProvider(IdcsRoleMapperProvider.Builder<?> builder) Constructor that accepts anyIdcsRoleMapperProvider.Builderdescendant. -
Method Summary
Modifier and TypeMethodDescriptionaddAdditionalGrants(Subject subject, List<Grant> idcsGrants) Extension point to add additional grants that are not retrieved from IDCS.static IdcsRoleMapperProvider.Builder<?> builder()Creates a new builder to build instances of this class.computeGrants(Subject subject) Compute grants for the provided subject.static SecurityProviderCreates an instance from configuration.protected Subjectenhance(ProviderRequest request, AuthenticationResponse previousResponse, Subject subject) Enhance subject with IDCS roles, reactive.getGrantsFromServer(Subject subject) Retrieves grants from IDCS server.Methods inherited from class IdcsRoleMapperProviderBase
buildSubject, defaultIdcsSubjectType, map, oidcConfig, processRoleRequestModifier 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.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) Request roles from IDCS and process the response.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface SecurityProvider
supportedAnnotations, supportedAttributes, supportedConfigKeys, supportedCustomObjectsModifier and TypeMethodDescriptiondefault Collection<Class<? extends Annotation>> Provide extension annotations supported by this provider (e.g.default Collection<String> A collection of attribute names expected by this provider to override endpoint configuration.default Collection<String> Keys expected in configuration.default Collection<Class<? extends ProviderConfig>> Class of the configuration type.
-
Constructor Details
-
IdcsRoleMapperProvider
Constructor that accepts anyIdcsRoleMapperProvider.Builderdescendant.- Parameters:
builder- used to configure this instance
-
-
Method Details
-
builder
Creates a new builder to build instances of this class.- Returns:
- a new fluent API builder.
-
create
Creates an instance from configuration.Expects:
- oidc-config to load an instance of
OidcConfig - cache-config (optional) to load an instance of
EvictableCachefor role caching
- Parameters:
config- configuration of this provider- Returns:
- a new instance configured from config
- oidc-config to load an instance of
-
enhance
protected Subject enhance(ProviderRequest request, AuthenticationResponse previousResponse, Subject subject) Description copied from class:IdcsRoleMapperProviderBaseEnhance subject with IDCS roles, reactive.- Specified by:
enhancein classIdcsRoleMapperProviderBase- Parameters:
request- provider requestpreviousResponse- authenticated responsesubject- subject to enhance- Returns:
- future with enhanced subject
-
computeGrants
Compute grants for the provided subject. This implementation gets grants from servergetGrantsFromServer(io.helidon.security.Subject).- Parameters:
subject- to retrieve roles (or in generalgrants)- Returns:
- future with grants to be added to the subject
-
addAdditionalGrants
-
getGrantsFromServer
-