use of org.wildfly.security.http.HttpScope in project keycloak by keycloak.
the class ElytronSamlSessionStore method isLoggingIn.
@Override
public boolean isLoggingIn() {
HttpScope session = exchange.getScope(Scope.SESSION);
if (!session.exists())
return false;
CurrentAction action = (CurrentAction) session.getAttachment(CURRENT_ACTION);
return action == CurrentAction.LOGGING_IN;
}
use of org.wildfly.security.http.HttpScope in project keycloak by keycloak.
the class ElytronSamlSessionStore method logoutSessionIds.
protected void logoutSessionIds(List<String> sessionIds) {
sessionIds.forEach(id -> {
HttpScope scope = exchange.getScope(Scope.SESSION, id);
if (scope.exists()) {
log.debugf("Invalidating session %s", id);
scope.setAttachment(SamlSession.class.getName(), null);
scope.invalidate();
}
});
}
use of org.wildfly.security.http.HttpScope in project keycloak by keycloak.
the class ElytronSamlSessionStore method saveRequest.
@Override
public void saveRequest() {
exchange.suspendRequest();
HttpScope scope = exchange.getScope(Scope.SESSION);
if (!scope.exists()) {
scope.create();
}
scope.setAttachment(SAML_REDIRECT_URI, exchange.getRequest().getURI());
}
use of org.wildfly.security.http.HttpScope 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);
}
use of org.wildfly.security.http.HttpScope in project keycloak by keycloak.
the class ElytronSamlSessionStore method getRedirectUri.
@Override
public String getRedirectUri() {
HttpScope session = exchange.getScope(Scope.SESSION);
String redirect = (String) session.getAttachment(SAML_REDIRECT_URI);
if (redirect == null) {
URI uri = exchange.getURI();
String path = uri.getPath();
String relativePath = exchange.getRequest().getRelativePath();
String contextPath = path.substring(0, path.indexOf(relativePath));
if (!contextPath.isEmpty()) {
contextPath = contextPath + "/";
}
String baseUri = KeycloakUriBuilder.fromUri(path).replacePath(contextPath).build().toString();
return SamlUtil.getRedirectTo(exchange, contextPath, baseUri);
}
return redirect;
}
Aggregations