Codota Logo
OIDCFilterSessionStore
Code IndexAdd Codota to your IDE (free)

How to use
OIDCFilterSessionStore
in
org.keycloak.adapters.servlet

Best Java code snippets using org.keycloak.adapters.servlet.OIDCFilterSessionStore (Showing top 8 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
FileOutputStream f =
  • Codota IconFile file;new FileOutputStream(file)
  • Codota IconString name;new FileOutputStream(name)
  • Codota IconFile file;new FileOutputStream(file, true)
  • Smart code suggestions by Codota
}
origin: org.keycloak/keycloak-servlet-filter-adapter

public HttpServletRequestWrapper buildWrapper() {
  HttpSession session = request.getSession(false);
  KeycloakAccount account = null;
  if (session != null) {
    account = (KeycloakAccount) session.getAttribute(KeycloakAccount.class.getName());
    if (account == null) {
      account = (KeycloakAccount) request.getAttribute(KeycloakAccount.class.getName());
    }
  }
  if (account == null) {
    account = (KeycloakAccount) request.getAttribute(KeycloakAccount.class.getName());
  }
  return buildWrapper(session, account);
}
origin: org.keycloak/keycloak-servlet-filter-adapter

@Override
public void logout() {
  HttpSession httpSession = request.getSession(false);
  if (httpSession != null) {
    SerializableKeycloakAccount account = (SerializableKeycloakAccount) httpSession.getAttribute(KeycloakAccount.class.getName());
    if (account != null) {
      account.getKeycloakSecurityContext().logout(deployment);
    }
    cleanSession(httpSession);
  }
}
origin: org.keycloak/keycloak-servlet-filter-adapter

protected void cleanSession(HttpSession session) {
  session.removeAttribute(KeycloakAccount.class.getName());
  session.removeAttribute(KeycloakSecurityContext.class.getName());
  clearSavedRequest(session);
}
origin: org.keycloak/keycloak-servlet-filter-adapter

OIDCFilterSessionStore tokenStore = new OIDCFilterSessionStore(request, facade, 100000, deployment, idMapper);
tokenStore.checkCurrentToken();
    return;
  } else {
    HttpServletRequestWrapper wrapper = tokenStore.buildWrapper();
    chain.doFilter(wrapper, res);
    return;
origin: gitblit/fathom

OIDCFilterSessionStore tokenStore = new OIDCFilterSessionStore(request, facade, 100000, deployment, keycloakRealm.getSessionIdMapper());
tokenStore.checkCurrentToken();
origin: org.keycloak/keycloak-servlet-filter-adapter

@Override
public boolean isCached(RequestAuthenticator authenticator) {
  HttpSession httpSession = request.getSession(false);
  if (httpSession == null) return false;
  SerializableKeycloakAccount account = (SerializableKeycloakAccount) httpSession.getAttribute(KeycloakAccount.class.getName());
  if (account == null) {
    return false;
  }
  log.fine("remote logged in already. Establish state from session");
  RefreshableKeycloakSecurityContext securityContext = account.getKeycloakSecurityContext();
  if (!deployment.getRealm().equals(securityContext.getRealm())) {
    log.fine("Account from cookie is from a different realm than for the request.");
    cleanSession(httpSession);
    return false;
  }
  if (idMapper != null && !idMapper.hasSession(httpSession.getId())) {
    log.fine("idMapper does not have session: " + httpSession.getId());
    //System.err.println("idMapper does not have session: " + httpSession.getId());
    cleanSession(httpSession);
    return false;
  }
  securityContext.setCurrentRequestInfo(deployment, this);
  request.setAttribute(KeycloakSecurityContext.class.getName(), securityContext);
  needRequestRestore = restoreRequest();
  return true;
}
origin: org.keycloak/keycloak-servlet-filter-adapter

@Override
public void servletRequestLogout() {
  logout();
}
origin: org.keycloak/keycloak-servlet-filter-adapter

@Override
public void checkCurrentToken() {
  HttpSession httpSession = request.getSession(false);
  if (httpSession == null) return;
  SerializableKeycloakAccount account = (SerializableKeycloakAccount)httpSession.getAttribute(KeycloakAccount.class.getName());
  if (account == null) {
    return;
  }
  RefreshableKeycloakSecurityContext session = account.getKeycloakSecurityContext();
  if (session == null) return;
  // just in case session got serialized
  if (session.getDeployment() == null) session.setCurrentRequestInfo(deployment, this);
  if (session.isActive() && !session.getDeployment().isAlwaysRefreshToken()) return;
  // FYI: A refresh requires same scope, so same roles will be set.  Otherwise, refresh will fail and token will
  // not be updated
  boolean success = session.refreshExpiredToken(false);
  if (success && session.isActive()) return;
  // Refresh failed, so user is already logged out from keycloak. Cleanup and expire our session
  //log.fine("Cleanup and expire session " + httpSession.getId() + " after failed refresh");
  cleanSession(httpSession);
  httpSession.invalidate();
}
org.keycloak.adapters.servletOIDCFilterSessionStore

Most used methods

  • <init>
  • checkCurrentToken
  • buildWrapper
  • cleanSession
  • clearSavedRequest
  • logout
  • restoreRequest

Popular in Java

  • Start an intent from android
  • startActivity (Activity)
  • onCreateOptionsMenu (Activity)
  • onRequestPermissionsResult (Fragment)
  • Window (java.awt)
    A Window object is a top-level window with no borders and no menubar. The default layout for a windo
  • Charset (java.nio.charset)
    A charset is a named mapping between Unicode characters and byte sequences. Every Charset can decode
  • List (java.util)
    A List is a collection which maintains an ordering for its elements. Every element in the List has a
  • TimeUnit (java.util.concurrent)
    A TimeUnit represents time durations at a given unit of granularity and provides utility methods to
  • Modifier (javassist)
    The Modifier class provides static methods and constants to decode class and member access modifiers
  • JFileChooser (javax.swing)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now