[KEYCLOAK-5015] - Pushing keycloak context to exchange scope
This commit is contained in:
1 parent
c5b01ca9cb
commit
5456514499
4 files changed
+15
-9
No files matched your search
+5
@@ -90,6 +90,11 @@ class ElytronHttpFacade implements OIDCHttpFacade {
|
||||
|
||||
void authenticationComplete() {
|
||||
if (securityIdentity != null) {
|
||||
HttpScope requestScope = request.getScope(Scope.EXCHANGE);
|
||||
RefreshableKeycloakSecurityContext keycloakSecurityContext = account.getKeycloakSecurityContext();
|
||||
|
||||
requestScope.setAttachment(KeycloakSecurityContext.class.getName(), keycloakSecurityContext);
|
||||
|
||||
this.request.authenticationComplete(response -> {
|
||||
if (!restored) {
|
||||
responseConsumer.accept(response);
|
||||
|
||||
+1
-1
@@ -71,7 +71,7 @@ class KeycloakHttpServerAuthenticationMechanism implements HttpServerAuthenticat
|
||||
AdapterDeploymentContext deploymentContext = getDeploymentContext(request);
|
||||
|
||||
if (deploymentContext == null) {
|
||||
LOGGER.debugf("Ignoring request for path [%s] from mechanism [%s]. No deployment context found.", request.getRequestURI());
|
||||
LOGGER.debugf("Ignoring request for path [%s] from mechanism [%s]. No deployment context found.", request.getRequestURI(), getMechanismName());
|
||||
request.noAuthenticationInProgress();
|
||||
return;
|
||||
}
|
||||
|
||||
+8
-7
@@ -47,10 +47,8 @@ import org.wildfly.security.auth.callback.AnonymousAuthorizationCallback;
|
||||
import org.wildfly.security.auth.callback.AuthenticationCompleteCallback;
|
||||
import org.wildfly.security.auth.callback.SecurityIdentityCallback;
|
||||
import org.wildfly.security.auth.server.SecurityIdentity;
|
||||
import org.wildfly.security.http.HttpAuthenticationException;
|
||||
import org.wildfly.security.http.HttpScope;
|
||||
import org.wildfly.security.http.HttpServerCookie;
|
||||
import org.wildfly.security.http.HttpServerMechanismsResponder;
|
||||
import org.wildfly.security.http.HttpServerRequest;
|
||||
import org.wildfly.security.http.HttpServerResponse;
|
||||
import org.wildfly.security.http.Scope;
|
||||
@@ -87,11 +85,14 @@ class ElytronHttpFacade implements HttpFacade {
|
||||
|
||||
void authenticationComplete() {
|
||||
this.securityIdentity = SecurityIdentityUtil.authorize(this.callbackHandler, samlSession.getPrincipal());
|
||||
this.request.authenticationComplete(response -> {
|
||||
if (!restored) {
|
||||
responseConsumer.accept(response);
|
||||
}
|
||||
}, () -> ((ElytronTokeStore) sessionStore).logout(true));
|
||||
|
||||
if (this.securityIdentity != null) {
|
||||
this.request.authenticationComplete(response -> {
|
||||
if (!restored) {
|
||||
responseConsumer.accept(response);
|
||||
}
|
||||
}, () -> ((ElytronTokeStore) sessionStore).logout(true));
|
||||
}
|
||||
}
|
||||
|
||||
void authenticationCompleteAnonymous() {
|
||||
|
||||
+1
-1
@@ -65,7 +65,7 @@ class KeycloakHttpServerAuthenticationMechanism implements HttpServerAuthenticat
|
||||
SamlDeploymentContext deploymentContext = getDeploymentContext(request);
|
||||
|
||||
if (deploymentContext == null) {
|
||||
LOGGER.debugf("Ignoring request for path [%s] from mechanism [%s]. No deployment context found.", request.getRequestURI());
|
||||
LOGGER.debugf("Ignoring request for path [%s] from mechanism [%s]. No deployment context found.", request.getRequestURI(), getMechanismName());
|
||||
request.noAuthenticationInProgress();
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user