Package org.keycloak.storage.adapter
Class AbstractUserAdapterFederatedStorage.Streams
- java.lang.Object
-
- org.keycloak.models.UserModelDefaultMethods
-
- org.keycloak.storage.adapter.AbstractUserAdapterFederatedStorage
-
- org.keycloak.storage.adapter.AbstractUserAdapterFederatedStorage.Streams
-
- All Implemented Interfaces:
RoleMapperModel,RoleMapperModel.Streams,UserModel,UserModel.Streams
- Enclosing class:
- AbstractUserAdapterFederatedStorage
public abstract static class AbstractUserAdapterFederatedStorage.Streams extends AbstractUserAdapterFederatedStorage implements UserModel.Streams
TheAbstractUserAdapterFederatedStorage.Streamsclass extends theAbstractUserAdapterFederatedStorageabstract class and implements theUserModel.Streamsinterface, allowing subclasses to focus on the implementation of theStream-based query methods and providing default implementations for the collections-based variants that delegate to theirStreamcounterparts.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.keycloak.storage.adapter.AbstractUserAdapterFederatedStorage
AbstractUserAdapterFederatedStorage.Streams
-
Nested classes/interfaces inherited from interface org.keycloak.models.RoleMapperModel
RoleMapperModel.Streams
-
Nested classes/interfaces inherited from interface org.keycloak.models.UserModel
UserModel.RequiredAction, UserModel.SearchableFields, UserModel.Streams, UserModel.UserRemovedEvent
-
-
Field Summary
-
Fields inherited from class org.keycloak.storage.adapter.AbstractUserAdapterFederatedStorage
CREATED_TIMESTAMP_ATTRIBUTE, EMAIL_ATTRIBUTE, EMAIL_VERIFIED_ATTRIBUTE, ENABLED_ATTRIBUTE, FIRST_NAME_ATTRIBUTE, LAST_NAME_ATTRIBUTE, realm, session, storageId, storageProviderModel
-
Fields inherited from interface org.keycloak.models.UserModel
COMPARE_BY_USERNAME, DISABLED_REASON, EMAIL, EMAIL_VERIFIED, ENABLED, EXACT, FIRST_NAME, GROUPS, IDP_ALIAS, IDP_USER_ID, INCLUDE_SERVICE_ACCOUNT, LAST_NAME, LOCALE, SEARCH, USERNAME
-
-
Constructor Summary
Constructors Constructor Description Streams(KeycloakSession session, RealmModel realm, ComponentModel storageProviderModel)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<String>getAttribute(String name)Stream<String>getAttributeStream(String name)Obtains all values associated with the specified attribute name.Set<RoleModel>getClientRoleMappings(ClientModel app)Gets role mappings from federated storage and automatically appends default roles.Stream<RoleModel>getClientRoleMappingsStream(ClientModel app)Returns stream of client roles that are directly set to this object for the given client.Set<GroupModel>getGroups()Gets groups from federated storage and automatically appends default groups of realm.Stream<GroupModel>getGroupsStream()Obtains the groups associated with the user.Set<RoleModel>getRealmRoleMappings()Gets role mappings from federated storage and automatically appends default roles.Stream<RoleModel>getRealmRoleMappingsStream()Returns stream of realm roles that are directly set to this object.Set<String>getRequiredActions()Stream<String>getRequiredActionsStream()Obtains the names of required actions associated with the user.Set<RoleModel>getRoleMappings()Gets role mappings from federated storage and automatically appends default roles.Stream<RoleModel>getRoleMappingsStream()Returns stream of all role (both realm all client) that are directly set to this object.booleanhasRole(RoleModel role)Returnstrueif this object is directly or indirectly assigned the given role,falseotherwise.booleanisMemberOf(GroupModel group)-
Methods inherited from class org.keycloak.storage.adapter.AbstractUserAdapterFederatedStorage
addRequiredAction, addRequiredAction, appendDefaultGroups, appendDefaultRolesToRoleMappings, deleteRoleMapping, equals, getAttributes, getCreatedTimestamp, getFederatedRoleMappings, getFederatedStorage, getFederationLink, getFirstAttribute, getGroupsInternal, getId, getRoleMappingsInternal, getServiceAccountClientLink, grantRole, hashCode, isEmailVerified, isEnabled, joinGroup, leaveGroup, mapAttribute, removeAttribute, removeRequiredAction, removeRequiredAction, setAttribute, setCreatedTimestamp, setEmailVerified, setEnabled, setFederationLink, setServiceAccountClientLink, setSingleAttribute
-
Methods inherited from class org.keycloak.models.UserModelDefaultMethods
getEmail, getFirstName, getLastName, setEmail, setFirstName, setLastName, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.keycloak.models.RoleMapperModel
deleteRoleMapping, grantRole, hasDirectRole
-
Methods inherited from interface org.keycloak.models.UserModel
addRequiredAction, addRequiredAction, getAttributes, getCreatedTimestamp, getEmail, getFederationLink, getFirstAttribute, getFirstName, getGroups, getGroups, getGroupsCount, getGroupsCountByNameContaining, getGroupsStream, getId, getLastName, getServiceAccountClientLink, getUsername, isEmailVerified, isEnabled, joinGroup, leaveGroup, removeAttribute, removeRequiredAction, removeRequiredAction, setAttribute, setCreatedTimestamp, setEmail, setEmailVerified, setEnabled, setFederationLink, setFirstName, setLastName, setServiceAccountClientLink, setSingleAttribute, setUsername
-
-
-
-
Constructor Detail
-
Streams
public Streams(KeycloakSession session, RealmModel realm, ComponentModel storageProviderModel)
-
-
Method Detail
-
getRequiredActions
public Set<String> getRequiredActions()
- Specified by:
getRequiredActionsin interfaceUserModel- Specified by:
getRequiredActionsin interfaceUserModel.Streams- Overrides:
getRequiredActionsin classAbstractUserAdapterFederatedStorage
-
getRequiredActionsStream
public Stream<String> getRequiredActionsStream()
Description copied from interface:UserModelObtains the names of required actions associated with the user.- Specified by:
getRequiredActionsStreamin interfaceUserModel- Specified by:
getRequiredActionsStreamin interfaceUserModel.Streams- Returns:
- a non-null
Streamof required action names.
-
getAttribute
public List<String> getAttribute(String name)
- Specified by:
getAttributein interfaceUserModel- Specified by:
getAttributein interfaceUserModel.Streams- Overrides:
getAttributein classAbstractUserAdapterFederatedStorage- Returns:
- list of all attribute values or empty list if there are not any values. Never return null
-
getAttributeStream
public Stream<String> getAttributeStream(String name)
Description copied from interface:UserModelObtains all values associated with the specified attribute name.- Specified by:
getAttributeStreamin interfaceUserModel- Specified by:
getAttributeStreamin interfaceUserModel.Streams- Parameters:
name- the name of the attribute.- Returns:
- a non-null
Streamof attribute values.
-
getGroups
public Set<GroupModel> getGroups()
Description copied from class:AbstractUserAdapterFederatedStorageGets groups from federated storage and automatically appends default groups of realm. Also calls getGroupsInternal() method to pull group membership from provider. Implementors can override that method- Specified by:
getGroupsin interfaceUserModel- Specified by:
getGroupsin interfaceUserModel.Streams- Overrides:
getGroupsin classAbstractUserAdapterFederatedStorage
-
getGroupsStream
public Stream<GroupModel> getGroupsStream()
Description copied from interface:UserModelObtains the groups associated with the user.- Specified by:
getGroupsStreamin interfaceUserModel- Specified by:
getGroupsStreamin interfaceUserModel.Streams- Returns:
- a non-null
Streamof groups.
-
isMemberOf
public boolean isMemberOf(GroupModel group)
- Specified by:
isMemberOfin interfaceUserModel- Overrides:
isMemberOfin classAbstractUserAdapterFederatedStorage
-
getRealmRoleMappings
public Set<RoleModel> getRealmRoleMappings()
Description copied from class:AbstractUserAdapterFederatedStorageGets role mappings from federated storage and automatically appends default roles. Also calls getRoleMappingsInternal() method to pull role mappings from provider. Implementors can override that method- Specified by:
getRealmRoleMappingsin interfaceRoleMapperModel- Specified by:
getRealmRoleMappingsin interfaceRoleMapperModel.Streams- Overrides:
getRealmRoleMappingsin classAbstractUserAdapterFederatedStorage- Returns:
- see description
-
getRealmRoleMappingsStream
public Stream<RoleModel> getRealmRoleMappingsStream()
Description copied from interface:RoleMapperModelReturns stream of realm roles that are directly set to this object.- Specified by:
getRealmRoleMappingsStreamin interfaceRoleMapperModel- Specified by:
getRealmRoleMappingsStreamin interfaceRoleMapperModel.Streams- Returns:
- Stream of
RoleModel. Never returnsnull.
-
getClientRoleMappings
public Set<RoleModel> getClientRoleMappings(ClientModel app)
Description copied from class:AbstractUserAdapterFederatedStorageGets role mappings from federated storage and automatically appends default roles. Also calls getRoleMappingsInternal() method to pull role mappings from provider. Implementors can override that method- Specified by:
getClientRoleMappingsin interfaceRoleMapperModel- Specified by:
getClientRoleMappingsin interfaceRoleMapperModel.Streams- Overrides:
getClientRoleMappingsin classAbstractUserAdapterFederatedStorage- Parameters:
app- Client to get the roles for- Returns:
- see description
-
getClientRoleMappingsStream
public Stream<RoleModel> getClientRoleMappingsStream(ClientModel app)
Description copied from interface:RoleMapperModelReturns stream of client roles that are directly set to this object for the given client.- Specified by:
getClientRoleMappingsStreamin interfaceRoleMapperModel- Specified by:
getClientRoleMappingsStreamin interfaceRoleMapperModel.Streams- Parameters:
app-ClientModelClient to get the roles for.- Returns:
- Stream of
RoleModel. Never returnsnull.
-
getRoleMappings
public Set<RoleModel> getRoleMappings()
Description copied from class:AbstractUserAdapterFederatedStorageGets role mappings from federated storage and automatically appends default roles. Also calls getRoleMappingsInternal() method to pull role mappings from provider. Implementors can override that method- Specified by:
getRoleMappingsin interfaceRoleMapperModel- Specified by:
getRoleMappingsin interfaceRoleMapperModel.Streams- Overrides:
getRoleMappingsin classAbstractUserAdapterFederatedStorage- Returns:
-
getRoleMappingsStream
public Stream<RoleModel> getRoleMappingsStream()
Description copied from interface:RoleMapperModelReturns stream of all role (both realm all client) that are directly set to this object.- Specified by:
getRoleMappingsStreamin interfaceRoleMapperModel- Specified by:
getRoleMappingsStreamin interfaceRoleMapperModel.Streams- Returns:
- Stream of
RoleModel. Never returnsnull.
-
hasRole
public boolean hasRole(RoleModel role)
Description copied from interface:RoleMapperModelReturnstrueif this object is directly or indirectly assigned the given role,falseotherwise.For example,
trueis returned for hasRole(R) if:- R is directly assigned to this object
- R is not assigned to this object but this object belongs to a group G which is assigned the role R
- R is not assigned to this object but this object belongs to a group G, and G belongs to group H which is assigned the role R
- Specified by:
hasRolein interfaceRoleMapperModel- Overrides:
hasRolein classAbstractUserAdapterFederatedStorage- Returns:
- see description
- See Also:
if you want to check if this object is directly assigned to a role
-
-