Class JpaUserEntity
- java.lang.Object
-
- org.keycloak.models.map.common.UpdatableEntity.Impl
-
- org.keycloak.models.map.user.MapUserEntity.AbstractUserEntity
-
- org.keycloak.models.map.storage.jpa.user.entity.JpaUserEntity
-
- All Implemented Interfaces:
Serializable
,AbstractEntity
,EntityWithAttributes
,UpdatableEntity
,JpaRootEntity
,JpaRootVersionedEntity
,MapUserEntity
@Entity public class JpaUserEntity extends MapUserEntity.AbstractUserEntity implements JpaRootVersionedEntity
JPAMapUserEntity
implementation. Some fields are annotated with@Column(insertable = false, updatable = false)
to indicate that they are automatically generated from json fields. As such, these fields are non-insertable and non-updatable.- Author:
- Stefan Guilhen
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.keycloak.models.map.user.MapUserEntity
MapUserEntity.AbstractUserEntity
-
Nested classes/interfaces inherited from interface org.keycloak.models.map.common.UpdatableEntity
UpdatableEntity.Impl
-
-
Field Summary
-
Fields inherited from class org.keycloak.models.map.common.UpdatableEntity.Impl
updated
-
-
Constructor Summary
Constructors Constructor Description JpaUserEntity()
No-argument constructor, used by hibernate to instantiate entities.JpaUserEntity(UUID id, int version, Integer entityVersion, String realmId, String username, String usernameWithCase, String firstName, String lastName, String email, String emailConstraint, String federationLink, Boolean enabled, Boolean emailVerified, Long timestamp)
Used by hibernate when calling cb.construct from read(QueryParameters) method.JpaUserEntity(DeepCloner cloner)
-
Method Summary
-
Methods inherited from class org.keycloak.models.map.user.MapUserEntity.AbstractUserEntity
clearUpdatedFlag, isUpdated, moveCredential, setEmail
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.keycloak.models.map.storage.jpa.JpaRootEntity
updateEntityVersion
-
Methods inherited from interface org.keycloak.models.map.user.MapUserEntity
credentialManager
-
-
-
-
Constructor Detail
-
JpaUserEntity
public JpaUserEntity()
No-argument constructor, used by hibernate to instantiate entities.
-
JpaUserEntity
public JpaUserEntity(DeepCloner cloner)
-
JpaUserEntity
public JpaUserEntity(UUID id, int version, Integer entityVersion, String realmId, String username, String usernameWithCase, String firstName, String lastName, String email, String emailConstraint, String federationLink, Boolean enabled, Boolean emailVerified, Long timestamp)
Used by hibernate when calling cb.construct from read(QueryParameters) method. It is used to select user without metadata(json) field.
-
-
Method Detail
-
isMetadataInitialized
public boolean isMetadataInitialized()
-
getEntityVersion
public Integer getEntityVersion()
- Specified by:
getEntityVersion
in interfaceJpaRootEntity
- Returns:
- current supported version of the JPA entity used for schema versioning.
-
setEntityVersion
public void setEntityVersion(Integer entityVersion)
- Specified by:
setEntityVersion
in interfaceJpaRootEntity
- Parameters:
entityVersion
- sets current supported version to JPA entity.
-
getCurrentSchemaVersion
public Integer getCurrentSchemaVersion()
- Specified by:
getCurrentSchemaVersion
in interfaceJpaRootEntity
-
getVersion
public int getVersion()
Description copied from interface:JpaRootVersionedEntity
Version of the JPA entity used for optimistic locking- Specified by:
getVersion
in interfaceJpaRootVersionedEntity
-
getId
public String getId()
- Specified by:
getId
in interfaceAbstractEntity
- Overrides:
getId
in classMapUserEntity.AbstractUserEntity
-
setId
public void setId(String id)
- Specified by:
setId
in interfaceAbstractEntity
- Overrides:
setId
in classMapUserEntity.AbstractUserEntity
-
getRealmId
public String getRealmId()
- Specified by:
getRealmId
in interfaceMapUserEntity
-
setRealmId
public void setRealmId(String realmId)
- Specified by:
setRealmId
in interfaceMapUserEntity
-
getUsername
public String getUsername()
- Specified by:
getUsername
in interfaceMapUserEntity
- Returns:
- User's username with respecting letter case.
-
setUsername
public void setUsername(String username)
- Specified by:
setUsername
in interfaceMapUserEntity
-
getFirstName
public String getFirstName()
- Specified by:
getFirstName
in interfaceMapUserEntity
-
setFirstName
public void setFirstName(String firstName)
- Specified by:
setFirstName
in interfaceMapUserEntity
-
getCreatedTimestamp
public Long getCreatedTimestamp()
- Specified by:
getCreatedTimestamp
in interfaceMapUserEntity
-
setCreatedTimestamp
public void setCreatedTimestamp(Long createdTimestamp)
- Specified by:
setCreatedTimestamp
in interfaceMapUserEntity
-
getLastName
public String getLastName()
- Specified by:
getLastName
in interfaceMapUserEntity
-
setLastName
public void setLastName(String lastName)
- Specified by:
setLastName
in interfaceMapUserEntity
-
getEmail
public String getEmail()
- Specified by:
getEmail
in interfaceMapUserEntity
-
setEmail
public void setEmail(String email)
- Specified by:
setEmail
in interfaceMapUserEntity
-
isEnabled
public Boolean isEnabled()
- Specified by:
isEnabled
in interfaceMapUserEntity
-
setEnabled
public void setEnabled(Boolean enabled)
- Specified by:
setEnabled
in interfaceMapUserEntity
-
isEmailVerified
public Boolean isEmailVerified()
- Specified by:
isEmailVerified
in interfaceMapUserEntity
-
setEmailVerified
public void setEmailVerified(Boolean emailVerified)
- Specified by:
setEmailVerified
in interfaceMapUserEntity
-
getEmailConstraint
public String getEmailConstraint()
- Specified by:
getEmailConstraint
in interfaceMapUserEntity
-
setEmailConstraint
public void setEmailConstraint(String emailConstraint)
- Specified by:
setEmailConstraint
in interfaceMapUserEntity
-
getFederationLink
public String getFederationLink()
- Specified by:
getFederationLink
in interfaceMapUserEntity
-
setFederationLink
public void setFederationLink(String federationLink)
- Specified by:
setFederationLink
in interfaceMapUserEntity
-
getServiceAccountClientLink
public String getServiceAccountClientLink()
- Specified by:
getServiceAccountClientLink
in interfaceMapUserEntity
-
setServiceAccountClientLink
public void setServiceAccountClientLink(String serviceAccountClientLink)
- Specified by:
setServiceAccountClientLink
in interfaceMapUserEntity
-
getNotBefore
public Long getNotBefore()
- Specified by:
getNotBefore
in interfaceMapUserEntity
-
setNotBefore
public void setNotBefore(Long notBefore)
- Specified by:
setNotBefore
in interfaceMapUserEntity
-
getGroupsMembership
public Set<String> getGroupsMembership()
- Specified by:
getGroupsMembership
in interfaceMapUserEntity
-
setGroupsMembership
public void setGroupsMembership(Set<String> groupsMembership)
- Specified by:
setGroupsMembership
in interfaceMapUserEntity
-
addGroupsMembership
public void addGroupsMembership(String groupId)
- Specified by:
addGroupsMembership
in interfaceMapUserEntity
-
removeGroupsMembership
public void removeGroupsMembership(String groupId)
- Specified by:
removeGroupsMembership
in interfaceMapUserEntity
-
getRolesMembership
public Set<String> getRolesMembership()
- Specified by:
getRolesMembership
in interfaceMapUserEntity
-
setRolesMembership
public void setRolesMembership(Set<String> rolesMembership)
- Specified by:
setRolesMembership
in interfaceMapUserEntity
-
addRolesMembership
public void addRolesMembership(String roleId)
- Specified by:
addRolesMembership
in interfaceMapUserEntity
-
removeRolesMembership
public void removeRolesMembership(String roleId)
- Specified by:
removeRolesMembership
in interfaceMapUserEntity
-
getRequiredActions
public Set<String> getRequiredActions()
- Specified by:
getRequiredActions
in interfaceMapUserEntity
-
setRequiredActions
public void setRequiredActions(Set<String> requiredActions)
- Specified by:
setRequiredActions
in interfaceMapUserEntity
-
addRequiredAction
public void addRequiredAction(String requiredAction)
- Specified by:
addRequiredAction
in interfaceMapUserEntity
-
removeRequiredAction
public void removeRequiredAction(String requiredAction)
- Specified by:
removeRequiredAction
in interfaceMapUserEntity
-
getAttributes
public Map<String,List<String>> getAttributes()
- Specified by:
getAttributes
in interfaceEntityWithAttributes
-
setAttributes
public void setAttributes(Map<String,List<String>> attributes)
- Specified by:
setAttributes
in interfaceEntityWithAttributes
-
getAttribute
public List<String> getAttribute(String name)
- Specified by:
getAttribute
in interfaceEntityWithAttributes
-
setAttribute
public void setAttribute(String name, List<String> values)
- Specified by:
setAttribute
in interfaceEntityWithAttributes
-
removeAttribute
public void removeAttribute(String name)
- Specified by:
removeAttribute
in interfaceEntityWithAttributes
-
getUserConsents
public Set<MapUserConsentEntity> getUserConsents()
- Specified by:
getUserConsents
in interfaceMapUserEntity
-
getUserConsent
public Optional<MapUserConsentEntity> getUserConsent(String clientId)
- Specified by:
getUserConsent
in interfaceMapUserEntity
-
setUserConsents
public void setUserConsents(Set<MapUserConsentEntity> userConsents)
- Specified by:
setUserConsents
in interfaceMapUserEntity
-
addUserConsent
public void addUserConsent(MapUserConsentEntity userConsentEntity)
- Specified by:
addUserConsent
in interfaceMapUserEntity
-
removeUserConsent
public Boolean removeUserConsent(MapUserConsentEntity userConsentEntity)
- Specified by:
removeUserConsent
in interfaceMapUserEntity
-
removeUserConsent
public Boolean removeUserConsent(String clientId)
- Specified by:
removeUserConsent
in interfaceMapUserEntity
-
getCredentials
public List<MapUserCredentialEntity> getCredentials()
- Specified by:
getCredentials
in interfaceMapUserEntity
-
getCredential
public Optional<MapUserCredentialEntity> getCredential(String id)
- Specified by:
getCredential
in interfaceMapUserEntity
-
setCredentials
public void setCredentials(List<MapUserCredentialEntity> credentials)
- Specified by:
setCredentials
in interfaceMapUserEntity
-
addCredential
public void addCredential(MapUserCredentialEntity credentialEntity)
- Specified by:
addCredential
in interfaceMapUserEntity
-
removeCredential
public Boolean removeCredential(MapUserCredentialEntity credentialEntity)
- Specified by:
removeCredential
in interfaceMapUserEntity
-
removeCredential
public Boolean removeCredential(String id)
- Specified by:
removeCredential
in interfaceMapUserEntity
-
getFederatedIdentities
public Set<MapUserFederatedIdentityEntity> getFederatedIdentities()
- Specified by:
getFederatedIdentities
in interfaceMapUserEntity
-
getFederatedIdentity
public Optional<MapUserFederatedIdentityEntity> getFederatedIdentity(String identityProviderId)
- Specified by:
getFederatedIdentity
in interfaceMapUserEntity
-
setFederatedIdentities
public void setFederatedIdentities(Set<MapUserFederatedIdentityEntity> federatedIdentities)
- Specified by:
setFederatedIdentities
in interfaceMapUserEntity
-
addFederatedIdentity
public void addFederatedIdentity(MapUserFederatedIdentityEntity federatedIdentity)
- Specified by:
addFederatedIdentity
in interfaceMapUserEntity
-
removeFederatedIdentity
public Boolean removeFederatedIdentity(MapUserFederatedIdentityEntity federatedIdentity)
- Specified by:
removeFederatedIdentity
in interfaceMapUserEntity
-
removeFederatedIdentity
public Boolean removeFederatedIdentity(String identityProviderId)
- Specified by:
removeFederatedIdentity
in interfaceMapUserEntity
-
-