[KEYCLOAK-5015] - Updating Elytron Adapters
This commit is contained in:
parent
8d3384666a
commit
d3e559453b
8 changed files with 30 additions and 14 deletions
|
@ -50,7 +50,9 @@ import java.net.InetSocketAddress;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.net.URLDecoder;
|
import java.net.URLDecoder;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -66,6 +68,7 @@ class ElytronHttpFacade implements OIDCHttpFacade {
|
||||||
private ElytronAccount account;
|
private ElytronAccount account;
|
||||||
private SecurityIdentity securityIdentity;
|
private SecurityIdentity securityIdentity;
|
||||||
private boolean restored;
|
private boolean restored;
|
||||||
|
private final Map<String, String> headers = new HashMap<>();
|
||||||
|
|
||||||
public ElytronHttpFacade(HttpServerRequest request, AdapterDeploymentContext deploymentContext, CallbackHandler handler) {
|
public ElytronHttpFacade(HttpServerRequest request, AdapterDeploymentContext deploymentContext, CallbackHandler handler) {
|
||||||
this.request = request;
|
this.request = request;
|
||||||
|
@ -261,6 +264,7 @@ class ElytronHttpFacade implements OIDCHttpFacade {
|
||||||
@Override
|
@Override
|
||||||
public Response getResponse() {
|
public Response getResponse() {
|
||||||
return new Response() {
|
return new Response() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setStatus(final int status) {
|
public void setStatus(final int status) {
|
||||||
responseConsumer = responseConsumer.andThen(response -> response.setStatusCode(status));
|
responseConsumer = responseConsumer.andThen(response -> response.setStatusCode(status));
|
||||||
|
@ -268,7 +272,17 @@ class ElytronHttpFacade implements OIDCHttpFacade {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addHeader(final String name, final String value) {
|
public void addHeader(final String name, final String value) {
|
||||||
responseConsumer = responseConsumer.andThen(response -> response.addResponseHeader(name, value));
|
headers.put(name, value);
|
||||||
|
responseConsumer = responseConsumer.andThen(new Consumer<HttpServerResponse>() {
|
||||||
|
@Override
|
||||||
|
public void accept(HttpServerResponse response) {
|
||||||
|
String latestValue = headers.get(name);
|
||||||
|
|
||||||
|
if (latestValue.equals(value)) {
|
||||||
|
response.addResponseHeader(name, latestValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
package org.keycloak.adapters.elytron;
|
package org.keycloak.adapters.elytron;
|
||||||
|
|
||||||
import java.security.Principal;
|
import java.security.Principal;
|
||||||
|
import java.security.spec.AlgorithmParameterSpec;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.keycloak.KeycloakPrincipal;
|
import org.keycloak.KeycloakPrincipal;
|
||||||
|
@ -54,7 +55,7 @@ public class KeycloakSecurityRealm implements SecurityRealm {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SupportLevel getCredentialAcquireSupport(Class<? extends Credential> credentialType, String algorithmName) throws RealmUnavailableException {
|
public SupportLevel getCredentialAcquireSupport(Class<? extends Credential> credentialType, String algorithmName, AlgorithmParameterSpec parameterSpec) throws RealmUnavailableException {
|
||||||
return SupportLevel.UNSUPPORTED;
|
return SupportLevel.UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,7 +93,7 @@ public class KeycloakSecurityRealm implements SecurityRealm {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SupportLevel getCredentialAcquireSupport(Class<? extends Credential> credentialType, String algorithmName) throws RealmUnavailableException {
|
public SupportLevel getCredentialAcquireSupport(Class<? extends Credential> credentialType, String algorithmName, AlgorithmParameterSpec parameterSpec) throws RealmUnavailableException {
|
||||||
return SupportLevel.UNSUPPORTED;
|
return SupportLevel.UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
package org.keycloak.adapters.saml.elytron;
|
package org.keycloak.adapters.saml.elytron;
|
||||||
|
|
||||||
import java.security.Principal;
|
import java.security.Principal;
|
||||||
|
import java.security.spec.AlgorithmParameterSpec;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -53,7 +54,7 @@ public class KeycloakSecurityRealm implements SecurityRealm {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SupportLevel getCredentialAcquireSupport(Class<? extends Credential> credentialType, String algorithmName) throws RealmUnavailableException {
|
public SupportLevel getCredentialAcquireSupport(Class<? extends Credential> aClass, String s, AlgorithmParameterSpec algorithmParameterSpec) throws RealmUnavailableException {
|
||||||
return SupportLevel.UNSUPPORTED;
|
return SupportLevel.UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,7 +91,7 @@ public class KeycloakSecurityRealm implements SecurityRealm {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SupportLevel getCredentialAcquireSupport(Class<? extends Credential> credentialType, String algorithmName) throws RealmUnavailableException {
|
public SupportLevel getCredentialAcquireSupport(Class<? extends Credential> credentialType, String algorithmName, AlgorithmParameterSpec parameterSpec) throws RealmUnavailableException {
|
||||||
return SupportLevel.UNSUPPORTED;
|
return SupportLevel.UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,10 +36,10 @@ else
|
||||||
end-if
|
end-if
|
||||||
|
|
||||||
if (outcome != success) of /subsystem=elytron/aggregate-http-server-mechanism-factory=keycloak-http-server-mechanism-factory:read-resource
|
if (outcome != success) of /subsystem=elytron/aggregate-http-server-mechanism-factory=keycloak-http-server-mechanism-factory:read-resource
|
||||||
/subsystem=elytron/aggregate-http-server-mechanism-factory=keycloak-http-server-mechanism-factory:add(http-server-factories=[keycloak-oidc-http-server-mechanism-factory, global])
|
/subsystem=elytron/aggregate-http-server-mechanism-factory=keycloak-http-server-mechanism-factory:add(http-server-mechanism-factories=[keycloak-oidc-http-server-mechanism-factory, global])
|
||||||
else
|
else
|
||||||
echo Keycloak HTTP Mechanism Factory already installed. Trying to install Keycloak OpenID Connect HTTP Mechanism Factory.
|
echo Keycloak HTTP Mechanism Factory already installed. Trying to install Keycloak OpenID Connect HTTP Mechanism Factory.
|
||||||
/subsystem=elytron/aggregate-http-server-mechanism-factory=keycloak-http-server-mechanism-factory:list-add(name=http-server-factories, value=keycloak-oidc-http-server-mechanism-factory)
|
/subsystem=elytron/aggregate-http-server-mechanism-factory=keycloak-http-server-mechanism-factory:list-add(name=http-server-mechanism-factories, value=keycloak-oidc-http-server-mechanism-factory)
|
||||||
end-if
|
end-if
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -38,10 +38,10 @@ else
|
||||||
end-if
|
end-if
|
||||||
|
|
||||||
if (outcome != success) of /subsystem=elytron/aggregate-http-server-mechanism-factory=keycloak-http-server-mechanism-factory:read-resource
|
if (outcome != success) of /subsystem=elytron/aggregate-http-server-mechanism-factory=keycloak-http-server-mechanism-factory:read-resource
|
||||||
/subsystem=elytron/aggregate-http-server-mechanism-factory=keycloak-http-server-mechanism-factory:add(http-server-factories=[keycloak-oidc-http-server-mechanism-factory, global])
|
/subsystem=elytron/aggregate-http-server-mechanism-factory=keycloak-http-server-mechanism-factory:add(http-server-mechanism-factories=[keycloak-oidc-http-server-mechanism-factory, global])
|
||||||
else
|
else
|
||||||
echo Keycloak HTTP Mechanism Factory already installed. Trying to install Keycloak OpenID Connect HTTP Mechanism Factory.
|
echo Keycloak HTTP Mechanism Factory already installed. Trying to install Keycloak OpenID Connect HTTP Mechanism Factory.
|
||||||
/subsystem=elytron/aggregate-http-server-mechanism-factory=keycloak-http-server-mechanism-factory:list-add(name=http-server-factories, value=keycloak-oidc-http-server-mechanism-factory)
|
/subsystem=elytron/aggregate-http-server-mechanism-factory=keycloak-http-server-mechanism-factory:list-add(name=http-server-mechanism-factories, value=keycloak-oidc-http-server-mechanism-factory)
|
||||||
end-if
|
end-if
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -36,10 +36,10 @@ else
|
||||||
end-if
|
end-if
|
||||||
|
|
||||||
if (outcome != success) of /subsystem=elytron/aggregate-http-server-mechanism-factory=keycloak-http-server-mechanism-factory:read-resource
|
if (outcome != success) of /subsystem=elytron/aggregate-http-server-mechanism-factory=keycloak-http-server-mechanism-factory:read-resource
|
||||||
/subsystem=elytron/aggregate-http-server-mechanism-factory=keycloak-http-server-mechanism-factory:add(http-server-factories=[keycloak-saml-http-server-mechanism-factory, global])
|
/subsystem=elytron/aggregate-http-server-mechanism-factory=keycloak-http-server-mechanism-factory:add(http-server-mechanism-factories=[keycloak-saml-http-server-mechanism-factory, global])
|
||||||
else
|
else
|
||||||
echo Keycloak HTTP Mechanism Factory already installed. Trying to install Keycloak SAML HTTP Mechanism Factory.
|
echo Keycloak HTTP Mechanism Factory already installed. Trying to install Keycloak SAML HTTP Mechanism Factory.
|
||||||
/subsystem=elytron/aggregate-http-server-mechanism-factory=keycloak-http-server-mechanism-factory:list-add(name=http-server-factories, value=keycloak-saml-http-server-mechanism-factory)
|
/subsystem=elytron/aggregate-http-server-mechanism-factory=keycloak-http-server-mechanism-factory:list-add(name=http-server-mechanism-factories, value=keycloak-saml-http-server-mechanism-factory)
|
||||||
end-if
|
end-if
|
||||||
|
|
||||||
if (outcome != success) of /subsystem=elytron/http-authentication-factory=keycloak-http-authentication:read-resource
|
if (outcome != success) of /subsystem=elytron/http-authentication-factory=keycloak-http-authentication:read-resource
|
||||||
|
|
4
pom.xml
4
pom.xml
|
@ -49,8 +49,8 @@
|
||||||
<eap.build-tools.version>1.2.2.Final</eap.build-tools.version>
|
<eap.build-tools.version>1.2.2.Final</eap.build-tools.version>
|
||||||
<wildfly.core.version>3.0.0.Beta30</wildfly.core.version>
|
<wildfly.core.version>3.0.0.Beta30</wildfly.core.version>
|
||||||
|
|
||||||
<version.org.wildfly.security.wildfly-elytron>1.1.0.Beta32</version.org.wildfly.security.wildfly-elytron>
|
<version.org.wildfly.security.wildfly-elytron>1.1.0.CR4</version.org.wildfly.security.wildfly-elytron>
|
||||||
<version.org.wildfly.security.elytron-web.undertow-server>1.0.0.Beta14</version.org.wildfly.security.elytron-web.undertow-server>
|
<version.org.wildfly.security.elytron-web.undertow-server>1.0.0.CR1</version.org.wildfly.security.elytron-web.undertow-server>
|
||||||
|
|
||||||
<aesh.version>0.66.15</aesh.version>
|
<aesh.version>0.66.15</aesh.version>
|
||||||
<apache.httpcomponents.version>4.5</apache.httpcomponents.version>
|
<apache.httpcomponents.version>4.5</apache.httpcomponents.version>
|
||||||
|
|
|
@ -45,7 +45,7 @@
|
||||||
<selenium.version>2.53.0</selenium.version>
|
<selenium.version>2.53.0</selenium.version>
|
||||||
<arquillian-drone.version>2.0.1.Final</arquillian-drone.version>
|
<arquillian-drone.version>2.0.1.Final</arquillian-drone.version>
|
||||||
<arquillian-graphene.version>2.1.0.Alpha3</arquillian-graphene.version>
|
<arquillian-graphene.version>2.1.0.Alpha3</arquillian-graphene.version>
|
||||||
<arquillian-wildfly-container.version>2.1.0.Alpha2</arquillian-wildfly-container.version>
|
<arquillian-wildfly-container.version>2.1.0.Beta1</arquillian-wildfly-container.version>
|
||||||
<arquillian-wls-container.version>1.0.1.Final</arquillian-wls-container.version>
|
<arquillian-wls-container.version>1.0.1.Final</arquillian-wls-container.version>
|
||||||
<arquillian-infinispan-container.version>1.2.0.Beta2</arquillian-infinispan-container.version>
|
<arquillian-infinispan-container.version>1.2.0.Beta2</arquillian-infinispan-container.version>
|
||||||
<version.shrinkwrap.resolvers>2.2.2</version.shrinkwrap.resolvers>
|
<version.shrinkwrap.resolvers>2.2.2</version.shrinkwrap.resolvers>
|
||||||
|
|
Loading…
Reference in a new issue