Search in sources :

Example 6 with SamlSession

use of org.keycloak.adapters.saml.SamlSession in project keycloak by keycloak.

the class IdMapperUpdaterSessionListener method map.

private void map(String sessionId, Object value) {
    if (!(value instanceof SamlSession) || sessionId == null) {
        return;
    }
    SamlSession account = (SamlSession) value;
    idMapper.map(account.getSessionIndex(), account.getPrincipal().getSamlSubject(), sessionId);
}
Also used : SamlSession(org.keycloak.adapters.saml.SamlSession)

Example 7 with SamlSession

use of org.keycloak.adapters.saml.SamlSession in project keycloak by keycloak.

the class ElytronSamlSessionStore method logoutAccount.

@Override
public void logoutAccount() {
    HttpScope session = getSession(false);
    if (session.exists()) {
        log.debug("Logging out - current account");
        SamlSession samlSession = (SamlSession) session.getAttachment(SamlSession.class.getName());
        if (samlSession != null) {
            if (samlSession.getSessionIndex() != null) {
                idMapperUpdater.removeSession(idMapper, session.getID());
            }
            session.setAttachment(SamlSession.class.getName(), null);
        }
        session.setAttachment(SAML_REDIRECT_URI, null);
    }
}
Also used : HttpScope(org.wildfly.security.http.HttpScope) SamlSession(org.keycloak.adapters.saml.SamlSession)

Example 8 with SamlSession

use of org.keycloak.adapters.saml.SamlSession in project keycloak by keycloak.

the class ElytronSamlSessionStore method isLoggedIn.

@Override
public boolean isLoggedIn() {
    HttpScope session = getSession(false);
    if (!session.exists()) {
        log.debug("session was null, returning null");
        return false;
    }
    if (!idMapper.hasSession(session.getID()) && !idMapperUpdater.refreshMapping(idMapper, session.getID())) {
        log.debugf("Session %s has expired on some other node", session.getID());
        session.setAttachment(SamlSession.class.getName(), null);
        return false;
    }
    final SamlSession samlSession = SamlUtil.validateSamlSession(session.getAttachment(SamlSession.class.getName()), deployment);
    if (samlSession == null) {
        return false;
    }
    exchange.authenticationComplete(samlSession);
    restoreRequest();
    return true;
}
Also used : HttpScope(org.wildfly.security.http.HttpScope) SamlSession(org.keycloak.adapters.saml.SamlSession)

Example 9 with SamlSession

use of org.keycloak.adapters.saml.SamlSession in project keycloak by keycloak.

the class ElytronSamlSessionStore method saveAccount.

@Override
public void saveAccount(SamlSession account) {
    HttpScope session = getSession(true);
    session.setAttachment(SamlSession.class.getName(), account);
    String sessionId = changeSessionId(session);
    idMapperUpdater.map(idMapper, account.getSessionIndex(), account.getPrincipal().getSamlSubject(), sessionId);
}
Also used : HttpScope(org.wildfly.security.http.HttpScope) SamlSession(org.keycloak.adapters.saml.SamlSession)

Example 10 with SamlSession

use of org.keycloak.adapters.saml.SamlSession in project keycloak by keycloak.

the class IdMapperUpdaterSessionListener method map.

private void map(String sessionId, Object value) {
    if (!(value instanceof SamlSession) || sessionId == null) {
        return;
    }
    SamlSession account = (SamlSession) value;
    idMapper.map(account.getSessionIndex(), account.getPrincipal().getSamlSubject(), sessionId);
}
Also used : SamlSession(org.keycloak.adapters.saml.SamlSession)

Aggregations

SamlSession (org.keycloak.adapters.saml.SamlSession)22 HttpSession (javax.servlet.http.HttpSession)11 HttpScope (org.wildfly.security.http.HttpScope)3 XMLGregorianCalendar (javax.xml.datatype.XMLGregorianCalendar)2 SamlAuthenticator (org.keycloak.adapters.saml.SamlAuthenticator)2 SamlDeployment (org.keycloak.adapters.saml.SamlDeployment)2 SamlSessionStore (org.keycloak.adapters.saml.SamlSessionStore)2 SamlAuthenticationHandler (org.keycloak.adapters.saml.profile.SamlAuthenticationHandler)2 BrowserHandler (org.keycloak.adapters.saml.profile.webbrowsersso.BrowserHandler)2 SamlEndpoint (org.keycloak.adapters.saml.profile.webbrowsersso.SamlEndpoint)2 AuthChallenge (org.keycloak.adapters.spi.AuthChallenge)2 AuthOutcome (org.keycloak.adapters.spi.AuthOutcome)2 HttpFacade (org.keycloak.adapters.spi.HttpFacade)2 Account (io.undertow.security.idm.Account)1 ServletRequestContext (io.undertow.servlet.handlers.ServletRequestContext)1 IOException (java.io.IOException)1 URI (java.net.URI)1 InvalidKeyException (java.security.InvalidKeyException)1 KeyManagementException (java.security.KeyManagementException)1 SignatureException (java.security.SignatureException)1