Package org.keycloak.storage.ldap
Class LDAPWritesOnlyUserModelDelegate
- java.lang.Object
-
- org.keycloak.models.utils.UserModelDelegate
-
- org.keycloak.storage.ldap.LDAPWritesOnlyUserModelDelegate
-
- All Implemented Interfaces:
RoleMapperModel
,UserModel
public class LDAPWritesOnlyUserModelDelegate extends UserModelDelegate
User model delegate, which tracks what attributes were written to LDAP in this transaction. For those attributes, it will skip calling delegate for doing any additional updates. It may be typically used together with Read-Only delegate. The result is that read-only exception will be thrown when attempt to update any user attribute, which is NOT mapped to LDAP.- Author:
- Marek Posolda
-
-
Nested Class Summary
-
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.models.utils.UserModelDelegate
delegate
-
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 LDAPWritesOnlyUserModelDelegate(UserModel delegate, LDAPStorageProvider provider)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addRequiredAction(String action)
void
addRequiredAction(UserModel.RequiredAction action)
protected boolean
isAttributeUpdatedInLDAP(String attributeName)
protected boolean
isRequiredActionUpdatedInLDAP(String requiredActionName)
void
removeAttribute(String name)
void
removeRequiredAction(String action)
void
removeRequiredAction(UserModel.RequiredAction action)
void
setAttribute(String name, List<String> values)
void
setEmail(String email)
Sets email for this user.void
setEmailVerified(boolean verified)
void
setEnabled(boolean enabled)
void
setFirstName(String firstName)
void
setLastName(String lastName)
void
setSingleAttribute(String name, String value)
Set single value of specified attribute.void
setUsername(String username)
Sets username for this user.-
Methods inherited from class org.keycloak.models.utils.UserModelDelegate
credentialManager, deleteRoleMapping, equals, getAttributes, getAttributeStream, getClientRoleMappingsStream, getCreatedTimestamp, getDelegate, getEmail, getFederationLink, getFirstAttribute, getFirstName, getGroupsStream, getId, getLastName, getRealmRoleMappingsStream, getRequiredActionsStream, getRoleMappingsStream, getServiceAccountClientLink, getUsername, grantRole, hashCode, hasRole, isEmailVerified, isEnabled, isMemberOf, joinGroup, leaveGroup, setCreatedTimestamp, setFederationLink, setServiceAccountClientLink
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.keycloak.models.RoleMapperModel
hasDirectRole
-
Methods inherited from interface org.keycloak.models.UserModel
getGroupsCount, getGroupsCountByNameContaining, getGroupsStream
-
-
-
-
Constructor Detail
-
LDAPWritesOnlyUserModelDelegate
public LDAPWritesOnlyUserModelDelegate(UserModel delegate, LDAPStorageProvider provider)
-
-
Method Detail
-
setUsername
public void setUsername(String username)
Description copied from interface:UserModel
Sets username for this user. No default method here to allow Abstract subclasses where the username is provided in a different manner- Specified by:
setUsername
in interfaceUserModel
- Overrides:
setUsername
in classUserModelDelegate
- Parameters:
username
- username string
-
setEnabled
public void setEnabled(boolean enabled)
- Specified by:
setEnabled
in interfaceUserModel
- Overrides:
setEnabled
in classUserModelDelegate
-
setSingleAttribute
public void setSingleAttribute(String name, String value)
Description copied from interface:UserModel
Set single value of specified attribute. Remove all other existing values of this attribute- Specified by:
setSingleAttribute
in interfaceUserModel
- Overrides:
setSingleAttribute
in classUserModelDelegate
-
setAttribute
public void setAttribute(String name, List<String> values)
- Specified by:
setAttribute
in interfaceUserModel
- Overrides:
setAttribute
in classUserModelDelegate
-
removeAttribute
public void removeAttribute(String name)
- Specified by:
removeAttribute
in interfaceUserModel
- Overrides:
removeAttribute
in classUserModelDelegate
-
addRequiredAction
public void addRequiredAction(String action)
- Specified by:
addRequiredAction
in interfaceUserModel
- Overrides:
addRequiredAction
in classUserModelDelegate
-
removeRequiredAction
public void removeRequiredAction(String action)
- Specified by:
removeRequiredAction
in interfaceUserModel
- Overrides:
removeRequiredAction
in classUserModelDelegate
-
addRequiredAction
public void addRequiredAction(UserModel.RequiredAction action)
- Specified by:
addRequiredAction
in interfaceUserModel
- Overrides:
addRequiredAction
in classUserModelDelegate
-
removeRequiredAction
public void removeRequiredAction(UserModel.RequiredAction action)
- Specified by:
removeRequiredAction
in interfaceUserModel
- Overrides:
removeRequiredAction
in classUserModelDelegate
-
setFirstName
public void setFirstName(String firstName)
- Specified by:
setFirstName
in interfaceUserModel
- Overrides:
setFirstName
in classUserModelDelegate
-
setLastName
public void setLastName(String lastName)
- Specified by:
setLastName
in interfaceUserModel
- Overrides:
setLastName
in classUserModelDelegate
-
setEmail
public void setEmail(String email)
Description copied from interface:UserModel
Sets email for this user.- Specified by:
setEmail
in interfaceUserModel
- Overrides:
setEmail
in classUserModelDelegate
- Parameters:
email
- the email
-
setEmailVerified
public void setEmailVerified(boolean verified)
- Specified by:
setEmailVerified
in interfaceUserModel
- Overrides:
setEmailVerified
in classUserModelDelegate
-
isAttributeUpdatedInLDAP
protected boolean isAttributeUpdatedInLDAP(String attributeName)
-
isRequiredActionUpdatedInLDAP
protected boolean isRequiredActionUpdatedInLDAP(String requiredActionName)
-
-