Tabnine Logo
UserSessionAdapter.getEntity
Code IndexAdd Tabnine to your IDE (free)

How to use
getEntity
method
in
org.keycloak.models.sessions.infinispan.UserSessionAdapter

Best Java code snippets using org.keycloak.models.sessions.infinispan.UserSessionAdapter.getEntity (Showing top 8 results out of 315)

origin: org.keycloak/keycloak-model-infinispan

UserSessionEntity getUserSessionEntity(UserSessionModel userSession, boolean offline) {
  if (userSession instanceof UserSessionAdapter) {
    return ((UserSessionAdapter) userSession).getEntity();
  } else {
    return getUserSessionEntity(userSession.getId(), offline);
  }
}
origin: org.keycloak/keycloak-model-sessions-infinispan

void attachSession(UserSessionAdapter userSession, ClientSessionModel clientSession) {
  UserSessionEntity entity = userSession.getEntity();
  String clientSessionId = clientSession.getId();
  if (entity.getClientSessions() == null) {
    entity.setClientSessions(new HashSet<String>());
  }
  if (!entity.getClientSessions().contains(clientSessionId)) {
    entity.getClientSessions().add(clientSessionId);
    userSession.update();
  }
}
origin: org.keycloak/keycloak-model-sessions-infinispan

void dettachSession(UserSessionAdapter userSession, ClientSessionModel clientSession) {
  UserSessionEntity entity = userSession.getEntity();
  String clientSessionId = clientSession.getId();
  if (entity.getClientSessions() != null && entity.getClientSessions().contains(clientSessionId)) {
    entity.getClientSessions().remove(clientSessionId);
    if (entity.getClientSessions().isEmpty()) {
      entity.setClientSessions(null);
    }
    userSession.update();
  }
}
origin: org.keycloak/keycloak-model-sessions-infinispan

@Override
public UserSessionModel createOfflineUserSession(UserSessionModel userSession) {
  UserSessionAdapter offlineUserSession = importUserSession(userSession, true);
  // started and lastSessionRefresh set to current time
  int currentTime = Time.currentTime();
  offlineUserSession.getEntity().setStarted(currentTime);
  offlineUserSession.setLastSessionRefresh(currentTime);
  return offlineUserSession;
}
origin: org.keycloak/keycloak-model-infinispan

@Override
public UserSessionModel createOfflineUserSession(UserSessionModel userSession) {
  UserSessionAdapter offlineUserSession = importUserSession(userSession, true);
  // started and lastSessionRefresh set to current time
  int currentTime = Time.currentTime();
  offlineUserSession.getEntity().setStarted(currentTime);
  offlineUserSession.setLastSessionRefresh(currentTime);
  return offlineUserSession;
}
origin: org.keycloak/keycloak-model-sessions-infinispan

protected void removeClientSession(RealmModel realm, ClientSessionModel clientSession, boolean offline) {
  Cache<String, SessionEntity> cache = getCache(offline);
  UserSessionModel userSession = clientSession.getUserSession();
  if (userSession != null)  {
    UserSessionEntity entity = ((UserSessionAdapter) userSession).getEntity();
    if (entity.getClientSessions() != null) {
      entity.getClientSessions().remove(clientSession.getId());
    }
    tx.replace(cache, entity.getId(), entity);
  }
  tx.remove(cache, clientSession.getId());
}
origin: org.keycloak/keycloak-model-sessions-infinispan

protected void removeClientSession(RealmModel realm, ClientSessionModel clientSession, boolean offline) {
  Cache<String, SessionEntity> cache = getCache(offline);
  UserSessionModel userSession = clientSession.getUserSession();
  if (userSession != null)  {
    UserSessionEntity entity = ((UserSessionAdapter) userSession).getEntity();
    if (entity.getClientSessions() != null) {
      entity.getClientSessions().remove(clientSession.getId());
    }
    tx.replace(cache, entity.getId(), entity);
  }
  tx.remove(cache, clientSession.getId());
}
origin: org.keycloak/keycloak-model-infinispan

private AuthenticatedClientSessionAdapter importClientSession(UserSessionAdapter sessionToImportInto, AuthenticatedClientSessionModel clientSession,
                               InfinispanChangelogBasedTransaction<String, UserSessionEntity> userSessionUpdateTx,
                               InfinispanChangelogBasedTransaction<UUID, AuthenticatedClientSessionEntity> clientSessionUpdateTx,
                               boolean offline) {
  AuthenticatedClientSessionEntity entity = createAuthenticatedClientSessionInstance(clientSession, sessionToImportInto.getRealm().getId(), offline);
  final UUID clientSessionId = entity.getId();
  SessionUpdateTask<AuthenticatedClientSessionEntity> createClientSessionTask = Tasks.addIfAbsentSync();
  clientSessionUpdateTx.addTask(entity.getId(), createClientSessionTask, entity);
  AuthenticatedClientSessionStore clientSessions = sessionToImportInto.getEntity().getAuthenticatedClientSessions();
  clientSessions.put(clientSession.getClient().getId(), clientSessionId);
  SessionUpdateTask registerClientSessionTask = new RegisterClientSessionTask(clientSession.getClient().getId(), clientSessionId);
  userSessionUpdateTx.addTask(sessionToImportInto.getId(), registerClientSessionTask);
  return new AuthenticatedClientSessionAdapter(session,this, entity, clientSession.getClient(), sessionToImportInto, userSessionUpdateTx, clientSessionUpdateTx, offline);
}
org.keycloak.models.sessions.infinispanUserSessionAdaptergetEntity

Popular methods of UserSessionAdapter

  • <init>
  • getId
  • setLastSessionRefresh
  • update
  • getRealm
  • getUser
  • removeAuthenticatedClientSessions
  • removeNote

Popular in Java

  • Creating JSON documents from java classes using gson
  • getResourceAsStream (ClassLoader)
  • setScale (BigDecimal)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • ResultSet (java.sql)
    An interface for an object which represents a database table entry, returned as the result of the qu
  • Stack (java.util)
    Stack is a Last-In/First-Out(LIFO) data structure which represents a stack of objects. It enables u
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • JTable (javax.swing)
  • XPath (javax.xml.xpath)
    XPath provides access to the XPath evaluation environment and expressions. Evaluation of XPath Expr
  • DateTimeFormat (org.joda.time.format)
    Factory that creates instances of DateTimeFormatter from patterns and styles. Datetime formatting i
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now