Class JpaUserSessionEntity
- java.lang.Object
-
- org.keycloak.models.map.common.UpdatableEntity.Impl
-
- org.keycloak.models.map.userSession.MapUserSessionEntity.AbstractUserSessionEntity
-
- org.keycloak.models.map.storage.jpa.userSession.entity.JpaUserSessionEntity
-
- All Implemented Interfaces:
Serializable
,AbstractEntity
,ExpirableEntity
,UpdatableEntity
,JpaRootEntity
,JpaRootVersionedEntity
,MapUserSessionEntity
@Entity public class JpaUserSessionEntity extends MapUserSessionEntity.AbstractUserSessionEntity implements JpaRootVersionedEntity
There are some fields marked by@Column(insertable = false, updatable = false)
. Those fields are automatically generated by database from json field, therefore marked as non-insertable and non-updatable to instruct hibernate.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.keycloak.models.map.userSession.MapUserSessionEntity
MapUserSessionEntity.AbstractUserSessionEntity
-
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 JpaUserSessionEntity()
No-argument constructor, used by hibernate to instantiate entities.JpaUserSessionEntity(DeepCloner cloner)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAuthenticatedClientSession(MapAuthenticatedClientSessionEntity clientSession)
void
clearAuthenticatedClientSessions()
boolean
equals(Object obj)
Optional<MapAuthenticatedClientSessionEntity>
getAuthenticatedClientSession(String clientUUID)
Set<MapAuthenticatedClientSessionEntity>
getAuthenticatedClientSessions()
String
getAuthMethod()
String
getBrokerSessionId()
String
getBrokerUserId()
Integer
getCurrentSchemaVersion()
Integer
getEntityVersion()
Long
getExpiration()
Returns a point in the time (timestamp in milliseconds since The Epoch) when this entity expires.String
getId()
String
getIpAddress()
Long
getLastSessionRefresh()
Returns a point in time (timestamp in milliseconds since The Epoch) when the user session entity was last refreshed.String
getLoginUsername()
String
getNote(String name)
Map<String,String>
getNotes()
UserSessionModel.SessionPersistenceState
getPersistenceState()
String
getRealmId()
UserSessionModel.State
getState()
Long
getTimestamp()
Returns a point in time (timestamp in milliseconds since The Epoch) when the user session entity was created.String
getUserId()
int
getVersion()
Version of the JPA entity used for optimistic lockingint
hashCode()
boolean
isMetadataInitialized()
Boolean
isOffline()
Boolean
isRememberMe()
Boolean
removeAuthenticatedClientSession(String clientUUID)
Boolean
removeNote(String name)
void
setAuthMethod(String authMethod)
void
setBrokerSessionId(String brokerSessionId)
void
setBrokerUserId(String brokerUserId)
void
setEntityVersion(Integer entityVersion)
void
setExpiration(Long expiration)
Sets a point in the time (timestamp in milliseconds since The Epoch) when this entity expires.void
setId(String id)
void
setIpAddress(String ipAddress)
void
setLastSessionRefresh(Long lastSessionRefresh)
Sets a point in the (timestamp in milliseconds since The Epoch) when the user session entity was last refreshed.void
setLoginUsername(String loginUsername)
void
setNote(String name, String value)
void
setNotes(Map<String,String> notes)
void
setOffline(Boolean offline)
void
setPersistenceState(UserSessionModel.SessionPersistenceState persistenceState)
void
setRealmId(String realmId)
void
setRememberMe(Boolean rememberMe)
void
setState(UserSessionModel.State state)
void
setTimestamp(Long timestamp)
Sets a point in the (timestamp in milliseconds since The Epoch) when the user session entity was created.void
setUserId(String userId)
-
Methods inherited from class org.keycloak.models.map.userSession.MapUserSessionEntity.AbstractUserSessionEntity
clearUpdatedFlag, isUpdated
-
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
-
-
-
-
Constructor Detail
-
JpaUserSessionEntity
public JpaUserSessionEntity()
No-argument constructor, used by hibernate to instantiate entities.
-
JpaUserSessionEntity
public JpaUserSessionEntity(DeepCloner cloner)
-
-
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 classMapUserSessionEntity.AbstractUserSessionEntity
-
setId
public void setId(String id)
- Specified by:
setId
in interfaceAbstractEntity
- Overrides:
setId
in classMapUserSessionEntity.AbstractUserSessionEntity
-
getRealmId
public String getRealmId()
- Specified by:
getRealmId
in interfaceMapUserSessionEntity
-
setRealmId
public void setRealmId(String realmId)
- Specified by:
setRealmId
in interfaceMapUserSessionEntity
-
getUserId
public String getUserId()
- Specified by:
getUserId
in interfaceMapUserSessionEntity
-
setUserId
public void setUserId(String userId)
- Specified by:
setUserId
in interfaceMapUserSessionEntity
-
getLoginUsername
public String getLoginUsername()
- Specified by:
getLoginUsername
in interfaceMapUserSessionEntity
-
setLoginUsername
public void setLoginUsername(String loginUsername)
- Specified by:
setLoginUsername
in interfaceMapUserSessionEntity
-
getIpAddress
public String getIpAddress()
- Specified by:
getIpAddress
in interfaceMapUserSessionEntity
-
setIpAddress
public void setIpAddress(String ipAddress)
- Specified by:
setIpAddress
in interfaceMapUserSessionEntity
-
getAuthMethod
public String getAuthMethod()
- Specified by:
getAuthMethod
in interfaceMapUserSessionEntity
-
setAuthMethod
public void setAuthMethod(String authMethod)
- Specified by:
setAuthMethod
in interfaceMapUserSessionEntity
-
isOffline
public Boolean isOffline()
- Specified by:
isOffline
in interfaceMapUserSessionEntity
-
setOffline
public void setOffline(Boolean offline)
- Specified by:
setOffline
in interfaceMapUserSessionEntity
-
isRememberMe
public Boolean isRememberMe()
- Specified by:
isRememberMe
in interfaceMapUserSessionEntity
-
setRememberMe
public void setRememberMe(Boolean rememberMe)
- Specified by:
setRememberMe
in interfaceMapUserSessionEntity
-
getTimestamp
public Long getTimestamp()
Description copied from interface:MapUserSessionEntity
Returns a point in time (timestamp in milliseconds since The Epoch) when the user session entity was created.- Specified by:
getTimestamp
in interfaceMapUserSessionEntity
- Returns:
- a timestamp in milliseconds since The Epoch or
null
when the time is unknown
-
setTimestamp
public void setTimestamp(Long timestamp)
Description copied from interface:MapUserSessionEntity
Sets a point in the (timestamp in milliseconds since The Epoch) when the user session entity was created.- Specified by:
setTimestamp
in interfaceMapUserSessionEntity
- Parameters:
timestamp
- a timestamp in milliseconds since The Epoch ornull
when the time is unknown
-
getLastSessionRefresh
public Long getLastSessionRefresh()
Description copied from interface:MapUserSessionEntity
Returns a point in time (timestamp in milliseconds since The Epoch) when the user session entity was last refreshed.- Specified by:
getLastSessionRefresh
in interfaceMapUserSessionEntity
- Returns:
- a timestamp in milliseconds since The Epoch or
null
when the time is unknown
-
setLastSessionRefresh
public void setLastSessionRefresh(Long lastSessionRefresh)
Description copied from interface:MapUserSessionEntity
Sets a point in the (timestamp in milliseconds since The Epoch) when the user session entity was last refreshed.- Specified by:
setLastSessionRefresh
in interfaceMapUserSessionEntity
- Parameters:
lastSessionRefresh
- a timestamp in milliseconds since The Epoch ornull
when the time is unknown
-
getExpiration
public Long getExpiration()
Description copied from interface:ExpirableEntity
Returns a point in the time (timestamp in milliseconds since The Epoch) when this entity expires.- Specified by:
getExpiration
in interfaceExpirableEntity
- Returns:
- a timestamp in milliseconds since The Epoch or
null
if this entity never expires or expiration is not known.
-
setExpiration
public void setExpiration(Long expiration)
Description copied from interface:ExpirableEntity
Sets a point in the time (timestamp in milliseconds since The Epoch) when this entity expires.- Specified by:
setExpiration
in interfaceExpirableEntity
- Parameters:
expiration
- a timestamp in milliseconds since The Epoch ornull
if this entity never expires.
-
getState
public UserSessionModel.State getState()
- Specified by:
getState
in interfaceMapUserSessionEntity
-
setState
public void setState(UserSessionModel.State state)
- Specified by:
setState
in interfaceMapUserSessionEntity
-
getPersistenceState
public UserSessionModel.SessionPersistenceState getPersistenceState()
- Specified by:
getPersistenceState
in interfaceMapUserSessionEntity
-
setPersistenceState
public void setPersistenceState(UserSessionModel.SessionPersistenceState persistenceState)
- Specified by:
setPersistenceState
in interfaceMapUserSessionEntity
-
getNotes
public Map<String,String> getNotes()
- Specified by:
getNotes
in interfaceMapUserSessionEntity
-
getNote
public String getNote(String name)
- Specified by:
getNote
in interfaceMapUserSessionEntity
-
setNotes
public void setNotes(Map<String,String> notes)
- Specified by:
setNotes
in interfaceMapUserSessionEntity
-
removeNote
public Boolean removeNote(String name)
- Specified by:
removeNote
in interfaceMapUserSessionEntity
-
setNote
public void setNote(String name, String value)
- Specified by:
setNote
in interfaceMapUserSessionEntity
-
getBrokerSessionId
public String getBrokerSessionId()
- Specified by:
getBrokerSessionId
in interfaceMapUserSessionEntity
-
setBrokerSessionId
public void setBrokerSessionId(String brokerSessionId)
- Specified by:
setBrokerSessionId
in interfaceMapUserSessionEntity
-
getBrokerUserId
public String getBrokerUserId()
- Specified by:
getBrokerUserId
in interfaceMapUserSessionEntity
-
setBrokerUserId
public void setBrokerUserId(String brokerUserId)
- Specified by:
setBrokerUserId
in interfaceMapUserSessionEntity
-
getAuthenticatedClientSessions
public Set<MapAuthenticatedClientSessionEntity> getAuthenticatedClientSessions()
- Specified by:
getAuthenticatedClientSessions
in interfaceMapUserSessionEntity
-
addAuthenticatedClientSession
public void addAuthenticatedClientSession(MapAuthenticatedClientSessionEntity clientSession)
- Specified by:
addAuthenticatedClientSession
in interfaceMapUserSessionEntity
-
getAuthenticatedClientSession
public Optional<MapAuthenticatedClientSessionEntity> getAuthenticatedClientSession(String clientUUID)
- Specified by:
getAuthenticatedClientSession
in interfaceMapUserSessionEntity
-
removeAuthenticatedClientSession
public Boolean removeAuthenticatedClientSession(String clientUUID)
- Specified by:
removeAuthenticatedClientSession
in interfaceMapUserSessionEntity
-
clearAuthenticatedClientSessions
public void clearAuthenticatedClientSessions()
- Specified by:
clearAuthenticatedClientSessions
in interfaceMapUserSessionEntity
- Overrides:
clearAuthenticatedClientSessions
in classMapUserSessionEntity.AbstractUserSessionEntity
-
-