Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
09af45201b
200 changed files with 3039 additions and 1213 deletions
10
.travis.yml
10
.travis.yml
|
@ -3,14 +3,8 @@ language: java
|
|||
jdk:
|
||||
- oraclejdk8
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/.m2
|
||||
|
||||
before_cache:
|
||||
- rm -rf $HOME/.m2/repository/org/keycloak
|
||||
|
||||
install: mvn install -Pdistribution -DskipTests=true -B -V
|
||||
install:
|
||||
- travis_wait mvn install -Pdistribution -DskipTests=true -B -V -q
|
||||
|
||||
script:
|
||||
- mvn test -B
|
||||
|
|
|
@ -5,6 +5,7 @@ import org.apache.http.HttpRequest;
|
|||
import org.keycloak.common.util.Base64;
|
||||
import org.keycloak.representations.idm.ClientInitialAccessPresentation;
|
||||
import org.keycloak.representations.idm.ClientRepresentation;
|
||||
import org.keycloak.representations.oidc.OIDCClientRepresentation;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:sthorger@redhat.com">Stian Thorgersen</a>
|
||||
|
@ -21,11 +22,14 @@ public abstract class Auth {
|
|||
return new BearerTokenAuth(initialAccess.getToken());
|
||||
}
|
||||
|
||||
|
||||
public static Auth token(ClientRepresentation client) {
|
||||
return new BearerTokenAuth(client.getRegistrationAccessToken());
|
||||
}
|
||||
|
||||
public static Auth token(OIDCClientRepresentation client) {
|
||||
return new BearerTokenAuth(client.getRegistrationAccessToken());
|
||||
}
|
||||
|
||||
public static Auth client(String clientId, String clientSecret) {
|
||||
return new BasicAuth(clientId, clientSecret);
|
||||
}
|
||||
|
|
|
@ -3,8 +3,10 @@ package org.keycloak.client.registration;
|
|||
import org.apache.http.client.HttpClient;
|
||||
import org.apache.http.impl.client.HttpClients;
|
||||
import org.codehaus.jackson.map.ObjectMapper;
|
||||
import org.codehaus.jackson.map.annotate.JsonSerialize;
|
||||
import org.keycloak.representations.adapters.config.AdapterConfig;
|
||||
import org.keycloak.representations.idm.ClientRepresentation;
|
||||
import org.keycloak.representations.oidc.OIDCClientRepresentation;
|
||||
import org.keycloak.util.JsonSerialization;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -18,10 +20,17 @@ public class ClientRegistration {
|
|||
public static final ObjectMapper outputMapper = new ObjectMapper();
|
||||
static {
|
||||
outputMapper.getSerializationConfig().addMixInAnnotations(ClientRepresentation.class, ClientRepresentationMixIn.class);
|
||||
outputMapper.getSerializationConfig().addMixInAnnotations(OIDCClientRepresentation.class, OIDCClientRepresentationMixIn.class);
|
||||
outputMapper.setSerializationInclusion(JsonSerialize.Inclusion.NON_NULL);
|
||||
}
|
||||
|
||||
private final String JSON = "application/json";
|
||||
private final String XML = "application/xml";
|
||||
|
||||
private final String DEFAULT = "default";
|
||||
private final String INSTALLATION = "install";
|
||||
private final String OIDC = "openid-connect";
|
||||
private final String SAML = "saml2-entity-descriptor";
|
||||
|
||||
private HttpUtil httpUtil;
|
||||
|
||||
|
@ -47,23 +56,23 @@ public class ClientRegistration {
|
|||
|
||||
public ClientRepresentation create(ClientRepresentation client) throws ClientRegistrationException {
|
||||
String content = serialize(client);
|
||||
InputStream resultStream = httpUtil.doPost(content, DEFAULT);
|
||||
InputStream resultStream = httpUtil.doPost(content, JSON, JSON, DEFAULT);
|
||||
return deserialize(resultStream, ClientRepresentation.class);
|
||||
}
|
||||
|
||||
public ClientRepresentation get(String clientId) throws ClientRegistrationException {
|
||||
InputStream resultStream = httpUtil.doGet(DEFAULT, clientId);
|
||||
InputStream resultStream = httpUtil.doGet(JSON, DEFAULT, clientId);
|
||||
return resultStream != null ? deserialize(resultStream, ClientRepresentation.class) : null;
|
||||
}
|
||||
|
||||
public AdapterConfig getAdapterConfig(String clientId) throws ClientRegistrationException {
|
||||
InputStream resultStream = httpUtil.doGet(INSTALLATION, clientId);
|
||||
InputStream resultStream = httpUtil.doGet(JSON, INSTALLATION, clientId);
|
||||
return resultStream != null ? deserialize(resultStream, AdapterConfig.class) : null;
|
||||
}
|
||||
|
||||
public ClientRepresentation update(ClientRepresentation client) throws ClientRegistrationException {
|
||||
String content = serialize(client);
|
||||
InputStream resultStream = httpUtil.doPut(content, DEFAULT, client.getClientId());
|
||||
InputStream resultStream = httpUtil.doPut(content, JSON, JSON, DEFAULT, client.getClientId());
|
||||
return resultStream != null ? deserialize(resultStream, ClientRepresentation.class) : null;
|
||||
}
|
||||
|
||||
|
@ -75,10 +84,17 @@ public class ClientRegistration {
|
|||
httpUtil.doDelete(DEFAULT, clientId);
|
||||
}
|
||||
|
||||
public static String serialize(ClientRepresentation client) throws ClientRegistrationException {
|
||||
try {
|
||||
public OIDCClientRegistration oidc() {
|
||||
return new OIDCClientRegistration();
|
||||
}
|
||||
|
||||
return outputMapper.writeValueAsString(client);
|
||||
public SAMLClientRegistration saml() {
|
||||
return new SAMLClientRegistration();
|
||||
}
|
||||
|
||||
public static String serialize(Object obj) throws ClientRegistrationException {
|
||||
try {
|
||||
return outputMapper.writeValueAsString(obj);
|
||||
} catch (IOException e) {
|
||||
throw new ClientRegistrationException("Failed to write json object", e);
|
||||
}
|
||||
|
@ -92,6 +108,44 @@ public class ClientRegistration {
|
|||
}
|
||||
}
|
||||
|
||||
public class OIDCClientRegistration {
|
||||
|
||||
public OIDCClientRepresentation create(OIDCClientRepresentation client) throws ClientRegistrationException {
|
||||
String content = serialize(client);
|
||||
InputStream resultStream = httpUtil.doPost(content, JSON, JSON, OIDC);
|
||||
return deserialize(resultStream, OIDCClientRepresentation.class);
|
||||
}
|
||||
|
||||
public OIDCClientRepresentation get(String clientId) throws ClientRegistrationException {
|
||||
InputStream resultStream = httpUtil.doGet(JSON, OIDC, clientId);
|
||||
return resultStream != null ? deserialize(resultStream, OIDCClientRepresentation.class) : null;
|
||||
}
|
||||
|
||||
public OIDCClientRepresentation update(OIDCClientRepresentation client) throws ClientRegistrationException {
|
||||
String content = serialize(client);
|
||||
InputStream resultStream = httpUtil.doPut(content, JSON, JSON, OIDC, client.getClientId());
|
||||
return resultStream != null ? deserialize(resultStream, OIDCClientRepresentation.class) : null;
|
||||
}
|
||||
|
||||
public void delete(OIDCClientRepresentation client) throws ClientRegistrationException {
|
||||
delete(client.getClientId());
|
||||
}
|
||||
|
||||
public void delete(String clientId) throws ClientRegistrationException {
|
||||
httpUtil.doDelete(OIDC, clientId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class SAMLClientRegistration {
|
||||
|
||||
public ClientRepresentation create(String entityDescriptor) throws ClientRegistrationException {
|
||||
InputStream resultStream = httpUtil.doPost(entityDescriptor, XML, JSON, SAML);
|
||||
return deserialize(resultStream, ClientRepresentation.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class ClientRegistrationBuilder {
|
||||
|
||||
private String url;
|
||||
|
|
|
@ -33,12 +33,12 @@ class HttpUtil {
|
|||
this.auth = auth;
|
||||
}
|
||||
|
||||
InputStream doPost(String content, String... path) throws ClientRegistrationException {
|
||||
InputStream doPost(String content, String contentType, String acceptType, String... path) throws ClientRegistrationException {
|
||||
try {
|
||||
HttpPost request = new HttpPost(getUrl(baseUri, path));
|
||||
|
||||
request.setHeader(HttpHeaders.CONTENT_TYPE, "application/json");
|
||||
request.setHeader(HttpHeaders.ACCEPT, "application/json");
|
||||
request.setHeader(HttpHeaders.CONTENT_TYPE, contentType);
|
||||
request.setHeader(HttpHeaders.ACCEPT, acceptType);
|
||||
request.setEntity(new StringEntity(content));
|
||||
|
||||
addAuth(request);
|
||||
|
@ -60,11 +60,11 @@ class HttpUtil {
|
|||
}
|
||||
}
|
||||
|
||||
InputStream doGet(String... path) throws ClientRegistrationException {
|
||||
InputStream doGet(String acceptType, String... path) throws ClientRegistrationException {
|
||||
try {
|
||||
HttpGet request = new HttpGet(getUrl(baseUri, path));
|
||||
|
||||
request.setHeader(HttpHeaders.ACCEPT, "application/json");
|
||||
request.setHeader(HttpHeaders.ACCEPT, acceptType);
|
||||
|
||||
addAuth(request);
|
||||
|
||||
|
@ -90,12 +90,12 @@ class HttpUtil {
|
|||
}
|
||||
}
|
||||
|
||||
InputStream doPut(String content, String... path) throws ClientRegistrationException {
|
||||
InputStream doPut(String content, String contentType, String acceptType, String... path) throws ClientRegistrationException {
|
||||
try {
|
||||
HttpPut request = new HttpPut(getUrl(baseUri, path));
|
||||
|
||||
request.setHeader(HttpHeaders.CONTENT_TYPE, "application/json");
|
||||
request.setHeader(HttpHeaders.ACCEPT, "application/json");
|
||||
request.setHeader(HttpHeaders.CONTENT_TYPE, contentType);
|
||||
request.setHeader(HttpHeaders.ACCEPT, acceptType);
|
||||
request.setEntity(new StringEntity(content));
|
||||
|
||||
addAuth(request);
|
||||
|
@ -134,7 +134,7 @@ class HttpUtil {
|
|||
response.getEntity().getContent().close();
|
||||
}
|
||||
|
||||
if (response.getStatusLine().getStatusCode() != 200) {
|
||||
if (response.getStatusLine().getStatusCode() != 204) {
|
||||
throw new HttpErrorException(response.getStatusLine());
|
||||
}
|
||||
} catch (IOException e) {
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
package org.keycloak.client.registration;
|
||||
|
||||
import org.codehaus.jackson.annotate.JsonIgnore;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:sthorger@redhat.com">Stian Thorgersen</a>
|
||||
*/
|
||||
abstract class OIDCClientRepresentationMixIn {
|
||||
|
||||
@JsonIgnore
|
||||
private Integer client_id_issued_at;
|
||||
|
||||
@JsonIgnore
|
||||
private Integer client_secret_expires_at;
|
||||
|
||||
@JsonIgnore
|
||||
private String registration_client_uri;
|
||||
|
||||
@JsonIgnore
|
||||
private String registration_access_token;
|
||||
|
||||
}
|
|
@ -57,11 +57,15 @@ public class ClientRegistrationCLI {
|
|||
.create();
|
||||
|
||||
aeshConsole.start();
|
||||
|
||||
|
||||
/*
|
||||
if (args.length > 0) {
|
||||
CommandContainer command = registry.getCommand(args[0], null);
|
||||
ParserGenerator.parseAndPopulate(command, args[0], Arrays.copyOfRange(args, 1, args.length));
|
||||
}*/
|
||||
|
||||
//commandInvocation.getCommandRegistry().getAllCommandNames()
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -73,5 +73,7 @@
|
|||
<column name="REGISTRATION_TOKEN" type="VARCHAR(255)"/>
|
||||
</addColumn>
|
||||
|
||||
<modifyDataType tableName="REALM" columnName="PASSWORD_POLICY" newDataType="VARCHAR(2550)"/>
|
||||
|
||||
</changeSet>
|
||||
</databaseChangeLog>
|
|
@ -29,7 +29,7 @@ public class CredentialRepresentation {
|
|||
private Integer period;
|
||||
|
||||
// only used when updating a credential. Might set required action
|
||||
protected boolean temporary;
|
||||
protected Boolean temporary;
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
|
@ -79,11 +79,11 @@ public class CredentialRepresentation {
|
|||
this.hashIterations = hashIterations;
|
||||
}
|
||||
|
||||
public boolean isTemporary() {
|
||||
public Boolean isTemporary() {
|
||||
return temporary;
|
||||
}
|
||||
|
||||
public void setTemporary(boolean temporary) {
|
||||
public void setTemporary(Boolean temporary) {
|
||||
this.temporary = temporary;
|
||||
}
|
||||
|
||||
|
|
|
@ -84,7 +84,6 @@ public class RealmRepresentation {
|
|||
private List<IdentityProviderRepresentation> identityProviders;
|
||||
private List<IdentityProviderMapperRepresentation> identityProviderMappers;
|
||||
private List<ProtocolMapperRepresentation> protocolMappers;
|
||||
private Boolean identityFederationEnabled;
|
||||
protected Boolean internationalizationEnabled;
|
||||
protected Set<String> supportedLocales;
|
||||
protected String defaultLocale;
|
||||
|
@ -613,10 +612,6 @@ public class RealmRepresentation {
|
|||
identityProviders.add(identityProviderRepresentation);
|
||||
}
|
||||
|
||||
public boolean isIdentityFederationEnabled() {
|
||||
return identityProviders != null && !identityProviders.isEmpty();
|
||||
}
|
||||
|
||||
public List<ProtocolMapperRepresentation> getProtocolMappers() {
|
||||
return protocolMappers;
|
||||
}
|
||||
|
|
|
@ -17,9 +17,9 @@ public class UserRepresentation {
|
|||
protected String id;
|
||||
protected Long createdTimestamp;
|
||||
protected String username;
|
||||
protected boolean enabled;
|
||||
protected boolean totp;
|
||||
protected boolean emailVerified;
|
||||
protected Boolean enabled;
|
||||
protected Boolean totp;
|
||||
protected Boolean emailVerified;
|
||||
protected String firstName;
|
||||
protected String lastName;
|
||||
protected String email;
|
||||
|
@ -98,27 +98,27 @@ public class UserRepresentation {
|
|||
this.username = username;
|
||||
}
|
||||
|
||||
public boolean isEnabled() {
|
||||
public Boolean isEnabled() {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
public void setEnabled(boolean enabled) {
|
||||
public void setEnabled(Boolean enabled) {
|
||||
this.enabled = enabled;
|
||||
}
|
||||
|
||||
public boolean isTotp() {
|
||||
public Boolean isTotp() {
|
||||
return totp;
|
||||
}
|
||||
|
||||
public void setTotp(boolean totp) {
|
||||
public void setTotp(Boolean totp) {
|
||||
this.totp = totp;
|
||||
}
|
||||
|
||||
public boolean isEmailVerified() {
|
||||
public Boolean isEmailVerified() {
|
||||
return emailVerified;
|
||||
}
|
||||
|
||||
public void setEmailVerified(boolean emailVerified) {
|
||||
public void setEmailVerified(Boolean emailVerified) {
|
||||
this.emailVerified = emailVerified;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,223 @@
|
|||
package org.keycloak.representations.oidc;
|
||||
|
||||
import org.codehaus.jackson.annotate.JsonAutoDetect;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:sthorger@redhat.com">Stian Thorgersen</a>
|
||||
*/
|
||||
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY, getterVisibility = JsonAutoDetect.Visibility.NONE, setterVisibility = JsonAutoDetect.Visibility.NONE)
|
||||
public class OIDCClientRepresentation {
|
||||
|
||||
private List<String> redirect_uris;
|
||||
|
||||
private String token_endpoint_auth_method;
|
||||
|
||||
private String grant_types;
|
||||
|
||||
private String response_types;
|
||||
|
||||
private String client_id;
|
||||
|
||||
private String client_secret;
|
||||
|
||||
private String client_name;
|
||||
|
||||
private String client_uri;
|
||||
|
||||
private String logo_uri;
|
||||
|
||||
private String scope;
|
||||
|
||||
private String contacts;
|
||||
|
||||
private String tos_uri;
|
||||
|
||||
private String policy_uri;
|
||||
|
||||
private String jwks_uri;
|
||||
|
||||
private String jwks;
|
||||
|
||||
private String software_id;
|
||||
|
||||
private String software_version;
|
||||
|
||||
private Integer client_id_issued_at;
|
||||
|
||||
private Integer client_secret_expires_at;
|
||||
|
||||
private String registration_client_uri;
|
||||
|
||||
private String registration_access_token;
|
||||
|
||||
public List<String> getRedirectUris() {
|
||||
return redirect_uris;
|
||||
}
|
||||
|
||||
public void setRedirectUris(List<String> redirectUris) {
|
||||
this.redirect_uris = redirectUris;
|
||||
}
|
||||
|
||||
public String getTokenEndpointAuthMethod() {
|
||||
return token_endpoint_auth_method;
|
||||
}
|
||||
|
||||
public void setTokenEndpointAuthMethod(String token_endpoint_auth_method) {
|
||||
this.token_endpoint_auth_method = token_endpoint_auth_method;
|
||||
}
|
||||
|
||||
public String getGrantTypes() {
|
||||
return grant_types;
|
||||
}
|
||||
|
||||
public void setGrantTypes(String grantTypes) {
|
||||
this.grant_types = grantTypes;
|
||||
}
|
||||
|
||||
public String getResponseTypes() {
|
||||
return response_types;
|
||||
}
|
||||
|
||||
public void setResponseTypes(String responseTypes) {
|
||||
this.response_types = responseTypes;
|
||||
}
|
||||
|
||||
public String getClientId() {
|
||||
return client_id;
|
||||
}
|
||||
|
||||
public void setClientId(String clientId) {
|
||||
this.client_id = clientId;
|
||||
}
|
||||
|
||||
public String getClientSecret() {
|
||||
return client_secret;
|
||||
}
|
||||
|
||||
public void setClientSecret(String clientSecret) {
|
||||
this.client_secret = clientSecret;
|
||||
}
|
||||
|
||||
public String getClientName() {
|
||||
return client_name;
|
||||
}
|
||||
|
||||
public void setClientName(String client_name) {
|
||||
this.client_name = client_name;
|
||||
}
|
||||
|
||||
public String getClientUri() {
|
||||
return client_uri;
|
||||
}
|
||||
|
||||
public void setClientUri(String client_uri) {
|
||||
this.client_uri = client_uri;
|
||||
}
|
||||
|
||||
public String getLogoUri() {
|
||||
return logo_uri;
|
||||
}
|
||||
|
||||
public void setLogoUri(String logo_uri) {
|
||||
this.logo_uri = logo_uri;
|
||||
}
|
||||
|
||||
public String getScope() {
|
||||
return scope;
|
||||
}
|
||||
|
||||
public void setScope(String scope) {
|
||||
this.scope = scope;
|
||||
}
|
||||
|
||||
public String getContacts() {
|
||||
return contacts;
|
||||
}
|
||||
|
||||
public void setContacts(String contacts) {
|
||||
this.contacts = contacts;
|
||||
}
|
||||
|
||||
public String getTosUri() {
|
||||
return tos_uri;
|
||||
}
|
||||
|
||||
public void setTosUri(String tos_uri) {
|
||||
this.tos_uri = tos_uri;
|
||||
}
|
||||
|
||||
public String getPolicyUri() {
|
||||
return policy_uri;
|
||||
}
|
||||
|
||||
public void setPolicyUri(String policy_uri) {
|
||||
this.policy_uri = policy_uri;
|
||||
}
|
||||
|
||||
public String getJwksUri() {
|
||||
return jwks_uri;
|
||||
}
|
||||
|
||||
public void setJwksUri(String jwks_uri) {
|
||||
this.jwks_uri = jwks_uri;
|
||||
}
|
||||
|
||||
public String getJwks() {
|
||||
return jwks;
|
||||
}
|
||||
|
||||
public void setJwks(String jwks) {
|
||||
this.jwks = jwks;
|
||||
}
|
||||
|
||||
public String getSoftwareId() {
|
||||
return software_id;
|
||||
}
|
||||
|
||||
public void setSoftwareId(String softwareId) {
|
||||
this.software_id = softwareId;
|
||||
}
|
||||
|
||||
public String getSoftwareVersion() {
|
||||
return software_version;
|
||||
}
|
||||
|
||||
public void setSoftwareVersion(String softwareVersion) {
|
||||
this.software_version = softwareVersion;
|
||||
}
|
||||
|
||||
public Integer getClientIdIssuedAt() {
|
||||
return client_id_issued_at;
|
||||
}
|
||||
|
||||
public void setClientIdIssuedAt(Integer clientIdIssuedAt) {
|
||||
this.client_id_issued_at = clientIdIssuedAt;
|
||||
}
|
||||
|
||||
public Integer getClientSecretExpiresAt() {
|
||||
return client_secret_expires_at;
|
||||
}
|
||||
|
||||
public void setClientSecretExpiresAt(Integer client_secret_expires_at) {
|
||||
this.client_secret_expires_at = client_secret_expires_at;
|
||||
}
|
||||
|
||||
public String getRegistrationClientUri() {
|
||||
return registration_client_uri;
|
||||
}
|
||||
|
||||
public void setRegistrationClientUri(String registrationClientUri) {
|
||||
this.registration_client_uri = registrationClientUri;
|
||||
}
|
||||
|
||||
public String getRegistrationAccessToken() {
|
||||
return registration_access_token;
|
||||
}
|
||||
|
||||
public void setRegistrationAccessToken(String registrationAccessToken) {
|
||||
this.registration_access_token = registrationAccessToken;
|
||||
}
|
||||
|
||||
}
|
|
@ -3,6 +3,7 @@ package org.keycloak.util;
|
|||
import org.codehaus.jackson.map.ObjectMapper;
|
||||
import org.codehaus.jackson.map.SerializationConfig;
|
||||
import org.codehaus.jackson.map.annotate.JsonSerialize;
|
||||
import org.codehaus.jackson.type.TypeReference;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
@ -27,7 +28,10 @@ public class JsonSerialization {
|
|||
|
||||
public static void writeValueToStream(OutputStream os, Object obj) throws IOException {
|
||||
mapper.writeValue(os, obj);
|
||||
}
|
||||
|
||||
public static void writeValuePrettyToStream(OutputStream os, Object obj) throws IOException {
|
||||
prettyMapper.writeValue(os, obj);
|
||||
}
|
||||
|
||||
public static String writeValueAsPrettyString(Object obj) throws IOException {
|
||||
|
@ -53,6 +57,10 @@ public class JsonSerialization {
|
|||
return readValue(bytes, type, false);
|
||||
}
|
||||
|
||||
public static <T> T readValue(InputStream bytes, TypeReference<T> type) throws IOException {
|
||||
return mapper.readValue(bytes, type);
|
||||
}
|
||||
|
||||
public static <T> T readValue(InputStream bytes, Class<T> type, boolean replaceSystemProperties) throws IOException {
|
||||
if (replaceSystemProperties) {
|
||||
return sysPropertiesAwareMapper.readValue(bytes, type);
|
||||
|
|
|
@ -36,19 +36,27 @@
|
|||
<artifactId>keycloak-dependencies-server-all</artifactId>
|
||||
<type>pom</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<artifactId>keycloak-wildfly-adduser</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<artifactId>keycloak-wildfly-extensions</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<artifactId>keycloak-wf9-server-subsystem</artifactId>
|
||||
<artifactId>keycloak-wildfly-server-subsystem</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.wildfly</groupId>
|
||||
<artifactId>wildfly-feature-pack</artifactId>
|
||||
<type>zip</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jboss.aesh</groupId>
|
||||
<artifactId>aesh</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
@ -0,0 +1,73 @@
|
|||
@echo off
|
||||
rem -------------------------------------------------------------------------
|
||||
rem Add User script for Windows
|
||||
rem -------------------------------------------------------------------------
|
||||
rem
|
||||
rem A simple utility for adding new users to the properties file used
|
||||
rem for domain management authentication out of the box.
|
||||
|
||||
rem $Id$
|
||||
|
||||
@if not "%ECHO%" == "" echo %ECHO%
|
||||
@if "%OS%" == "Windows_NT" setlocal
|
||||
|
||||
if "%OS%" == "Windows_NT" (
|
||||
set "DIRNAME=%~dp0%"
|
||||
) else (
|
||||
set DIRNAME=.\
|
||||
)
|
||||
|
||||
pushd "%DIRNAME%.."
|
||||
set "RESOLVED_JBOSS_HOME=%CD%"
|
||||
popd
|
||||
|
||||
if "x%JBOSS_HOME%" == "x" (
|
||||
set "JBOSS_HOME=%RESOLVED_JBOSS_HOME%"
|
||||
)
|
||||
|
||||
pushd "%JBOSS_HOME%"
|
||||
set "SANITIZED_JBOSS_HOME=%CD%"
|
||||
popd
|
||||
|
||||
if /i "%RESOLVED_JBOSS_HOME%" NEQ "%SANITIZED_JBOSS_HOME%" (
|
||||
echo.
|
||||
echo WARNING: The JBOSS_HOME ^("%SANITIZED_JBOSS_HOME%"^) that this script uses points to a different installation than the one that this script resides in ^("%RESOLVED_JBOSS_HOME%"^). Unpredictable results may occur.
|
||||
echo.
|
||||
echo JBOSS_HOME: "%JBOSS_HOME%"
|
||||
echo.
|
||||
)
|
||||
|
||||
rem Setup JBoss specific properties
|
||||
if "x%JAVA_HOME%" == "x" (
|
||||
set JAVA=java
|
||||
echo JAVA_HOME is not set. Unexpected results may occur.
|
||||
echo Set JAVA_HOME to the directory of your local JDK to avoid this message.
|
||||
) else (
|
||||
set "JAVA=%JAVA_HOME%\bin\java"
|
||||
)
|
||||
|
||||
rem Find jboss-modules.jar, or we can't continue
|
||||
if exist "%JBOSS_HOME%\jboss-modules.jar" (
|
||||
set "RUNJAR=%JBOSS_HOME%\jboss-modules.jar"
|
||||
) else (
|
||||
echo Could not locate "%JBOSS_HOME%\jboss-modules.jar".
|
||||
echo Please check that you are in the bin directory when running this script.
|
||||
goto END
|
||||
)
|
||||
|
||||
rem Set default module root paths
|
||||
if "x%JBOSS_MODULEPATH%" == "x" (
|
||||
set "JBOSS_MODULEPATH=%JBOSS_HOME%\modules"
|
||||
)
|
||||
|
||||
rem Uncomment to override standalone and domain user location
|
||||
rem set "JAVA_OPTS=%JAVA_OPTS% -Djboss.server.config.user.dir=..\standalone\configuration -Djboss.domain.config.user.dir=..\domain\configuration"
|
||||
|
||||
"%JAVA%" %JAVA_OPTS% ^
|
||||
-jar "%JBOSS_HOME%\jboss-modules.jar" ^
|
||||
-mp "%JBOSS_MODULEPATH%" ^
|
||||
org.keycloak.keycloak-wildfly-adduser ^
|
||||
%*
|
||||
|
||||
:END
|
||||
if "x%NOPAUSE%" == "x" pause
|
|
@ -0,0 +1,72 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Add User Utility
|
||||
#
|
||||
# A simple utility for adding new users to the properties file used
|
||||
# for domain management authentication out of the box.
|
||||
#
|
||||
|
||||
DIRNAME=`dirname "$0"`
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false;
|
||||
if [ `uname|grep -i CYGWIN` ]; then
|
||||
cygwin=true;
|
||||
fi
|
||||
|
||||
# For Cygwin, ensure paths are in UNIX format before anything is touched
|
||||
if $cygwin ; then
|
||||
[ -n "$JBOSS_HOME" ] &&
|
||||
JBOSS_HOME=`cygpath --unix "$JBOSS_HOME"`
|
||||
[ -n "$JAVA_HOME" ] &&
|
||||
JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
|
||||
[ -n "$JAVAC_JAR" ] &&
|
||||
JAVAC_JAR=`cygpath --unix "$JAVAC_JAR"`
|
||||
fi
|
||||
|
||||
# Setup JBOSS_HOME
|
||||
RESOLVED_JBOSS_HOME=`cd "$DIRNAME/.."; pwd`
|
||||
if [ "x$JBOSS_HOME" = "x" ]; then
|
||||
# get the full path (without any relative bits)
|
||||
JBOSS_HOME=$RESOLVED_JBOSS_HOME
|
||||
else
|
||||
SANITIZED_JBOSS_HOME=`cd "$JBOSS_HOME"; pwd`
|
||||
if [ "$RESOLVED_JBOSS_HOME" != "$SANITIZED_JBOSS_HOME" ]; then
|
||||
echo "WARNING: The JBOSS_HOME ($SANITIZED_JBOSS_HOME) that this script uses points to a different installation than the one that this script resides in ($RESOLVED_JBOSS_HOME). Unpredictable results may occur."
|
||||
echo ""
|
||||
fi
|
||||
fi
|
||||
export JBOSS_HOME
|
||||
|
||||
# Setup the JVM
|
||||
if [ "x$JAVA" = "x" ]; then
|
||||
if [ "x$JAVA_HOME" != "x" ]; then
|
||||
JAVA="$JAVA_HOME/bin/java"
|
||||
else
|
||||
JAVA="java"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "x$JBOSS_MODULEPATH" = "x" ]; then
|
||||
JBOSS_MODULEPATH="$JBOSS_HOME/modules"
|
||||
fi
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin; then
|
||||
JBOSS_HOME=`cygpath --path --windows "$JBOSS_HOME"`
|
||||
JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
|
||||
JBOSS_MODULEPATH=`cygpath --path --windows "$JBOSS_MODULEPATH"`
|
||||
fi
|
||||
|
||||
# Sample JPDA settings for remote socket debugging
|
||||
#JAVA_OPTS="$JAVA_OPTS -agentlib:jdwp=transport=dt_socket,address=8787,server=y,suspend=y"
|
||||
# Uncomment to override standalone and domain user location
|
||||
#JAVA_OPTS="$JAVA_OPTS -Djboss.server.config.user.dir=../standalone/configuration -Djboss.domain.config.user.dir=../domain/configuration"
|
||||
|
||||
JAVA_OPTS="$JAVA_OPTS"
|
||||
|
||||
eval \"$JAVA\" $JAVA_OPTS \
|
||||
-jar \""$JBOSS_HOME"/jboss-modules.jar\" \
|
||||
-mp \""${JBOSS_MODULEPATH}"\" \
|
||||
org.keycloak.keycloak-wildfly-adduser \
|
||||
'"$@"'
|
|
@ -0,0 +1,37 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
~ JBoss, Home of Professional Open Source.
|
||||
~ Copyright 2010, Red Hat, Inc., and individual contributors
|
||||
~ as indicated by the @author tags. See the copyright.txt file in the
|
||||
~ distribution for a full listing of individual contributors.
|
||||
~
|
||||
~ This is free software; you can redistribute it and/or modify it
|
||||
~ under the terms of the GNU Lesser General Public License as
|
||||
~ published by the Free Software Foundation; either version 2.1 of
|
||||
~ the License, or (at your option) any later version.
|
||||
~
|
||||
~ This software is distributed in the hope that it will be useful,
|
||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
~ Lesser General Public License for more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU Lesser General Public
|
||||
~ License along with this software; if not, write to the Free
|
||||
~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
||||
~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
|
||||
-->
|
||||
|
||||
<module xmlns="urn:jboss:module:1.3" name="org.jboss.aesh" slot="0.65">
|
||||
<properties>
|
||||
<property name="jboss.api" value="private"/>
|
||||
</properties>
|
||||
|
||||
<resources>
|
||||
<artifact name="${org.jboss.aesh:aesh}"/>
|
||||
</resources>
|
||||
|
||||
<dependencies>
|
||||
<module name="org.fusesource.jansi" />
|
||||
</dependencies>
|
||||
</module>
|
|
@ -29,6 +29,6 @@
|
|||
</resources>
|
||||
|
||||
<dependencies>
|
||||
<module name="org.keycloak.keycloak-wf9-server-subsystem" services="export" export="true"/>
|
||||
<module name="org.keycloak.keycloak-wildfly-server-subsystem" services="export" export="true"/>
|
||||
</dependencies>
|
||||
</module>
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module xmlns="urn:jboss:module:1.3" name="org.keycloak.keycloak-wildfly-adduser">
|
||||
<main-class name="org.keycloak.wildfly.adduser.AddUser"/>
|
||||
<resources>
|
||||
<artifact name="${org.keycloak:keycloak-wildfly-adduser}"/>
|
||||
</resources>
|
||||
<dependencies>
|
||||
<module name="org.keycloak.keycloak-common"/>
|
||||
<module name="org.keycloak.keycloak-core"/>
|
||||
<module name="org.keycloak.keycloak-model-api"/>
|
||||
<module name="org.jboss.aesh" slot="0.65"/>
|
||||
<module name="org.jboss.as.domain-management"/>
|
||||
<module name="org.codehaus.jackson.jackson-core-asl"/>
|
||||
</dependencies>
|
||||
</module>
|
|
@ -22,11 +22,11 @@
|
|||
~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
|
||||
-->
|
||||
|
||||
<module xmlns="urn:jboss:module:1.3" name="org.keycloak.keycloak-wf9-server-subsystem">
|
||||
<module xmlns="urn:jboss:module:1.3" name="org.keycloak.keycloak-wildfly-server-subsystem">
|
||||
|
||||
<resources>
|
||||
<resource-root path="."/>
|
||||
<artifact name="${org.keycloak:keycloak-wf9-server-subsystem}"/>
|
||||
<artifact name="${org.keycloak:keycloak-wildfly-server-subsystem}"/>
|
||||
</resources>
|
||||
|
||||
<dependencies>
|
|
@ -274,8 +274,8 @@
|
|||
|
||||
<!-- subsystems -->
|
||||
|
||||
<module-def name="org.keycloak.keycloak-as7-server-subsystem">
|
||||
<maven-resource group="org.keycloak" artifact="keycloak-as7-server-subsystem"/>
|
||||
<module-def name="org.keycloak.keycloak-eap6-server-subsystem">
|
||||
<maven-resource group="org.keycloak" artifact="keycloak-eap6-server-subsystem"/>
|
||||
</module-def>
|
||||
|
||||
<module-def name="org.keycloak.keycloak-server-subsystem"/>
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<artifactId>keycloak-as7-server-subsystem</artifactId>
|
||||
<artifactId>keycloak-eap6-server-subsystem</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.keycloak</groupId>
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
|
||||
-->
|
||||
|
||||
<module xmlns="urn:jboss:module:1.1" name="org.keycloak.keycloak-as7-server-subsystem">
|
||||
<module xmlns="urn:jboss:module:1.1" name="org.keycloak.keycloak-eap6-server-subsystem">
|
||||
|
||||
<resources>
|
||||
<resource-root path="."/>
|
|
@ -30,6 +30,6 @@
|
|||
</resources>
|
||||
|
||||
<dependencies>
|
||||
<module name="org.keycloak.keycloak-as7-server-subsystem" services="export" export="true"/>
|
||||
<module name="org.keycloak.keycloak-eap6-server-subsystem" services="export" export="true"/>
|
||||
</dependencies>
|
||||
</module>
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
<!ENTITY SpringSecurityAdapter SYSTEM "modules/spring-security-adapter.xml">
|
||||
<!ENTITY InstalledApplications SYSTEM "modules/installed-applications.xml">
|
||||
<!ENTITY Logout SYSTEM "modules/logout.xml">
|
||||
<!ENTITY ErrorHandling SYSTEM "modules/adapter_error_handling.xml">
|
||||
<!ENTITY SAML SYSTEM "modules/saml.xml">
|
||||
<!ENTITY JAAS SYSTEM "modules/jaas.xml">
|
||||
<!ENTITY IdentityBroker SYSTEM "modules/identity-broker.xml">
|
||||
|
@ -37,7 +38,6 @@
|
|||
<!ENTITY UserFederation SYSTEM "modules/user-federation.xml">
|
||||
<!ENTITY Kerberos SYSTEM "modules/kerberos.xml">
|
||||
<!ENTITY ExportImport SYSTEM "modules/export-import.xml">
|
||||
<!ENTITY AdminRecovery SYSTEM "modules/admin-recovery.xml">
|
||||
<!ENTITY ServerCache SYSTEM "modules/cache.xml">
|
||||
<!ENTITY SecurityVulnerabilities SYSTEM "modules/security-vulnerabilities.xml">
|
||||
<!ENTITY Clustering SYSTEM "modules/clustering.xml">
|
||||
|
@ -115,6 +115,7 @@ This one is short
|
|||
&SpringSecurityAdapter;
|
||||
&InstalledApplications;
|
||||
&Logout;
|
||||
&ErrorHandling;
|
||||
&MultiTenancy;
|
||||
&JAAS;
|
||||
</chapter>
|
||||
|
|
|
@ -83,6 +83,10 @@
|
|||
<title>Migrating to 1.7.0.CR1</title>
|
||||
<simplesect>
|
||||
<title>Option 'Update Profile On First Login' moved from Identity provider to Review Profile authenticator</title>
|
||||
<para>
|
||||
form-error-page in web.xml will no longer work for client adapter authentication errors. You must define an error-page for
|
||||
the the various HTTP error codes. See documentation for more details if you want to catch and handle adapter error conditions.
|
||||
</para>
|
||||
<para>
|
||||
In this version, we added <literal>First Broker Login</literal>, which allows you to specify what exactly should be done
|
||||
when new user is logged through Identity provider (or Social provider), but there is no existing Keycloak user
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
<section id="adapter_error_handling">
|
||||
<title>Error Handling</title>
|
||||
<para>
|
||||
Keycloak has some error handling facilities for servlet based client adapters. When an error is encountered in
|
||||
authentication, keycloak will call <literal>HttpServletResponse.sendError()</literal>. You can set up an error-page
|
||||
within your <literal>web.xml</literal> file to handle the error however you want. Keycloak may throw
|
||||
400, 401, 403, and 500 errors.
|
||||
</para>
|
||||
<para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
<error-page>
|
||||
<error-code>404</error-code>
|
||||
<location>/ErrorHandler</location>
|
||||
</error-page>]]>
|
||||
</programlisting>
|
||||
</para>
|
||||
<para>
|
||||
Keycloak also sets an <literal>HttpServletRequest</literal> attribute that you can retrieve. The attribute name
|
||||
is <literal>org.keycloak.adapters.spi.AuthenticationError</literal>. Typecast this object to:
|
||||
<literal>org.keycloak.adapters.OIDCAuthenticationError</literal>. This class can tell you exactly what happened.
|
||||
If this attribute is not set, then the adapter was not responsible for the error code.
|
||||
</para>
|
||||
<para>
|
||||
<programlisting>
|
||||
public class OIDCAuthenticationError implements AuthenticationError {
|
||||
public static enum Reason {
|
||||
NO_BEARER_TOKEN,
|
||||
NO_REDIRECT_URI,
|
||||
INVALID_STATE_COOKIE,
|
||||
OAUTH_ERROR,
|
||||
SSL_REQUIRED,
|
||||
CODE_TO_TOKEN_FAILURE,
|
||||
INVALID_TOKEN,
|
||||
STALE_TOKEN,
|
||||
NO_AUTHORIZATION_HEADER
|
||||
}
|
||||
|
||||
private Reason reason;
|
||||
private String description;
|
||||
|
||||
public OIDCAuthenticationError(Reason reason, String description) {
|
||||
this.reason = reason;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public Reason getReason() {
|
||||
return reason;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
}
|
||||
|
||||
</programlisting>
|
||||
</para>
|
||||
</section>
|
|
@ -1,15 +0,0 @@
|
|||
<chapter id="admin-recovery">
|
||||
<title>Recovering the Master Admin User</title>
|
||||
<para>
|
||||
It is possible for the "admin" user in the master realm to become inoperable. This may be because it was
|
||||
accidentally deleted, its role mappings were removed, or the password was simply forgotten.
|
||||
</para>
|
||||
<para>
|
||||
To recover the master admin user, just start the server with the following system properties:
|
||||
<programlisting><![CDATA[
|
||||
bin/standalone.sh -Dkeycloak.recover-admin=true -Dkeycloak.temp-admin-password=temppassword
|
||||
]]></programlisting>
|
||||
Then you can log in to the master admin account with your temporary password. You will then be
|
||||
prompted to immediately change this password.
|
||||
</para>
|
||||
</chapter>
|
|
@ -10,15 +10,15 @@
|
|||
<para>
|
||||
The Client Registration Service provides built-in support for Keycloak Client Representations, OpenID Connect
|
||||
Client Meta Data and SAML Entity Descriptors. It's also possible to plugin custom client registration providers
|
||||
if required. The Client Registration Service endpoint is <literal><KEYCLOAK URL>/clients/<provider></literal>.
|
||||
if required. The Client Registration Service endpoint is <literal><KEYCLOAK URL>/realms/<realm>/clients/<provider></literal>.
|
||||
</para>
|
||||
<para>
|
||||
The built-in supported <literal>providers</literal> are:
|
||||
<itemizedlist>
|
||||
<listitem><literal>default</literal> Keycloak Representations</listitem>
|
||||
<listitem><literal>install</literal> Keycloak Adapter Configuration</listitem>
|
||||
<!--<listitem><literal>openid-connect</literal> OpenID Connect Dynamic Client Registration</listitem>-->
|
||||
<!--<listitem><literal>saml-ed</literal> SAML Entity Descriptors</listitem>-->
|
||||
<listitem><literal>openid-connect</literal> OpenID Connect Dynamic Client Registration</listitem>
|
||||
<listitem><literal>saml2-entity-descriptor</literal> SAML Entity Descriptors</listitem>
|
||||
</itemizedlist>
|
||||
The following sections will describe how to use the different providers.
|
||||
</para>
|
||||
|
@ -106,30 +106,30 @@ Authorization: bearer eyJhbGciOiJSUzI1NiJ9.eyJqdGkiOiJmMjJmNzQyYy04ZjNlLTQ2M....
|
|||
</para>
|
||||
<para>
|
||||
To create a client create a Client Representation (JSON) then do a HTTP POST to:
|
||||
<literal><KEYCLOAK URL>/clients/<provider>/default</literal>. It will return a Client Representation
|
||||
<literal><KEYCLOAK URL>/realms/<realm>/clients/<provider>/default</literal>. It will return a Client Representation
|
||||
that also includes the registration access token. You should save the registration access token somewhere
|
||||
if you want to retrieve the config, update or delete the client later.
|
||||
</para>
|
||||
<para>
|
||||
To retrieve the Client Representation then do a HTTP GET to:
|
||||
<literal><KEYCLOAK URL>/clients/<provider>/default/<client id></literal>. It will also
|
||||
<literal><KEYCLOAK URL>/realms/<realm>clients/<provider>/default/<client id></literal>. It will also
|
||||
return a new registration access token.
|
||||
</para>
|
||||
<para>
|
||||
To update the Client Representation then do a HTTP PUT to with the updated Client Representation to:
|
||||
<literal><KEYCLOAK URL>/clients/<provider>/default/<client id></literal>. It will also
|
||||
<literal><KEYCLOAK URL>/realms/<realm>/clients/<provider>/default/<client id></literal>. It will also
|
||||
return a new registration access token.
|
||||
</para>
|
||||
<para>
|
||||
To delete the Client Representation then do a HTTP DELETE to:
|
||||
<literal><KEYCLOAK URL>/clients/<provider>/default/<client id></literal>
|
||||
<literal><KEYCLOAK URL>/realms/<realm>/clients/<provider>/default/<client id></literal>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Keycloak Adapter Configuration</title>
|
||||
<para>
|
||||
The <default>installation</default> client registration provider can be used to retrieve the adapter configuration
|
||||
The <literal>installation</literal> client registration provider can be used to retrieve the adapter configuration
|
||||
for a client. In addition to token authentication you can also authenticate with client credentials using
|
||||
HTTP basic authentication. To do this include the following header in the request:
|
||||
<programlisting><![CDATA[
|
||||
|
@ -138,7 +138,7 @@ Authorization: basic BASE64(client-id + ':' + client-secret)
|
|||
</para>
|
||||
<para>
|
||||
To retrieve the Adapter Configuration then do a HTTP GET to:
|
||||
<literal><KEYCLOAK URL>/clients/<provider>/installation/<client id></literal>
|
||||
<literal><KEYCLOAK URL>//realms/<realm>clients/<provider>/installation/<client id></literal>
|
||||
</para>
|
||||
<para>
|
||||
No authentication is required for public clients. This means that for the JavaScript adapter you can
|
||||
|
@ -146,23 +146,36 @@ Authorization: basic BASE64(client-id + ':' + client-secret)
|
|||
</para>
|
||||
</section>
|
||||
|
||||
<!--
|
||||
<section>
|
||||
<title>OpenID Connect Dynamic Client Registration</title>
|
||||
<para>
|
||||
TODO
|
||||
Keycloak implements <ulink url="https://openid.net/specs/openid-connect-registration-1_0.html">OpenID Connect Dynamic Client Registration</ulink>,
|
||||
which extends <ulink url="https://tools.ietf.org/html/rfc7591">OAuth 2.0 Dynamic Client Registration Protocol</ulink> and
|
||||
<ulink url="https://tools.ietf.org/html/rfc7592">OAuth 2.0 Dynamic Client Registration Management Protocol</ulink>.
|
||||
</para>
|
||||
<para>
|
||||
The endpoint to use these specifications to register clients in Keycloak is:
|
||||
<literal><KEYCLOAK URL>/realms/<realm>/clients/<provider>/oidc[/<client id>]</literal>.
|
||||
</para>
|
||||
<para>
|
||||
This endpoints can also be found in the OpenID Connect Discovery endpoint for the realm:
|
||||
<literal><KEYCLOAK URL>/realms/<realm>/.well-known/openid-configuration</literal>.
|
||||
</para>
|
||||
</section>
|
||||
-->
|
||||
|
||||
<!--
|
||||
<section>
|
||||
<title>SAML Entity Descriptors</title>
|
||||
<para>
|
||||
TODO
|
||||
The SAML Entity Descriptor endpoint only supports using SAML v2 Entity Descriptors to create clients. It
|
||||
doesn't support retrieving, updating or deleting clients. For those operations the Keycloak representation
|
||||
endpoints should be used. When creating a client a Keycloak Client Representation is returned with details
|
||||
about the created client, including a registration access token.
|
||||
</para>
|
||||
<para>
|
||||
To create a client do a HTTP POST with the SAML Entity Descriptor to:
|
||||
<literal><KEYCLOAK URL>/realms/<realm>/clients/<provider>/saml2-entity-descriptor</literal>.
|
||||
</para>
|
||||
</section>
|
||||
-->
|
||||
|
||||
<section>
|
||||
<title>Client Registration Java API</title>
|
||||
|
|
|
@ -127,6 +127,25 @@ cd <WILDFLY_HOME>/bin
|
|||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<section>
|
||||
<title>Admin User</title>
|
||||
<para>
|
||||
To access the admin console you need an account to login. Currently, there's a default account added
|
||||
with the username <literal>admin</literal> and password <literal>admin</literal>. You will be required
|
||||
to change the password on first login. We are planning on removing the built-in account soon and will
|
||||
instead have an initial step to create the user.
|
||||
</para>
|
||||
<para>
|
||||
You can also create a user with the <literal>add-user</literal> script found in <literal>bin</literal>.
|
||||
This script will create a temporary file with the details of the user, which are imported at startup.
|
||||
To add a user with this script run:
|
||||
<programlisting><![CDATA[
|
||||
bin/add-user.[sh|bat] -r master -u <username> -p <password>
|
||||
]]></programlisting>
|
||||
Then restart the server.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Relational Database Configuration</title>
|
||||
<para>
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
<!ENTITY Jetty8Adapter SYSTEM "modules/jetty8-adapter.xml">
|
||||
<!ENTITY FilterAdapter SYSTEM "modules/servlet-filter-adapter.xml">
|
||||
<!ENTITY Logout SYSTEM "modules/logout.xml">
|
||||
<!ENTITY ErrorHandling SYSTEM "modules/adapter_error_handling.xml">
|
||||
]>
|
||||
|
||||
<book>
|
||||
|
@ -49,6 +50,7 @@ This one is short
|
|||
&Jetty8Adapter;
|
||||
&FilterAdapter;
|
||||
&Logout;
|
||||
&ErrorHandling;
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
<chapter id="adapter_error_handling">
|
||||
<title>Error Handling</title>
|
||||
<para>
|
||||
Keycloak has some error handling facilities for servlet based client adapters. When an error is encountered in
|
||||
authentication, keycloak will call <literal>HttpServletResponse.sendError()</literal>. You can set up an error-page
|
||||
within your <literal>web.xml</literal> file to handle the error however you want. Keycloak may throw
|
||||
400, 401, 403, and 500 errors.
|
||||
</para>
|
||||
<para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
<error-page>
|
||||
<error-code>404</error-code>
|
||||
<location>/ErrorHandler</location>
|
||||
</error-page>]]>
|
||||
</programlisting>
|
||||
</para>
|
||||
<para>
|
||||
Keycloak also sets an <literal>HttpServletRequest</literal> attribute that you can retrieve. The attribute name
|
||||
is <literal>org.keycloak.adapters.spi.AuthenticationError</literal>. Typecast this object to:
|
||||
<literal>org.keycloak.adapters.saml.SamlAuthenticationError</literal>. This class can tell you exactly what happened.
|
||||
If this attribute is not set, then the adapter was not responsible for the error code.
|
||||
</para>
|
||||
<para>
|
||||
<programlisting>
|
||||
public class SamlAuthenticationError implements AuthenticationError {
|
||||
public static enum Reason {
|
||||
EXTRACTION_FAILURE,
|
||||
INVALID_SIGNATURE,
|
||||
ERROR_STATUS
|
||||
}
|
||||
|
||||
public Reason getReason() {
|
||||
return reason;
|
||||
}
|
||||
public StatusResponseType getStatus() {
|
||||
return status;
|
||||
}
|
||||
}
|
||||
</programlisting>
|
||||
</para>
|
||||
</chapter>
|
14
examples/demo-template/offline-access-app/src/main/java/org/keycloak/example/OfflineAccessPortalServlet.java
Normal file → Executable file
14
examples/demo-template/offline-access-app/src/main/java/org/keycloak/example/OfflineAccessPortalServlet.java
Normal file → Executable file
|
@ -17,10 +17,12 @@ import org.apache.http.client.methods.HttpGet;
|
|||
import org.apache.http.impl.client.DefaultHttpClient;
|
||||
import org.keycloak.KeycloakSecurityContext;
|
||||
import org.keycloak.adapters.AdapterDeploymentContext;
|
||||
import org.keycloak.adapters.spi.AuthenticationError;
|
||||
import org.keycloak.adapters.spi.HttpFacade;
|
||||
import org.keycloak.adapters.KeycloakDeployment;
|
||||
import org.keycloak.adapters.RefreshableKeycloakSecurityContext;
|
||||
import org.keycloak.adapters.ServerRequest;
|
||||
import org.keycloak.adapters.spi.LogoutError;
|
||||
import org.keycloak.representations.AccessTokenResponse;
|
||||
import org.keycloak.representations.RefreshToken;
|
||||
import org.keycloak.util.JsonSerialization;
|
||||
|
@ -203,6 +205,18 @@ public class OfflineAccessPortalServlet extends HttpServlet {
|
|||
public String getRemoteAddr() {
|
||||
return servletRequest.getRemoteAddr();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setError(AuthenticationError error) {
|
||||
servletRequest.setAttribute(AuthenticationError.class.getName(), error);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setError(LogoutError error) {
|
||||
servletRequest.setAttribute(LogoutError.class.getName(), error);
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -153,6 +153,10 @@ public class ExtendingThemeManager implements ThemeProvider {
|
|||
|
||||
private List<Theme> themes;
|
||||
|
||||
private Properties properties;
|
||||
|
||||
private ConcurrentHashMap<String, ConcurrentHashMap<Locale, Properties>> messages = new ConcurrentHashMap<>();
|
||||
|
||||
public ExtendingTheme(List<Theme> themes) {
|
||||
this.themes = themes;
|
||||
}
|
||||
|
@ -229,28 +233,41 @@ public class ExtendingThemeManager implements ThemeProvider {
|
|||
|
||||
@Override
|
||||
public Properties getMessages(String baseBundlename, Locale locale) throws IOException {
|
||||
Properties messages = new Properties();
|
||||
ListIterator<Theme> itr = themes.listIterator(themes.size());
|
||||
while (itr.hasPrevious()) {
|
||||
Properties m = itr.previous().getMessages(baseBundlename, locale);
|
||||
if (m != null) {
|
||||
messages.putAll(m);
|
||||
if (messages.get(baseBundlename) == null || messages.get(baseBundlename).get(locale) == null) {
|
||||
Properties messages = new Properties();
|
||||
ListIterator<Theme> itr = themes.listIterator(themes.size());
|
||||
while (itr.hasPrevious()) {
|
||||
Properties m = itr.previous().getMessages(baseBundlename, locale);
|
||||
if (m != null) {
|
||||
messages.putAll(m);
|
||||
}
|
||||
}
|
||||
|
||||
this.messages.putIfAbsent(baseBundlename, new ConcurrentHashMap<Locale, Properties>());
|
||||
this.messages.get(baseBundlename).putIfAbsent(locale, messages);
|
||||
|
||||
return messages;
|
||||
} else {
|
||||
return messages.get(baseBundlename).get(locale);
|
||||
}
|
||||
return messages;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Properties getProperties() throws IOException {
|
||||
Properties properties = new Properties();
|
||||
ListIterator<Theme> itr = themes.listIterator(themes.size());
|
||||
while (itr.hasPrevious()) {
|
||||
Properties p = itr.previous().getProperties();
|
||||
if (p != null) {
|
||||
properties.putAll(p);
|
||||
if (properties == null) {
|
||||
Properties properties = new Properties();
|
||||
ListIterator<Theme> itr = themes.listIterator(themes.size());
|
||||
while (itr.hasPrevious()) {
|
||||
Properties p = itr.previous().getProperties();
|
||||
if (p != null) {
|
||||
properties.putAll(p);
|
||||
}
|
||||
}
|
||||
this.properties = properties;
|
||||
return properties;
|
||||
} else {
|
||||
return properties;
|
||||
}
|
||||
return properties;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -96,7 +96,7 @@ revoke=Revocar permiso
|
|||
configureAuthenticators=Autenticadores configurados
|
||||
mobile=M\u00F3vil
|
||||
totpStep1=Instala <a href=\"https://fedorahosted.org/freeotp/\" target=\"_blank\">FreeOTP</a> o Google Authenticator en tu tel\u00E9fono m\u00F3vil. Ambas aplicaciones est\u00E1n disponibles en <a href=\"https://play.google.com\">Google Play</a> y en la App Store de Apple.
|
||||
totpStep2=Abre la aplicacvi\u00F3n y escanea el c\u00F3digo o introduce la clave.
|
||||
totpStep2=Abre la aplicaci\u00F3n y escanea el c\u00F3digo o introduce la clave.
|
||||
totpStep3=Introduce el c\u00F3digo \u00FAnico que te muestra la aplicaci\u00F3n de autenticaci\u00F3n y haz clic en Enviar para finalizar la configuraci\u00F3n
|
||||
|
||||
missingUsernameMessage=Por favor indica tu usuario.
|
||||
|
|
|
@ -271,7 +271,7 @@ client-certificate-import=Client Certificate Import
|
|||
import-client-certificate=Import Client Certificate
|
||||
jwt-import.key-alias.tooltip=Archive alias for your certificate.
|
||||
secret=Secret
|
||||
regenerate-secret=Regenerate Secretsecret=Secret
|
||||
regenerate-secret=Regenerate Secret
|
||||
registrationAccessToken=Registration access token
|
||||
registrationAccessToken.regenerate=Regenerate registration access token
|
||||
registrationAccessToken.tooltip=The registration access token provides access for clients to the client registration service.
|
||||
|
|
|
@ -17,7 +17,7 @@ false=No
|
|||
# Realm settings
|
||||
realm-detail.enabled.tooltip=Los usuarios y clientes solo pueden acceder a un dominio si est\u00E1 habilitado
|
||||
registrationAllowed=Registro de usuario
|
||||
registrationAllowed.tooltip=Habilitar/deshabilitar la p\u00E1gina de registro. Un enlace para el registro se motrar\u00E1 tambi\u00E9n en la p\u00E1gina de inicio de sesi\u00F3n.
|
||||
registrationAllowed.tooltip=Habilitar/deshabilitar la p\u00E1gina de registro. Un enlace para el registro se mostrar\u00E1 tambi\u00E9n en la p\u00E1gina de inicio de sesi\u00F3n.
|
||||
registrationEmailAsUsername=Email como nombre de usuario
|
||||
registrationEmailAsUsername.tooltip=Si est\u00E1 habilitado el nombre de usuario queda oculto del formulario de registro y el email se usa como nombre de usuario para los nuevos usuarios.
|
||||
editUsernameAllowed=Editar nombre de usuario
|
||||
|
@ -32,7 +32,7 @@ sslRequired=Solicitar SSL
|
|||
sslRequired.option.all=todas las peticiones
|
||||
sslRequired.option.external=peticiones externas
|
||||
sslRequired.option.none=ninguna
|
||||
sslRequired.tooltip=\u00BFEs HTTP obligatorio? 'ninguna' significa que HTTPS no es obligatorio para ninguna direcic\u00F3n IP de cliente, 'peticiones externas' indica que localhost y las direcciones IP privadas pueden acceder sin HTTPS, 'todas las peticiones' significa que HTTPS es obligatorio para todas las direcciones IP.
|
||||
sslRequired.tooltip=\u00BFEs HTTP obligatorio? ''ninguna'' significa que HTTPS no es obligatorio para ninguna direcic\u00F3n IP de cliente, ''peticiones externas'' indica que localhost y las direcciones IP privadas pueden acceder sin HTTPS, ''todas las peticiones'' significa que HTTPS es obligatorio para todas las direcciones IP.
|
||||
publicKey=Clave p\u00FAblica
|
||||
gen-new-keys=Generar nuevas claves
|
||||
certificate=Certificado
|
||||
|
@ -51,7 +51,7 @@ password=Contrase\u00F1a
|
|||
login-password=Contrase\u00F1a
|
||||
login-theme=Tema de inicio de sesi\u00F3n
|
||||
select-one=Selecciona uno...
|
||||
login-theme.tooltip=Selecciona el tema para las p\u00E1gina de inicio de sesi\u00F3n, TOTP, permisos, registro y recordatorio de contrase\u00F1a.
|
||||
login-theme.tooltip=Selecciona el tema para las p\u00E1ginas de inicio de sesi\u00F3n, TOTP, permisos, registro y recordatorio de contrase\u00F1a.
|
||||
account-theme=Tema de cuenta
|
||||
account-theme.tooltip=Selecciona el tema para las p\u00E1ginas de gesti\u00F3n de la cuenta de usuario.
|
||||
admin-console-theme=Tema de consola de administraci\u00F3n
|
||||
|
@ -75,23 +75,23 @@ hours=Horas
|
|||
days=D\u00EDas
|
||||
sso-session-max=Tiempo m\u00E1ximo sesi\u00F3n SSO
|
||||
sso-session-idle.tooltip=Tiempo m\u00E1ximo que una sesi\u00F3n puede estar inactiva antes de que expire. Los tokens y sesiones de navegador son invalidadas cuando la sesi\u00F3n expira.
|
||||
sso-session-max.tooltip=Tiempo m\u00E1ximo antes de que una sesi\u00F3n expire. Los tokesn y sesiones de navegador son invalidados cuando una sesi\u00F3n expira.
|
||||
sso-session-max.tooltip=Tiempo m\u00E1ximo antes de que una sesi\u00F3n expire. Los tokens y sesiones de navegador son invalidados cuando una sesi\u00F3n expira.
|
||||
offline-session-idle=Inactividad de sesi\u00F3n sin conexi\u00F3n
|
||||
offline-session-idle.tooltip=Tiempo m\u00E1ximo inactivo de una sesi\u00F3n sin conexi\u00F3n antes de que expire. Necesitas usar un token sin conexi\u00F3n para refrescar al menos una vez dentro de este periodo, en otro caso la sesi\u00F3n sin conexi\u00F3n expirar\u00E1.
|
||||
access-token-lifespan=Duraci\u00F3n del token de acceso
|
||||
access-token-lifespan.tooltip=Tiempo m\u00E1ximo antes de que un token de acceso expire. Se recomiena que esta valor sea corto en relaci\u00F3n al tiempo m\u00E1ximo de SSO
|
||||
access-token-lifespan.tooltip=Tiempo m\u00E1ximo antes de que un token de acceso expire. Se recomienda que este valor sea corto en relaci\u00F3n al tiempo m\u00E1ximo de SSO
|
||||
client-login-timeout=Tiempo m\u00E1ximo de autenticaci\u00F3n
|
||||
client-login-timeout.tooltip=Tiempo m\u00E1ximo que un cliente tien para finalizar el protocolo de obtenci\u00F3n del token de acceso. Deber\u00EDa ser normalmente del orden de 1 minuto.
|
||||
client-login-timeout.tooltip=Tiempo m\u00E1ximo que un cliente tiene para finalizar el protocolo de obtenci\u00F3n del token de acceso. Deber\u00EDa ser normalmente del orden de 1 minuto.
|
||||
login-timeout=Tiempo m\u00E1ximo de desconexi\u00F3n
|
||||
login-timeout.tooltip=Tiempo m\u00E1xmo que un usuario tiene para completar el inicio de sesi\u00F3n. Se recomienda que sea relativamente alto. 30 minutos o m\u00E1s.
|
||||
login-timeout.tooltip=Tiempo m\u00E1ximo que un usuario tiene para completar el inicio de sesi\u00F3n. Se recomienda que sea relativamente alto. 30 minutos o m\u00E1s.
|
||||
login-action-timeout=Tiempo m\u00E1ximo de acci\u00F3n en el inicio de sesi\u00F3n
|
||||
login-action-timeout.tooltip=Tiempo m\u00E1ximo que un usuario tiene para completar acciones relacionadas con el inicio de sesi\u00F3n, como la actualizaci\u00F3n de contrase\u00F1a o configuraci\u00F3n de TOTP. Es recomendado que sea relativamente alto. 5 minutos o m\u00E1s.
|
||||
headers=Cabeceras
|
||||
brute-force-detection=Detecci\u00F3n de ataques por fuerza bruta
|
||||
x-frame-options=X-Frame-Options
|
||||
click-label-for-info=Haz clic en el enlace de la etiqueta para obtener m\u00E1s informaci\u00F3n. El valor por defecto evita que las p\u00E1ginas sean incluidaos desde iframes externos.
|
||||
click-label-for-info=Haz clic en el enlace de la etiqueta para obtener m\u00E1s informaci\u00F3n. El valor por defecto evita que las p\u00E1ginas sean incluidas desde iframes externos.
|
||||
content-sec-policy=Content-Security-Policy
|
||||
max-login-failures=N\u00FAmero m\u00E1ximo de fallos de inicios de sesi\u00F3n
|
||||
max-login-failures=N\u00FAmero m\u00E1ximo de fallos de inicio de sesi\u00F3n
|
||||
max-login-failures.tooltip=Indica cuantos fallos se permiten antes de que se dispare una espera.
|
||||
wait-increment=Incremento de espera
|
||||
wait-increment.tooltip=Cuando se ha alcanzado el umbral de fallo, \u00BFcuanto tiempo debe estar un usuario bloqueado?
|
||||
|
@ -107,7 +107,7 @@ realm-tab-login=Inicio de sesi\u00F3n
|
|||
realm-tab-keys=Claves
|
||||
realm-tab-email=Email
|
||||
realm-tab-themes=Temas
|
||||
realm-tab-cache=Cache
|
||||
realm-tab-cache=Cach\u00E9
|
||||
realm-tab-tokens=Tokens
|
||||
realm-tab-security-defenses=Defensas de seguridad
|
||||
realm-tab-general=General
|
||||
|
@ -123,11 +123,11 @@ not-before=No antes de
|
|||
not-before.tooltip=Revocar cualquier token emitido antes de esta fecha.
|
||||
set-to-now=Fijar a ahora
|
||||
push=Push
|
||||
push.tooltip=Para cada cliente que tiene una URL de administraci\u00F3n, notificarlos the las nuevas pol\u00EDticas de revocaci\u00F3n.
|
||||
push.tooltip=Para cada cliente que tiene una URL de administraci\u00F3n, notificarlos las nuevas pol\u00EDticas de revocaci\u00F3n.
|
||||
|
||||
#Protocol Mapper
|
||||
usermodel.prop.label=Propiedad
|
||||
usermodel.prop.tooltip=Nombre del m\u00E9todo de propiedad in la interfaz UserModel. Por ejemplo, un valor de 'email' referenciar\u00EDa al m\u00E9todo UserModel.getEmail().
|
||||
usermodel.prop.tooltip=Nombre del m\u00E9todo de propiedad en la interfaz UserModel. Por ejemplo, un valor de ''email'' referenciar\u00EDa al m\u00E9todo UserModel.getEmail().
|
||||
usermodel.attr.label=Atributo de usuario
|
||||
usermodel.attr.tooltip=Nombre del atributo de usuario almacenado que es el nombre del atributo dentro del map UserModel.attribute.
|
||||
userSession.modelNote.label=Nota sesi\u00F3n usuario
|
||||
|
@ -137,7 +137,7 @@ multivalued.tooltip=Indica si el atributo soporta m\u00FAltiples valores. Si est
|
|||
selectRole.label=Selecciona rol
|
||||
selectRole.tooltip=Introduce el rol en la caja de texto de la izquierda, o haz clic en este bot\u00F3n para navegar y buscar el rol que quieres.
|
||||
tokenClaimName.label=Nombre de reclamo del token
|
||||
tokenClaimName.tooltip=Nombre del reclamo a insertar en el token. Puede ser un nombre completo como 'address.street'. En este caso, se crear\u00E1 un objeto JSON anidado.
|
||||
tokenClaimName.tooltip=Nombre del reclamo a insertar en el token. Puede ser un nombre completo como ''address.street''. En este caso, se crear\u00E1 un objeto JSON anidado.
|
||||
jsonType.label=Tipo JSON de reclamaci\u00F3n
|
||||
jsonType.tooltip=El tipo de JSON que deber\u00EDa ser usado para rellenar la petici\u00F3n de JSON en el token. long, int, boolean y String son valores v\u00E1lidos
|
||||
includeInIdToken.label=A\u00F1adir al token de ID
|
||||
|
@ -162,21 +162,21 @@ add-client=A\u00F1adir Cliente
|
|||
select-file=Selecciona archivo
|
||||
view-details=Ver detalles
|
||||
clear-import=Limpiar importaci\u00F3n
|
||||
client-id.tooltip=Indica el identificador (ID) referenciado en URIs y tokens. Por ejemplo 'my-client'
|
||||
client.name.tooltip=Indica el nombre visible del cliente. Por ejemplo 'My Client'. Tambi\u00E9n soporta claves para vallores localizados. Por ejemplo: ${my_client}
|
||||
client-id.tooltip=Indica el identificador (ID) referenciado en URIs y tokens. Por ejemplo ''my-client''
|
||||
client.name.tooltip=Indica el nombre visible del cliente. Por ejemplo ''My Client''. Tambi\u00E9n soporta claves para valores localizados. Por ejemplo: ${my_client}
|
||||
client.enabled.tooltip=Los clientes deshabilitados no pueden iniciar una identificaci\u00F3n u obtener c\u00F3digos de acceso.
|
||||
consent-required=Consentimiento necesario
|
||||
consent-required.tooltip=Si est\u00E1 habilitado, los usuarios tienen que consentir el acceso del cliente.
|
||||
direct-grants-only=Solo permisos directos
|
||||
direct-grants-only.tooltip=Cuando est\u00E1 habilitado, el cliente solo puede obtener permisos de la API REST.
|
||||
client-protocol=Protocolo del Cliente
|
||||
client-protocol.tooltip='OpenID connect' permite a los clientes verificar la identidad del usuario final basado en la autenticaci\u00F3n realizada por un servidor de autorizaci\u00F3n. 'SAML' habilita la autenticaci\u00F3n y autorizaci\u00F3n de escenarios basados en web incluyendo cross-domain y single sign-on (SSO) y utiliza tokdne de seguridad que contienen afirmaciones para pasar informaci\u00F3n.
|
||||
client-protocol.tooltip=''OpenID connect'' permite a los clientes verificar la identidad del usuario final basado en la autenticaci\u00F3n realizada por un servidor de autorizaci\u00F3n. ''SAML'' habilita la autenticaci\u00F3n y autorizaci\u00F3n de escenarios basados en web incluyendo cross-domain y single sign-on (SSO) y utiliza tokens de seguridad que contienen afirmaciones para pasar informaci\u00F3n.
|
||||
access-type=Tipo de acceso
|
||||
access-type.tooltip=Los clientes 'Confidential' necesitan un secreto para iniciar el protocolo de identificaci\u00F3n. Los clientes 'Public' no requieren un secreto. Los clientes 'Bearer-only' son servicios web que nunca inician un login.
|
||||
access-type.tooltip=Los clientes ''Confidential'' necesitan un secreto para iniciar el protocolo de identificaci\u00F3n. Los clientes ''Public'' no requieren un secreto. Los clientes ''Bearer-only'' son servicios web que nunca inician un login.
|
||||
service-accounts-enabled=Cuentas de servicio habilitadas
|
||||
service-accounts-enabled.tooltip=Permitir autenticar este cliente contra Keycloak y recivir un token de acceso dedicado para este cliente.
|
||||
service-accounts-enabled.tooltip=Permitir autenticar este cliente contra Keycloak y recibir un token de acceso dedicado para este cliente.
|
||||
include-authnstatement=Incluir AuthnStatement
|
||||
include-authnstatement.tooltip=null
|
||||
include-authnstatement.tooltip=\u00BFDeber\u00EDa incluirse una declaraci\u00F3n especificando el m\u00E9todo y la marca de tiempo en la respuesta de inicio de sesi\u00F3n?
|
||||
sign-documents=Firmar documentos
|
||||
sign-documents.tooltip=\u00BFDeber\u00EDa el dominio firmar los documentos SAML?
|
||||
sign-assertions=Firmar aserciones
|
||||
|
@ -200,22 +200,22 @@ name-id-format.tooltip=El formato de NameID que se usar\u00E1 para el t\u00EDtul
|
|||
root-url=URL ra\u00EDz
|
||||
root-url.tooltip=URL ra\u00EDz a\u00F1adida a las URLs relativas
|
||||
valid-redirect-uris=URIs de redirecci\u00F3n v\u00E1lidas
|
||||
valid-redirect-uris.tooltip=Patr\u00F3n de URI v\u00E1lida para la cual un navegador puede solicitar la redirecci\u00F3n tras un inicio o cierre de sesi\u00F3n completado. Se permiten comodines simples p.ej. 'http://example.com/*'. Tambi\u00E9n se pueden indicar rutas relativas p.ej. '/my/relative/path/*'. Las rutas relativas generar\u00E1n una URI de redirecci\u00F3n usando el host y puerto de la petici\u00F3n. Para SAML, se deben fijar patrones de URI v\u00E1lidos si quieres confiar en la URL del servicio del consumidor indicada en la petici\u00F3n de inicio de sesi\u00F3n.
|
||||
valid-redirect-uris.tooltip=Patr\u00F3n de URI v\u00E1lida para la cual un navegador puede solicitar la redirecci\u00F3n tras un inicio o cierre de sesi\u00F3n completado. Se permiten comodines simples p.ej. ''http://example.com/*''. Tambi\u00E9n se pueden indicar rutas relativas p.ej. ''/my/relative/path/*''. Las rutas relativas generar\u00E1n una URI de redirecci\u00F3n usando el host y puerto de la petici\u00F3n. Para SAML, se deben fijar patrones de URI v\u00E1lidos si quieres confiar en la URL del servicio del consumidor indicada en la petici\u00F3n de inicio de sesi\u00F3n.
|
||||
base-url.tooltip=URL por defecto para usar cuando el servidor de autorizaci\u00F3n necesita redirigir o enviar de vuelta al cliente.
|
||||
admin-url=URL de administraci\u00F3n
|
||||
admin-url.tooltip=URL a la interfaz de administraci\u00F3n del cliente. Fija este valor si el cliente soporta el adaptador de REST. Esta API REST permite al servidor de autenticaci\u00F3n enviar al cliente pol\u00EDticas de revocaci\u00F3n y otras tareas administrativas. Normalment se fija a la URL base del cliente.
|
||||
master-saml-processing-url=URL principal de procesamiento SAML
|
||||
master-saml-processing-url.tooltip=Si est\u00E1 configurada, esta URL se usar\u00E1 para cada enlace al proveedor del servicio del consumidor de aserciones y servicios de desconexi\u00F3n \u00FAnicos. Puede ser sobreescrito de forma individual para cada enlace y servicio en el punto final de configuraci\u00F3n fina de SAML.
|
||||
idp-sso-url-ref=Nombre de la URL de un SSO iniciado por el IDP
|
||||
idp-sso-url-ref.tooltip=Nombre del fragmento de la URL para referenciar al cliente cuando quieres un SSO iniciado por el IDP. Dejanto esto vac\u00EDo deshabilita los SSO iniciados por el IDP. La URL referenciada desde el navegador ser\u00E1: {server-root}/realms/{realm}/protocol/saml/clients/{client-url-name}
|
||||
idp-sso-url-ref.tooltip=Nombre del fragmento de la URL para referenciar al cliente cuando quieres un SSO iniciado por el IDP. Dejando esto vac\u00EDo deshabilita los SSO iniciados por el IDP. La URL referenciada desde el navegador ser\u00E1: {server-root}/realms/{realm}/protocol/saml/clients/{client-url-name}
|
||||
idp-sso-relay-state=Estado de retransmisi\u00F3n de un SSO iniciado por el IDP
|
||||
idp-sso-relay-state.tooltip=Estado de retransmisi\u00F3n que quiees enviar con una petici\u00F3n SAML cuando se inicia un SSO inidicado por el IDP
|
||||
web-origins=Origenes web
|
||||
web-origins.tooltip=Origenes CORS permitidos. Para permitir todos los or\u00EDgenes de URIs de redirecci\u00F3n v\u00E1lidas a\u00F1ade '+'. Para permitir todos los or\u00EDgenes a\u00F1ade '*'.
|
||||
idp-sso-relay-state.tooltip=Estado de retransmisi\u00F3n que quieres enviar con una petici\u00F3n SAML cuando se inicia un SSO iniciado por el IDP
|
||||
web-origins=Or\u00EDgenes web
|
||||
web-origins.tooltip=Or\u00EDgenes CORS permitidos. Para permitir todos los or\u00EDgenes de URIs de redirecci\u00F3n v\u00E1lidas a\u00F1ade ''+''. Para permitir todos los or\u00EDgenes a\u00F1ade ''*''.
|
||||
fine-saml-endpoint-conf=Fine Grain SAML Endpoint Configuration
|
||||
fine-saml-endpoint-conf.tooltip=Expande esta secci\u00F3n para configurar las URL exactas para Assertion Consumer y Single Logout Service.
|
||||
assertion-consumer-post-binding-url=Assertion Consumer Service POST Binding URL
|
||||
assertion-consumer-post-binding-url.tooltip=SAML POST Binding URL for the client's assertion consumer service (login responses). You can leave this blank if you do not have a URL for this binding.
|
||||
assertion-consumer-post-binding-url.tooltip=SAML POST Binding URL for the client''s assertion consumer service (login responses). You can leave this blank if you do not have a URL for this binding.
|
||||
assertion-consumer-redirect-binding-url=Assertion Consumer Service Redirect Binding URL
|
||||
assertion-consumer-redirect-binding-url.tooltip=Assertion Consumer Service Redirect Binding URL
|
||||
logout-service-binding-post-url=URL de enlace SAML POST para la desconexi\u00F3n
|
||||
|
@ -252,7 +252,7 @@ client-authenticator=Cliente autenticador
|
|||
client-authenticator.tooltip=Cliente autenticador usado para autenticar este cliente contra el servidor Keycloak
|
||||
certificate.tooltip=Certificado de clinete para validar los JWT emitidos por este cliente y firmados con la clave privada del cliente de tu almac\u00E9n de claves.
|
||||
no-client-certificate-configured=No se ha configurado el certificado de cliente
|
||||
gen-new-keys-and-cert=Genearr nuevas claves y certificado
|
||||
gen-new-keys-and-cert=Generar nuevas claves y certificado
|
||||
import-certificate=Importar Certificado
|
||||
gen-client-private-key=Generar clave privada de cliente
|
||||
generate-private-key=Generar clave privada
|
||||
|
@ -278,7 +278,7 @@ no-client-roles-available=No hay roles de cliente disponibles
|
|||
scope-param-required=Par\u00E1metro de \u00E1mbito obligatorio
|
||||
scope-param-required.tooltip=Este rol solo ser\u00E1 concedido si el par\u00E1metro de \u00E1mbito con el nombre del rol es usado durante la petici\u00F3n de autorizaci\u00F3n/obtenci\u00F3n de token.
|
||||
composite-roles=Roles compuestos
|
||||
composite-roles.tooltip=Cuanto este rol es asignado/desasignado a un usuario cualquier rol asociado con \u00E9l ser\u00E1 asignado/desasignado de forma impl\u00EDcita.
|
||||
composite-roles.tooltip=Cuando este rol es asignado/desasignado a un usuario cualquier rol asociado con \u00E9l ser\u00E1 asignado/desasignado de forma impl\u00EDcita.
|
||||
realm-roles=Roles de dominio
|
||||
available-roles=Roles Disponibles
|
||||
add-selected=A\u00F1adir seleccionado
|
||||
|
@ -317,7 +317,7 @@ test-cluster-availability=Probar disponibilidad del cluster
|
|||
last-registration=\u00DAltimo registro
|
||||
node-host=Host del nodo
|
||||
no-registered-cluster-nodes=No hay nodos de cluster registrados disponibles
|
||||
cluster-nodes=Nodos de cluster
|
||||
cluster-nodes=Nodos de cl\u00FAster
|
||||
add-node=A\u00F1adir Nodo
|
||||
active-sessions.tooltip=N\u00FAmero total de sesiones activas para este cliente.
|
||||
show-sessions=Mostrar sesiones
|
||||
|
@ -362,7 +362,7 @@ protocol=Protocolo
|
|||
protocol.tooltip=Protocolo.
|
||||
id=ID
|
||||
mapper.name.tooltip=Nombre del asignador.
|
||||
mapper.consent-required.tooltip=Cuando se concede acceso temporal, \u00BFes necesario el consentimiento del usuario para proporcinar estos datos al cliente cliente?
|
||||
mapper.consent-required.tooltip=Cuando se concede acceso temporal, \u00BFes necesario el consentimiento del usuario para proporcinar estos datos al cliente?
|
||||
consent-text=Texto del consentimiento
|
||||
consent-text.tooltip=Texto para mostrar en la p\u00E1gina de consentimiento.
|
||||
mapper-type=Tipo de asignador
|
||||
|
@ -381,14 +381,14 @@ identity-provider.enabled.tooltip=Habilita/deshabilita este proveedor de identid
|
|||
authenticate-by-default=Autenticar por defecto
|
||||
identity-provider.authenticate-by-default.tooltip=Indica si este proveedor deber\u00EDa ser probado por defecto para autenticacaci\u00F3n incluso antes de mostrar la p\u00E1gina de inicio de sesi\u00F3n.
|
||||
store-tokens=Almacenar tokens
|
||||
identity-provider.store-tokens.tooltip=Hablitar/deshabilitar si los tokens deben ser almacenados despu\u00E9s de autenticar a los usuarios.
|
||||
identity-provider.store-tokens.tooltip=Habiltar/deshabilitar si los tokens deben ser almacenados despu\u00E9s de autenticar a los usuarios.
|
||||
stored-tokens-readable=Tokens almacenados legibles
|
||||
identity-provider.stored-tokens-readable.tooltip=Habilitar/deshabilitar is los nuevos usuarios pueden leear los tokens almacenados. Esto asigna el rol 'broker.read-token'.
|
||||
identity-provider.stored-tokens-readable.tooltip=Habilitar/deshabilitar si los nuevos usuarios pueden leer los tokens almacenados. Esto asigna el rol ''broker.read-token''.
|
||||
update-profile-on-first-login=Actualizar perfil en el primer inicio de sesi\u00F3n
|
||||
on=Activado
|
||||
on-missing-info=Si falta informaci\u00F3n
|
||||
off=Desactivado
|
||||
update-profile-on-first-login.tooltip=Define condiciones bajos las cuales un usuario tiene que actualizar su perfil durante el primer inicio de sesi\u00F3n.
|
||||
update-profile-on-first-login.tooltip=Define condiciones bajo las cuales un usuario tiene que actualizar su perfil durante el primer inicio de sesi\u00F3n.
|
||||
trust-email=Confiar en el email
|
||||
trust-email.tooltip=Si est\u00E1 habilitado, el email recibido de este proveedor no se verificar\u00E1 aunque la verificaci\u00F3n est\u00E9 habilitada para el dominio.
|
||||
gui-order.tooltip=N\u00FAmero que define el orden del proveedor en la interfaz gr\u00E1fica (GUI) (ej. en la p\u00E1gina de inicio de sesi\u00F3n)
|
||||
|
@ -403,7 +403,7 @@ identity-provider.logout-url.tooltip=Punto de cierre de sesi\u00F3n para usar en
|
|||
backchannel-logout=Backchannel Logout
|
||||
backchannel-logout.tooltip=Does the external IDP support backchannel logout?
|
||||
user-info-url=URL de informaci\u00F3n de usuario
|
||||
user-info-url.tooltip=.La URL de informaci\u00F3n de usuario. Opcional
|
||||
user-info-url.tooltip=La URL de informaci\u00F3n de usuario. Opcional.
|
||||
identity-provider.client-id.tooltip=El cliente o identificador de cliente registrado en el proveedor de identidad.
|
||||
client-secret=Secreto de Cliente
|
||||
show-secret=Mostrar secreto
|
||||
|
@ -412,7 +412,7 @@ client-secret.tooltip=El cliente o el secreto de cliente registrado en el provee
|
|||
issuer=Emisor
|
||||
issuer.tooltip=El identificador del emisor para el emisor de la respuesta. Si no se indica, no se realizar\u00E1 ninguna validaci\u00F3n.
|
||||
default-scopes=\u00C1mbitos por defecto
|
||||
identity-provider.default-scopes.tooltip=Los \u00E1mbitos que se enviar\u00E1n cuando se solicite autorizaci\u00F3n. Puede ser una lista de \u00E1mbitos separados por espacios. El valor por defecto es 'openid'.
|
||||
identity-provider.default-scopes.tooltip=Los \u00E1mbitos que se enviar\u00E1n cuando se solicite autorizaci\u00F3n. Puede ser una lista de \u00E1mbitos separados por espacios. El valor por defecto es ''openid''.
|
||||
prompt=Prompt
|
||||
unspecified.option=no especificado
|
||||
none.option=ninguno
|
||||
|
@ -431,7 +431,7 @@ identity-provider.import-from-url.tooltip=Importar metadatos desde un descriptor
|
|||
import-from-file=Importar desde archivo
|
||||
identity-provider.import-from-file.tooltip=Importar metadatos desde un descriptor de un proveedor de identidad (IDP) descargado.
|
||||
saml-config=Configuraci\u00F3n SAML
|
||||
identity-provider.saml-config.tooltip=Configurci\u00F3n de proveedor SAML e IDP externo
|
||||
identity-provider.saml-config.tooltip=Configuraci\u00F3n de proveedor SAML e IDP externo
|
||||
single-signon-service-url=URL de servicio de conexi\u00F3n \u00FAnico (SSO)
|
||||
saml.single-signon-service-url.tooltip=La URL que debe ser usada para enviar peticiones de autenticaci\u00F3n (SAML AuthnRequest).
|
||||
single-logout-service-url=URL de servicio de desconexi\u00F3n \u00FAnico
|
||||
|
@ -441,7 +441,7 @@ nameid-policy-format.tooltip=Indica la referencia a la URI correspondiente a un
|
|||
http-post-binding-response=HTTP-POST enlace de respuesta
|
||||
http-post-binding-response.tooltip=Indica si se reponde a las peticiones usando HTTP-POST. Si no est\u00E1 activado, se usa HTTP-REDIRECT.
|
||||
http-post-binding-for-authn-request=HTTP-POST para AuthnRequest
|
||||
http-post-binding-for-authn-request.tooltip=Indica si AuthnRequest debe ser envianda usando HTTP-POST. Si no est\u00E1 activado se hace HTTP-REDIRECT.
|
||||
http-post-binding-for-authn-request.tooltip=Indica si AuthnRequest debe ser enviada usando HTTP-POST. Si no est\u00E1 activado se hace HTTP-REDIRECT.
|
||||
want-authn-requests-signed=Firmar AuthnRequests
|
||||
want-authn-requests-signed.tooltip=Indica si el proveedor de identidad espera recibir firmadas las AuthnRequest.
|
||||
force-authentication=Forzar autenticaci\u00F3n
|
||||
|
@ -463,4 +463,4 @@ realm=Dominio
|
|||
identity-provider-mappers=Asignadores de proveedores de identidad (IDP)
|
||||
create-identity-provider-mapper=Crear asignador de proveedor de identidad (IDP)
|
||||
add-identity-provider-mapper=A\u00F1adir asignador de proveedor de identidad
|
||||
client.description.tooltip=Indica la descripci\u00F3n del cliente. Por ejemplo 'My Client for TimeSheets'. Tambi\u00E9n soporta claves para valores localizzados. Por ejemplo: ${my_client_description}
|
||||
client.description.tooltip=Indica la descripci\u00F3n del cliente. Por ejemplo ''My Client for TimeSheets''. Tambi\u00E9n soporta claves para valores localizados. Por ejemplo: ${my_client_description}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
invalidPasswordMinLengthMessage=Contrase\u00F1a incorrecta: longitud m\u00EDnima {0}.
|
||||
invalidPasswordMinLowerCaseCharsMessage=Contrase\u00F1a incorrecta: debe contener al menos {0} letras min\u00FAsculas.
|
||||
invalidPasswordMinDigitsMessage=Contrase\u00F1a incorrecta: debe contaner al menos {0} caracteres num\u00E9ricos.
|
||||
invalidPasswordMinDigitsMessage=Contrase\u00F1a incorrecta: debe contener al menos {0} caracteres num\u00E9ricos.
|
||||
invalidPasswordMinUpperCaseCharsMessage=Contrase\u00F1a incorrecta: debe contener al menos {0} letras may\u00FAsculas.
|
||||
invalidPasswordMinSpecialCharsMessage=Contrase\u00F1a incorrecta: debe contener al menos {0} caracteres especiales.
|
||||
invalidPasswordNotUsernameMessage=Contrase\u00F1a incorrecta: no puede ser igual al nombre de usuario.
|
||||
|
|
|
@ -327,6 +327,8 @@ module.controller('RealmLoginSettingsCtrl', function($scope, Current, Realm, rea
|
|||
});
|
||||
|
||||
module.controller('RealmOtpPolicyCtrl', function($scope, Current, Realm, realm, serverInfo, $http, $location, Dialog, Notifications) {
|
||||
$scope.optionsDigits = [ 6, 8 ];
|
||||
|
||||
genericRealmUpdate($scope, Current, Realm, realm, serverInfo, $http, $location, Dialog, Notifications, "/realms/" + realm.realm + "/authentication/otp-policy");
|
||||
});
|
||||
|
||||
|
|
|
@ -34,9 +34,7 @@
|
|||
<label class="col-md-2 control-label" for="digits">Number of Digits</label>
|
||||
<div class="col-md-2">
|
||||
<div>
|
||||
<select id="digits" ng-model="realm.otpPolicyDigits" class="form-control">
|
||||
<option value="6">6</option>
|
||||
<option value="8">8</option>
|
||||
<select id="digits" ng-model="realm.otpPolicyDigits" class="form-control" ng-options="item as item for item in optionsDigits">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
|
6
integration/adapter-core/src/main/java/org/keycloak/adapters/BasicAuthRequestAuthenticator.java
Normal file → Executable file
6
integration/adapter-core/src/main/java/org/keycloak/adapters/BasicAuthRequestAuthenticator.java
Normal file → Executable file
|
@ -33,7 +33,7 @@ public class BasicAuthRequestAuthenticator extends BearerTokenRequestAuthenticat
|
|||
public AuthOutcome authenticate(HttpFacade exchange) {
|
||||
List<String> authHeaders = exchange.getRequest().getHeaders("Authorization");
|
||||
if (authHeaders == null || authHeaders.size() == 0) {
|
||||
challenge = challengeResponse(exchange, null, null);
|
||||
challenge = challengeResponse(exchange, OIDCAuthenticationError.Reason.NO_AUTHORIZATION_HEADER, null, null);
|
||||
return AuthOutcome.NOT_ATTEMPTED;
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@ public class BasicAuthRequestAuthenticator extends BearerTokenRequestAuthenticat
|
|||
}
|
||||
|
||||
if (tokenString == null) {
|
||||
challenge = challengeResponse(exchange, null, null);
|
||||
challenge = challengeResponse(exchange, OIDCAuthenticationError.Reason.INVALID_TOKEN, null, null);
|
||||
return AuthOutcome.NOT_ATTEMPTED;
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,7 @@ public class BasicAuthRequestAuthenticator extends BearerTokenRequestAuthenticat
|
|||
tokenString = atr.getToken();
|
||||
} catch (Exception e) {
|
||||
log.debug("Failed to obtain token", e);
|
||||
challenge = challengeResponse(exchange, "no_token", e.getMessage());
|
||||
challenge = challengeResponse(exchange, OIDCAuthenticationError.Reason.INVALID_TOKEN, "no_token", e.getMessage());
|
||||
return AuthOutcome.FAILED;
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ public class BearerTokenRequestAuthenticator {
|
|||
public AuthOutcome authenticate(HttpFacade exchange) {
|
||||
List<String> authHeaders = exchange.getRequest().getHeaders("Authorization");
|
||||
if (authHeaders == null || authHeaders.size() == 0) {
|
||||
challenge = challengeResponse(exchange, null, null);
|
||||
challenge = challengeResponse(exchange, OIDCAuthenticationError.Reason.NO_BEARER_TOKEN, null, null);
|
||||
return AuthOutcome.NOT_ATTEMPTED;
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,7 @@ public class BearerTokenRequestAuthenticator {
|
|||
}
|
||||
|
||||
if (tokenString == null) {
|
||||
challenge = challengeResponse(exchange, null, null);
|
||||
challenge = challengeResponse(exchange, OIDCAuthenticationError.Reason.NO_BEARER_TOKEN, null, null);
|
||||
return AuthOutcome.NOT_ATTEMPTED;
|
||||
}
|
||||
|
||||
|
@ -70,12 +70,12 @@ public class BearerTokenRequestAuthenticator {
|
|||
token = RSATokenVerifier.verifyToken(tokenString, deployment.getRealmKey(), deployment.getRealmInfoUrl());
|
||||
} catch (VerificationException e) {
|
||||
log.error("Failed to verify token", e);
|
||||
challenge = challengeResponse(exchange, "invalid_token", e.getMessage());
|
||||
challenge = challengeResponse(exchange, OIDCAuthenticationError.Reason.INVALID_TOKEN, "invalid_token", e.getMessage());
|
||||
return AuthOutcome.FAILED;
|
||||
}
|
||||
if (token.getIssuedAt() < deployment.getNotBefore()) {
|
||||
log.error("Stale token");
|
||||
challenge = challengeResponse(exchange, "invalid_token", "Stale token");
|
||||
challenge = challengeResponse(exchange, OIDCAuthenticationError.Reason.STALE_TOKEN, "invalid_token", "Stale token");
|
||||
return AuthOutcome.FAILED;
|
||||
}
|
||||
boolean verifyCaller = false;
|
||||
|
@ -112,11 +112,6 @@ public class BearerTokenRequestAuthenticator {
|
|||
|
||||
protected AuthChallenge clientCertChallenge() {
|
||||
return new AuthChallenge() {
|
||||
@Override
|
||||
public boolean errorPage() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getResponseCode() {
|
||||
return 0;
|
||||
|
@ -131,7 +126,7 @@ public class BearerTokenRequestAuthenticator {
|
|||
}
|
||||
|
||||
|
||||
protected AuthChallenge challengeResponse(HttpFacade facade, String error, String description) {
|
||||
protected AuthChallenge challengeResponse(HttpFacade facade, final OIDCAuthenticationError.Reason reason, final String error, final String description) {
|
||||
StringBuilder header = new StringBuilder("Bearer realm=\"");
|
||||
header.append(deployment.getRealm()).append("\"");
|
||||
if (error != null) {
|
||||
|
@ -142,11 +137,6 @@ public class BearerTokenRequestAuthenticator {
|
|||
}
|
||||
final String challenge = header.toString();
|
||||
return new AuthChallenge() {
|
||||
@Override
|
||||
public boolean errorPage() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getResponseCode() {
|
||||
return 401;
|
||||
|
@ -154,8 +144,10 @@ public class BearerTokenRequestAuthenticator {
|
|||
|
||||
@Override
|
||||
public boolean challenge(HttpFacade facade) {
|
||||
facade.getResponse().setStatus(401);
|
||||
OIDCAuthenticationError error = new OIDCAuthenticationError(reason, description);
|
||||
facade.getRequest().setError(error);
|
||||
facade.getResponse().addHeader("WWW-Authenticate", challenge);
|
||||
facade.getResponse().sendError(401);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -174,15 +174,10 @@ public class OAuthRequestAuthenticator {
|
|||
final String state = getStateCode();
|
||||
final String redirect = getRedirectUri(state);
|
||||
if (redirect == null) {
|
||||
return challenge(403);
|
||||
return challenge(403, OIDCAuthenticationError.Reason.NO_REDIRECT_URI, null);
|
||||
}
|
||||
return new AuthChallenge() {
|
||||
|
||||
@Override
|
||||
public boolean errorPage() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getResponseCode() {
|
||||
return 0;
|
||||
|
@ -205,7 +200,7 @@ public class OAuthRequestAuthenticator {
|
|||
|
||||
if (stateCookie == null) {
|
||||
log.warn("No state cookie");
|
||||
return challenge(400);
|
||||
return challenge(400, OIDCAuthenticationError.Reason.INVALID_STATE_COOKIE, null);
|
||||
}
|
||||
// reset the cookie
|
||||
log.debug("** reseting application state cookie");
|
||||
|
@ -215,13 +210,13 @@ public class OAuthRequestAuthenticator {
|
|||
String state = getQueryParamValue(OAuth2Constants.STATE);
|
||||
if (state == null) {
|
||||
log.warn("state parameter was null");
|
||||
return challenge(400);
|
||||
return challenge(400, OIDCAuthenticationError.Reason.INVALID_STATE_COOKIE, null);
|
||||
}
|
||||
if (!state.equals(stateCookieValue)) {
|
||||
log.warn("state parameter invalid");
|
||||
log.warn("cookie: " + stateCookieValue);
|
||||
log.warn("queryParam: " + state);
|
||||
return challenge(400);
|
||||
return challenge(400, OIDCAuthenticationError.Reason.INVALID_STATE_COOKIE, null);
|
||||
}
|
||||
return null;
|
||||
|
||||
|
@ -235,7 +230,7 @@ public class OAuthRequestAuthenticator {
|
|||
if (error != null) {
|
||||
// todo how do we send a response?
|
||||
log.warn("There was an error: " + error);
|
||||
challenge = challenge(400);
|
||||
challenge = challenge(400, OIDCAuthenticationError.Reason.OAUTH_ERROR, error);
|
||||
return AuthOutcome.FAILED;
|
||||
} else {
|
||||
log.debug("redirecting to auth server");
|
||||
|
@ -253,13 +248,8 @@ public class OAuthRequestAuthenticator {
|
|||
|
||||
}
|
||||
|
||||
protected AuthChallenge challenge(final int code) {
|
||||
protected AuthChallenge challenge(final int code, final OIDCAuthenticationError.Reason reason, final String description) {
|
||||
return new AuthChallenge() {
|
||||
@Override
|
||||
public boolean errorPage() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getResponseCode() {
|
||||
return code;
|
||||
|
@ -267,6 +257,8 @@ public class OAuthRequestAuthenticator {
|
|||
|
||||
@Override
|
||||
public boolean challenge(HttpFacade exchange) {
|
||||
OIDCAuthenticationError error = new OIDCAuthenticationError(reason, description);
|
||||
exchange.getRequest().setError(error);
|
||||
exchange.getResponse().sendError(code);
|
||||
return true;
|
||||
}
|
||||
|
@ -289,7 +281,7 @@ public class OAuthRequestAuthenticator {
|
|||
// abort if not HTTPS
|
||||
if (!isRequestSecure() && deployment.getSslRequired().isRequired(facade.getRequest().getRemoteAddr())) {
|
||||
log.error("Adapter requires SSL. Request: " + facade.getRequest().getURI());
|
||||
return challenge(403);
|
||||
return challenge(403, OIDCAuthenticationError.Reason.SSL_REQUIRED, null);
|
||||
}
|
||||
|
||||
log.debug("checking state cookie for after code");
|
||||
|
@ -308,11 +300,11 @@ public class OAuthRequestAuthenticator {
|
|||
if (failure.getStatus() == 400 && failure.getError() != null) {
|
||||
log.error(" " + failure.getError());
|
||||
}
|
||||
return challenge(403);
|
||||
return challenge(403, OIDCAuthenticationError.Reason.CODE_TO_TOKEN_FAILURE, null);
|
||||
|
||||
} catch (IOException e) {
|
||||
log.error("failed to turn code into token", e);
|
||||
return challenge(403);
|
||||
return challenge(403, OIDCAuthenticationError.Reason.CODE_TO_TOKEN_FAILURE, null);
|
||||
}
|
||||
|
||||
tokenString = tokenResponse.getToken();
|
||||
|
@ -331,14 +323,14 @@ public class OAuthRequestAuthenticator {
|
|||
log.debug("Token Verification succeeded!");
|
||||
} catch (VerificationException e) {
|
||||
log.error("failed verification of token: " + e.getMessage());
|
||||
return challenge(403);
|
||||
return challenge(403, OIDCAuthenticationError.Reason.INVALID_TOKEN, null);
|
||||
}
|
||||
if (tokenResponse.getNotBeforePolicy() > deployment.getNotBefore()) {
|
||||
deployment.setNotBefore(tokenResponse.getNotBeforePolicy());
|
||||
}
|
||||
if (token.getIssuedAt() < deployment.getNotBefore()) {
|
||||
log.error("Stale token");
|
||||
return challenge(403);
|
||||
return challenge(403, OIDCAuthenticationError.Reason.STALE_TOKEN, null);
|
||||
}
|
||||
log.debug("successful authenticated");
|
||||
return null;
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
package org.keycloak.adapters;
|
||||
|
||||
import org.keycloak.adapters.spi.AuthenticationError;
|
||||
|
||||
/**
|
||||
* Object that describes the OIDC error that happened.
|
||||
*
|
||||
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
|
||||
* @version $Revision: 1 $
|
||||
*/
|
||||
public class OIDCAuthenticationError implements AuthenticationError {
|
||||
public static enum Reason {
|
||||
NO_BEARER_TOKEN,
|
||||
NO_REDIRECT_URI,
|
||||
INVALID_STATE_COOKIE,
|
||||
OAUTH_ERROR,
|
||||
SSL_REQUIRED,
|
||||
CODE_TO_TOKEN_FAILURE,
|
||||
INVALID_TOKEN,
|
||||
STALE_TOKEN,
|
||||
NO_AUTHORIZATION_HEADER
|
||||
}
|
||||
|
||||
private Reason reason;
|
||||
private String description;
|
||||
|
||||
public OIDCAuthenticationError(Reason reason, String description) {
|
||||
this.reason = reason;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public Reason getReason() {
|
||||
return reason;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
}
|
|
@ -13,15 +13,7 @@ public interface AuthChallenge {
|
|||
boolean challenge(HttpFacade exchange);
|
||||
|
||||
/**
|
||||
* Whether or not an error page should be displayed if possible along with the challenge
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean errorPage();
|
||||
|
||||
/**
|
||||
* If errorPage is true, this is the response code the challenge will send. This is used by platforms
|
||||
* that call HttpServletResponse.sendError() to forward to error page.
|
||||
* Some platforms need the error code that will be sent (i.e. Undertow)
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
package org.keycloak.adapters.spi;
|
||||
|
||||
/**
|
||||
* Common marker interface used by keycloak client adapters when there is an error. For servlets, you'll be able
|
||||
* to extract this error from the HttpServletRequest.getAttribute(AuthenticationError.class.getName()). Each protocol
|
||||
* will have their own subclass of this interface.
|
||||
*
|
||||
*
|
||||
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
|
||||
* @version $Revision: 1 $
|
||||
*/
|
||||
public interface AuthenticationError {
|
||||
}
|
|
@ -47,6 +47,8 @@ public interface HttpFacade {
|
|||
InputStream getInputStream();
|
||||
|
||||
String getRemoteAddr();
|
||||
void setError(AuthenticationError error);
|
||||
void setError(LogoutError error);
|
||||
}
|
||||
|
||||
interface Response {
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
package org.keycloak.adapters.spi;
|
||||
|
||||
/**
|
||||
* Common marker interface used by keycloak client adapters when there is an error. For servlets, you'll be able
|
||||
* to extract this error from the HttpServletRequest.getAttribute(LogoutError.class.getName()). Each protocol
|
||||
* will have their own subclass of this interface.
|
||||
*
|
||||
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
|
||||
* @version $Revision: 1 $
|
||||
*/
|
||||
public interface LogoutError {
|
||||
}
|
|
@ -17,6 +17,5 @@
|
|||
<module>as7-adapter-spi</module>
|
||||
<module>as7-adapter</module>
|
||||
<module>as7-subsystem</module>
|
||||
<module>as7-server-subsystem</module>
|
||||
</modules>
|
||||
</project>
|
|
@ -12,6 +12,8 @@ import javax.ws.rs.core.SecurityContext;
|
|||
|
||||
import org.keycloak.KeycloakSecurityContext;
|
||||
import org.keycloak.adapters.OIDCHttpFacade;
|
||||
import org.keycloak.adapters.spi.AuthenticationError;
|
||||
import org.keycloak.adapters.spi.LogoutError;
|
||||
import org.keycloak.common.util.HostUtils;
|
||||
|
||||
/**
|
||||
|
@ -93,6 +95,17 @@ public class JaxrsHttpFacade implements OIDCHttpFacade {
|
|||
// TODO: implement properly
|
||||
return HostUtils.getIpAddress();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setError(AuthenticationError error) {
|
||||
requestContext.setProperty(AuthenticationError.class.getName(), error);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setError(LogoutError error) {
|
||||
requestContext.setProperty(LogoutError.class.getName(), error);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
protected class ResponseFacade implements OIDCHttpFacade.Response {
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package org.keycloak.adapters.jetty.spi;
|
||||
|
||||
import org.keycloak.adapters.spi.AuthenticationError;
|
||||
import org.keycloak.adapters.spi.HttpFacade;
|
||||
import org.keycloak.adapters.spi.LogoutError;
|
||||
import org.keycloak.common.util.MultivaluedHashMap;
|
||||
import org.keycloak.common.util.UriUtils;
|
||||
|
||||
|
@ -125,6 +127,18 @@ public class JettyHttpFacade implements HttpFacade {
|
|||
public String getRemoteAddr() {
|
||||
return request.getRemoteAddr();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setError(AuthenticationError error) {
|
||||
request.setAttribute(AuthenticationError.class.getName(), error);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setError(LogoutError error) {
|
||||
request.setAttribute(LogoutError.class.getName(), error);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected class ResponseFacade implements Response {
|
||||
|
|
|
@ -265,15 +265,6 @@ public abstract class AbstractKeycloakJettyAuthenticator extends LoginAuthentica
|
|||
AuthChallenge challenge = authenticator.getChallenge();
|
||||
if (challenge != null) {
|
||||
challenge.challenge(facade);
|
||||
if (challenge.errorPage() && errorPage != null) {
|
||||
Response response = (Response)res;
|
||||
try {
|
||||
response.sendRedirect(response.encodeRedirectURL(URIUtil.addPaths(request.getContextPath(), errorPage)));
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return Authentication.SEND_CONTINUE;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package org.keycloak.adapters.servlet;
|
||||
|
||||
import org.keycloak.adapters.spi.AuthenticationError;
|
||||
import org.keycloak.adapters.spi.HttpFacade;
|
||||
import org.keycloak.adapters.spi.LogoutError;
|
||||
import org.keycloak.common.util.MultivaluedHashMap;
|
||||
import org.keycloak.common.util.ServerCookie;
|
||||
import org.keycloak.common.util.UriUtils;
|
||||
|
@ -111,6 +113,18 @@ public class ServletHttpFacade implements HttpFacade {
|
|||
public String getRemoteAddr() {
|
||||
return request.getRemoteAddr();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setError(AuthenticationError error) {
|
||||
request.setAttribute(AuthenticationError.class.getName(), error);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setError(LogoutError error) {
|
||||
request.setAttribute(LogoutError.class.getName(), error);
|
||||
}
|
||||
}
|
||||
public boolean isEnded() {
|
||||
return responseFacade.isEnded();
|
||||
|
|
|
@ -142,11 +142,6 @@ public class KeycloakOIDCFilter implements Filter {
|
|||
if (challenge != null) {
|
||||
log.fine("challenge");
|
||||
challenge.challenge(facade);
|
||||
if (challenge.errorPage()) {
|
||||
response.sendError(challenge.getResponseCode());
|
||||
return;
|
||||
}
|
||||
log.fine("sending challenge");
|
||||
return;
|
||||
}
|
||||
response.sendError(403);
|
||||
|
|
|
@ -6,6 +6,8 @@ import org.keycloak.adapters.AdapterDeploymentContext;
|
|||
import org.keycloak.adapters.KeycloakDeployment;
|
||||
import org.keycloak.adapters.OIDCHttpFacade;
|
||||
import org.keycloak.adapters.ServerRequest;
|
||||
import org.keycloak.adapters.spi.AuthenticationError;
|
||||
import org.keycloak.adapters.spi.LogoutError;
|
||||
import org.keycloak.jose.jws.JWSInput;
|
||||
import org.keycloak.representations.AccessTokenResponse;
|
||||
import org.keycloak.representations.IDToken;
|
||||
|
@ -237,6 +239,18 @@ public class ServletOAuthClient extends KeycloakDeploymentDelegateOAuthClient {
|
|||
public String getRemoteAddr() {
|
||||
return servletRequest.getRemoteAddr();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setError(AuthenticationError error) {
|
||||
servletRequest.setAttribute(AuthenticationError.class.getName(), error);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setError(LogoutError error) {
|
||||
servletRequest.setAttribute(LogoutError.class.getName(), error);
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
package org.keycloak.adapters.springsecurity.facade;
|
||||
|
||||
import org.keycloak.adapters.spi.AuthenticationError;
|
||||
import org.keycloak.adapters.spi.HttpFacade.Cookie;
|
||||
import org.keycloak.adapters.spi.HttpFacade.Request;
|
||||
import org.keycloak.adapters.spi.LogoutError;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
@ -109,4 +111,17 @@ class WrappedHttpServletRequest implements Request {
|
|||
public String getRemoteAddr() {
|
||||
return request.getRemoteAddr();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setError(AuthenticationError error) {
|
||||
request.setAttribute(AuthenticationError.class.getName(), error);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setError(LogoutError error) {
|
||||
request.setAttribute(LogoutError.class.getName(), error);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package org.keycloak.adapters.tomcat;
|
||||
|
||||
import org.keycloak.adapters.spi.AuthenticationError;
|
||||
import org.keycloak.adapters.spi.HttpFacade;
|
||||
import org.keycloak.adapters.spi.LogoutError;
|
||||
import org.keycloak.common.util.MultivaluedHashMap;
|
||||
import org.keycloak.common.util.ServerCookie;
|
||||
import org.keycloak.common.util.UriUtils;
|
||||
|
@ -125,6 +127,18 @@ public class CatalinaHttpFacade implements HttpFacade {
|
|||
public String getRemoteAddr() {
|
||||
return request.getRemoteAddr();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setError(AuthenticationError error) {
|
||||
request.setAttribute(AuthenticationError.class.getName(), error);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setError(LogoutError error) {
|
||||
request.setAttribute(LogoutError.class.getName(), error);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected class ResponseFacade implements Response {
|
||||
|
|
|
@ -195,12 +195,6 @@ public abstract class AbstractKeycloakAuthenticatorValve extends FormAuthenticat
|
|||
}
|
||||
AuthChallenge challenge = authenticator.getChallenge();
|
||||
if (challenge != null) {
|
||||
if (loginConfig == null) {
|
||||
loginConfig = request.getContext().getLoginConfig();
|
||||
}
|
||||
if (challenge.errorPage()) {
|
||||
if (forwardToErrorPageInternal(request, response, loginConfig))return false;
|
||||
}
|
||||
challenge.challenge(facade);
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -2,9 +2,13 @@ package org.keycloak.adapters.undertow;
|
|||
|
||||
import io.undertow.server.HttpServerExchange;
|
||||
import io.undertow.servlet.handlers.ServletRequestContext;
|
||||
import org.keycloak.adapters.spi.AuthenticationError;
|
||||
import org.keycloak.adapters.spi.HttpFacade;
|
||||
import org.keycloak.adapters.spi.LogoutError;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
|
||||
|
@ -18,6 +22,7 @@ public class ServletHttpFacade extends UndertowHttpFacade {
|
|||
super(exchange);
|
||||
final ServletRequestContext servletRequestContext = exchange.getAttachment(ServletRequestContext.ATTACHMENT_KEY);
|
||||
request = (HttpServletRequest)servletRequestContext.getServletRequest();
|
||||
response = (HttpServletResponse)servletRequestContext.getServletResponse();
|
||||
}
|
||||
|
||||
protected class RequestFacade extends UndertowHttpFacade.RequestFacade {
|
||||
|
@ -26,6 +31,47 @@ public class ServletHttpFacade extends UndertowHttpFacade {
|
|||
return request.getParameter(param);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setError(AuthenticationError error) {
|
||||
request.setAttribute(AuthenticationError.class.getName(), error);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setError(LogoutError error) {
|
||||
request.setAttribute(LogoutError.class.getName(), error);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected class ResponseFacade extends UndertowHttpFacade.ResponseFacade {
|
||||
// can't call sendError from a challenge. Undertow ends up calling send error.
|
||||
/*
|
||||
@Override
|
||||
public void sendError(int code) {
|
||||
try {
|
||||
response.sendError(code);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendError(int code, String message) {
|
||||
try {
|
||||
response.sendError(code, message);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Response getResponse() {
|
||||
return new ResponseFacade();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -2,9 +2,12 @@ package org.keycloak.adapters.undertow;
|
|||
|
||||
import io.undertow.server.HttpServerExchange;
|
||||
import io.undertow.server.handlers.CookieImpl;
|
||||
import io.undertow.util.AttachmentKey;
|
||||
import io.undertow.util.Headers;
|
||||
import io.undertow.util.HttpString;
|
||||
import org.keycloak.adapters.spi.AuthenticationError;
|
||||
import org.keycloak.adapters.spi.HttpFacade;
|
||||
import org.keycloak.adapters.spi.LogoutError;
|
||||
import org.keycloak.common.util.KeycloakUriBuilder;
|
||||
|
||||
import javax.security.cert.X509Certificate;
|
||||
|
@ -22,6 +25,9 @@ import java.util.Map;
|
|||
* @version $Revision: 1 $
|
||||
*/
|
||||
public class UndertowHttpFacade implements HttpFacade {
|
||||
public static final AttachmentKey<AuthenticationError> AUTH_ERROR_ATTACHMENT_KEY = AttachmentKey.create(AuthenticationError.class);
|
||||
public static final AttachmentKey<LogoutError> LOGOUT_ERROR_ATTACHMENT_KEY = AttachmentKey.create(LogoutError.class);
|
||||
|
||||
protected HttpServerExchange exchange;
|
||||
protected RequestFacade requestFacade = new RequestFacade();
|
||||
protected ResponseFacade responseFacade = new ResponseFacade();
|
||||
|
@ -127,6 +133,17 @@ public class UndertowHttpFacade implements HttpFacade {
|
|||
}
|
||||
return address.getHostAddress();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setError(AuthenticationError error) {
|
||||
exchange.putAttachment(AUTH_ERROR_ATTACHMENT_KEY, error);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setError(LogoutError error) {
|
||||
exchange.putAttachment(LOGOUT_ERROR_ATTACHMENT_KEY, error);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
protected class ResponseFacade implements Response {
|
||||
|
@ -173,7 +190,6 @@ public class UndertowHttpFacade implements HttpFacade {
|
|||
@Override
|
||||
public void sendError(int code) {
|
||||
exchange.setResponseCode(code);
|
||||
exchange.endExchange();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -56,11 +56,7 @@ public abstract class AbstractUndertowKeycloakAuthMech implements Authentication
|
|||
public ChallengeResult sendChallenge(HttpServerExchange exchange, SecurityContext securityContext) {
|
||||
AuthChallenge challenge = exchange.getAttachment(KEYCLOAK_CHALLENGE_ATTACHMENT_KEY);
|
||||
if (challenge != null) {
|
||||
if (challenge.errorPage() && errorPage != null) {
|
||||
Integer code = servePage(exchange, errorPage);
|
||||
return new ChallengeResult(true, code);
|
||||
}
|
||||
UndertowHttpFacade facade = new UndertowHttpFacade(exchange);
|
||||
UndertowHttpFacade facade = createFacade(exchange);
|
||||
if (challenge.challenge(facade)) {
|
||||
return new ChallengeResult(true, exchange.getResponseCode());
|
||||
}
|
||||
|
@ -68,6 +64,10 @@ public abstract class AbstractUndertowKeycloakAuthMech implements Authentication
|
|||
return new ChallengeResult(false);
|
||||
}
|
||||
|
||||
public UndertowHttpFacade createFacade(HttpServerExchange exchange) {
|
||||
return new OIDCUndertowHttpFacade(exchange);
|
||||
}
|
||||
|
||||
protected Integer servePage(final HttpServerExchange exchange, final String location) {
|
||||
sendRedirect(exchange, location);
|
||||
return StatusCodes.TEMPORARY_REDIRECT;
|
||||
|
@ -89,7 +89,7 @@ public abstract class AbstractUndertowKeycloakAuthMech implements Authentication
|
|||
if (notification.getEventType() != SecurityNotification.EventType.LOGGED_OUT) return;
|
||||
|
||||
HttpServerExchange exchange = notification.getExchange();
|
||||
UndertowHttpFacade facade = new OIDCUndertowHttpFacade(exchange);
|
||||
UndertowHttpFacade facade = createFacade(exchange);
|
||||
KeycloakDeployment deployment = deploymentContext.resolveDeployment(facade);
|
||||
KeycloakSecurityContext ksc = exchange.getAttachment(OIDCUndertowHttpFacade.KEYCLOAK_SECURITY_CONTEXT_KEY);
|
||||
if (ksc != null && ksc instanceof RefreshableKeycloakSecurityContext) {
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* Copyright 2014 Red Hat Inc. and/or its affiliates and other contributors
|
||||
* as indicated by the @author tags. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
package org.keycloak.adapters.undertow;
|
||||
|
||||
import io.undertow.server.HttpServerExchange;
|
||||
import io.undertow.util.AttachmentKey;
|
||||
import org.keycloak.KeycloakSecurityContext;
|
||||
import org.keycloak.adapters.OIDCHttpFacade;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
|
||||
* @version $Revision: 1 $
|
||||
*/
|
||||
public class OIDCServletUndertowHttpFacade extends ServletHttpFacade implements OIDCHttpFacade {
|
||||
public static final AttachmentKey<KeycloakSecurityContext> KEYCLOAK_SECURITY_CONTEXT_KEY = AttachmentKey.create(KeycloakSecurityContext.class);
|
||||
|
||||
public OIDCServletUndertowHttpFacade(HttpServerExchange exchange) {
|
||||
super(exchange);
|
||||
}
|
||||
|
||||
@Override
|
||||
public KeycloakSecurityContext getSecurityContext() {
|
||||
return exchange.getAttachment(KEYCLOAK_SECURITY_CONTEXT_KEY);
|
||||
}
|
||||
|
||||
}
|
|
@ -79,7 +79,7 @@ public class ServletKeycloakAuthMech extends AbstractUndertowKeycloakAuthMech {
|
|||
|
||||
@Override
|
||||
public AuthenticationMechanismOutcome authenticate(HttpServerExchange exchange, SecurityContext securityContext) {
|
||||
UndertowHttpFacade facade = new OIDCUndertowHttpFacade(exchange);
|
||||
UndertowHttpFacade facade = createFacade(exchange);
|
||||
KeycloakDeployment deployment = deploymentContext.resolveDeployment(facade);
|
||||
if (!deployment.isConfigured()) {
|
||||
return AuthenticationMechanismOutcome.NOT_ATTEMPTED;
|
||||
|
@ -119,4 +119,8 @@ public class ServletKeycloakAuthMech extends AbstractUndertowKeycloakAuthMech {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public UndertowHttpFacade createFacade(HttpServerExchange exchange) {
|
||||
return new OIDCServletUndertowHttpFacade(exchange);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,11 +61,13 @@ public class ServletPreAuthActionsHandler implements HttpHandler {
|
|||
|
||||
@Override
|
||||
public void handleRequest(HttpServerExchange exchange) throws Exception {
|
||||
UndertowHttpFacade facade = new OIDCUndertowHttpFacade(exchange);
|
||||
UndertowHttpFacade facade = new OIDCServletUndertowHttpFacade(exchange);
|
||||
final ServletRequestContext servletRequestContext = exchange.getAttachment(ServletRequestContext.ATTACHMENT_KEY);
|
||||
SessionManagementBridge bridge = new SessionManagementBridge(userSessionManagement, servletRequestContext.getDeployment().getSessionManager());
|
||||
PreAuthActionsHandler handler = new PreAuthActionsHandler(bridge, deploymentContext, facade);
|
||||
if (handler.handleRequest()) return;
|
||||
next.handleRequest(exchange);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ public class UndertowAuthenticationMechanism extends AbstractUndertowKeycloakAut
|
|||
|
||||
@Override
|
||||
public AuthenticationMechanismOutcome authenticate(HttpServerExchange exchange, SecurityContext securityContext) {
|
||||
UndertowHttpFacade facade = new OIDCUndertowHttpFacade(exchange);
|
||||
UndertowHttpFacade facade = createFacade(exchange);
|
||||
KeycloakDeployment deployment = deploymentContext.resolveDeployment(facade);
|
||||
if (!deployment.isConfigured()) {
|
||||
return AuthenticationMechanismOutcome.NOT_ATTEMPTED;
|
||||
|
|
|
@ -47,10 +47,14 @@ public class UndertowPreAuthActionsHandler implements HttpHandler {
|
|||
|
||||
@Override
|
||||
public void handleRequest(HttpServerExchange exchange) throws Exception {
|
||||
UndertowHttpFacade facade = new OIDCUndertowHttpFacade(exchange);
|
||||
UndertowHttpFacade facade = createFacade(exchange);
|
||||
SessionManagementBridge bridge = new SessionManagementBridge(userSessionManagement, sessionManager);
|
||||
PreAuthActionsHandler handler = new PreAuthActionsHandler(bridge, deploymentContext, facade);
|
||||
if (handler.handleRequest()) return;
|
||||
next.handleRequest(exchange);
|
||||
}
|
||||
|
||||
public UndertowHttpFacade createFacade(HttpServerExchange exchange) {
|
||||
return new OIDCUndertowHttpFacade(exchange);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,9 +15,7 @@
|
|||
|
||||
<modules>
|
||||
<module>wildfly-adapter</module>
|
||||
<module>wildfly-extensions</module>
|
||||
<module>wf8-subsystem</module>
|
||||
<module>wf9-subsystem</module>
|
||||
<module>wf9-server-subsystem</module>
|
||||
</modules>
|
||||
</project>
|
|
@ -76,6 +76,8 @@ public class PasswordPolicy implements Serializable {
|
|||
list.add(new PasswordHistory(arg));
|
||||
} else if (name.equals(ForceExpiredPasswordChange.NAME)) {
|
||||
list.add(new ForceExpiredPasswordChange(arg));
|
||||
} else {
|
||||
throw new IllegalArgumentException("Unsupported policy");
|
||||
}
|
||||
}
|
||||
return list;
|
||||
|
|
|
@ -51,6 +51,10 @@ public class CredentialValidation {
|
|||
}
|
||||
|
||||
public static boolean validateHashedCredential(RealmModel realm, UserModel user, String unhashedCredValue, UserCredentialValueModel credential) {
|
||||
if(unhashedCredValue == null){
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean validated = new Pbkdf2PasswordEncoder(credential.getSalt()).verify(unhashedCredValue, credential.getValue(), credential.getHashIterations());
|
||||
if (validated) {
|
||||
int iterations = hashIterations(realm);
|
||||
|
|
|
@ -996,14 +996,14 @@ public class RepresentationToModel {
|
|||
|
||||
// Import users just to user storage. Don't federate
|
||||
UserModel user = session.userStorage().addUser(newRealm, userRep.getId(), userRep.getUsername(), false, false);
|
||||
user.setEnabled(userRep.isEnabled());
|
||||
user.setEnabled(userRep.isEnabled() != null && userRep.isEnabled());
|
||||
user.setCreatedTimestamp(userRep.getCreatedTimestamp());
|
||||
user.setEmail(userRep.getEmail());
|
||||
user.setEmailVerified(userRep.isEmailVerified());
|
||||
if (userRep.isEmailVerified() != null) user.setEmailVerified(userRep.isEmailVerified());
|
||||
user.setFirstName(userRep.getFirstName());
|
||||
user.setLastName(userRep.getLastName());
|
||||
user.setFederationLink(userRep.getFederationLink());
|
||||
user.setOtpEnabled(userRep.isTotp());
|
||||
if (userRep.isTotp() != null) user.setOtpEnabled(userRep.isTotp());
|
||||
if (userRep.getAttributes() != null) {
|
||||
for (Map.Entry<String, Object> entry : userRep.getAttributes().entrySet()) {
|
||||
Object value = entry.getValue();
|
||||
|
|
|
@ -83,6 +83,15 @@ public class PasswordPolicyTest {
|
|||
Assert.assertEquals("invalidPasswordNotUsernameMessage", policy.validate("jdoe", "jdoe").getMessage());
|
||||
Assert.assertNull(policy.validate("jdoe", "ab&d1234"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInvalidPolicyName() {
|
||||
try {
|
||||
PasswordPolicy policy = new PasswordPolicy("noSuchPolicy");
|
||||
Assert.fail("Expected exception");
|
||||
} catch (IllegalArgumentException e) {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRegexPatterns() {
|
||||
|
|
12
pom.xml
12
pom.xml
|
@ -76,7 +76,7 @@
|
|||
<log4j.version>1.2.17</log4j.version>
|
||||
<greenmail.version>1.3.1b</greenmail.version>
|
||||
<xmlsec.version>1.5.1</xmlsec.version>
|
||||
<aesh.version>0.66</aesh.version>
|
||||
<aesh.version>0.65.1</aesh.version>
|
||||
|
||||
<enforcer.plugin.version>1.4</enforcer.plugin.version>
|
||||
<jboss.as.plugin.version>7.5.Final</jboss.as.plugin.version>
|
||||
|
@ -154,6 +154,7 @@
|
|||
<module>timer</module>
|
||||
<module>export-import</module>
|
||||
<module>util</module>
|
||||
<module>wildfly</module>
|
||||
</modules>
|
||||
|
||||
<dependencyManagement>
|
||||
|
@ -827,7 +828,7 @@
|
|||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<artifactId>keycloak-as7-server-subsystem</artifactId>
|
||||
<artifactId>keycloak-eap6-server-subsystem</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@ -842,7 +843,7 @@
|
|||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<artifactId>keycloak-wf9-server-subsystem</artifactId>
|
||||
<artifactId>keycloak-wildfly-server-subsystem</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@ -945,6 +946,11 @@
|
|||
<artifactId>keycloak-wildfly-adapter</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<artifactId>keycloak-wildfly-adduser</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<artifactId>keycloak-wildfly-extensions</artifactId>
|
||||
|
|
|
@ -26,11 +26,6 @@ public class InitiateLogin implements AuthChallenge {
|
|||
this.sessionStore = sessionStore;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean errorPage() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getResponseCode() {
|
||||
return 0;
|
||||
|
@ -87,6 +82,7 @@ public class InitiateLogin implements AuthChallenge {
|
|||
Document document = authnRequestBuilder.toDocument();
|
||||
SamlDeployment.Binding samlBinding = deployment.getIDP().getSingleSignOnService().getRequestBinding();
|
||||
SamlUtil.sendSaml(true, httpFacade, actionUrl, binding, document, samlBinding);
|
||||
sessionStore.setCurrentAction(SamlSessionStore.CurrentAction.LOGGING_IN);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("Could not create authentication request.", e);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
package org.keycloak.adapters.saml;
|
||||
|
||||
import org.keycloak.adapters.spi.AuthenticationError;
|
||||
import org.keycloak.dom.saml.v2.protocol.StatusResponseType;
|
||||
import org.keycloak.dom.saml.v2.protocol.StatusType;
|
||||
|
||||
/**
|
||||
* Object that describes the SAML error that happened.
|
||||
*
|
||||
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
|
||||
* @version $Revision: 1 $
|
||||
*/
|
||||
public class SamlAuthenticationError implements AuthenticationError {
|
||||
public static enum Reason {
|
||||
EXTRACTION_FAILURE,
|
||||
INVALID_SIGNATURE,
|
||||
ERROR_STATUS
|
||||
}
|
||||
|
||||
private Reason reason;
|
||||
|
||||
private StatusResponseType status;
|
||||
|
||||
public SamlAuthenticationError(Reason reason) {
|
||||
this.reason = reason;
|
||||
}
|
||||
|
||||
public SamlAuthenticationError(Reason reason, StatusResponseType status) {
|
||||
this.reason = reason;
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public SamlAuthenticationError(StatusResponseType statusType) {
|
||||
this.status = statusType;
|
||||
}
|
||||
|
||||
public Reason getReason() {
|
||||
return reason;
|
||||
}
|
||||
public StatusResponseType getStatus() {
|
||||
return status;
|
||||
}
|
||||
}
|
|
@ -1,10 +1,12 @@
|
|||
package org.keycloak.adapters.saml;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
import org.keycloak.common.VerificationException;
|
||||
import org.keycloak.adapters.spi.AuthChallenge;
|
||||
import org.keycloak.adapters.spi.AuthOutcome;
|
||||
import org.keycloak.adapters.spi.HttpFacade;
|
||||
import org.keycloak.common.VerificationException;
|
||||
import org.keycloak.common.util.KeycloakUriBuilder;
|
||||
import org.keycloak.common.util.MultivaluedHashMap;
|
||||
import org.keycloak.dom.saml.v2.assertion.AssertionType;
|
||||
import org.keycloak.dom.saml.v2.assertion.AttributeStatementType;
|
||||
import org.keycloak.dom.saml.v2.assertion.AttributeType;
|
||||
|
@ -29,8 +31,6 @@ import org.keycloak.saml.processing.api.saml.v2.sig.SAML2Signature;
|
|||
import org.keycloak.saml.processing.core.saml.v2.common.SAMLDocumentHolder;
|
||||
import org.keycloak.saml.processing.core.saml.v2.util.AssertionUtil;
|
||||
import org.keycloak.saml.processing.web.util.PostBindingUtil;
|
||||
import org.keycloak.common.util.KeycloakUriBuilder;
|
||||
import org.keycloak.common.util.MultivaluedHashMap;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
|
@ -74,7 +74,7 @@ public abstract class SamlAuthenticator {
|
|||
return handleSamlRequest(samlRequest, relayState);
|
||||
} else if (samlResponse != null) {
|
||||
return handleSamlResponse(samlResponse, relayState);
|
||||
} else if (sessionStore.isLoggedIn()) {
|
||||
} else if (sessionStore.isLoggedIn()) {
|
||||
if (globalLogout) {
|
||||
return globalLogout();
|
||||
}
|
||||
|
@ -106,6 +106,7 @@ public abstract class SamlAuthenticator {
|
|||
|
||||
try {
|
||||
SamlUtil.sendSaml(true, facade, deployment.getIDP().getSingleLogoutService().getRequestBindingUrl(), binding, logoutBuilder.buildDocument(), deployment.getIDP().getSingleLogoutService().getRequestBinding());
|
||||
sessionStore.setCurrentAction(SamlSessionStore.CurrentAction.LOGGING_OUT);
|
||||
} catch (Exception e) {
|
||||
log.error("Could not send global logout SAML request", e);
|
||||
return AuthOutcome.FAILED;
|
||||
|
@ -155,7 +156,7 @@ public abstract class SamlAuthenticator {
|
|||
protected AuthOutcome logoutRequest(LogoutRequestType request, String relayState) {
|
||||
if (request.getSessionIndex() == null || request.getSessionIndex().isEmpty()) {
|
||||
sessionStore.logoutByPrincipal(request.getNameID().getValue());
|
||||
} else {
|
||||
} else {
|
||||
sessionStore.logoutBySsoId(request.getSessionIndex());
|
||||
}
|
||||
|
||||
|
@ -169,7 +170,8 @@ public abstract class SamlAuthenticator {
|
|||
binding.signatureAlgorithm(deployment.getSignatureAlgorithm())
|
||||
.signWith(deployment.getSigningKeyPair())
|
||||
.signDocument();
|
||||
if (deployment.getSignatureCanonicalizationMethod() != null) binding.canonicalizationMethod(deployment.getSignatureCanonicalizationMethod());
|
||||
if (deployment.getSignatureCanonicalizationMethod() != null)
|
||||
binding.canonicalizationMethod(deployment.getSignatureCanonicalizationMethod());
|
||||
}
|
||||
|
||||
|
||||
|
@ -199,34 +201,80 @@ public abstract class SamlAuthenticator {
|
|||
postBinding = true;
|
||||
holder = extractPostBindingResponse(samlResponse);
|
||||
}
|
||||
StatusResponseType statusResponse = (StatusResponseType)holder.getSamlObject();
|
||||
final StatusResponseType statusResponse = (StatusResponseType) holder.getSamlObject();
|
||||
// validate destination
|
||||
if (!requestUri.equals(statusResponse.getDestination())) {
|
||||
log.error("Request URI does not match SAML request destination");
|
||||
return AuthOutcome.FAILED;
|
||||
}
|
||||
if (statusResponse instanceof ResponseType) {
|
||||
if (deployment.getIDP().getSingleSignOnService().validateResponseSignature()) {
|
||||
try {
|
||||
validateSamlSignature(holder, postBinding, GeneralConstants.SAML_RESPONSE_KEY);
|
||||
} catch (VerificationException e) {
|
||||
log.error("Failed to verify saml response signature", e);
|
||||
return AuthOutcome.FAILED;
|
||||
try {
|
||||
if (deployment.getIDP().getSingleSignOnService().validateResponseSignature()) {
|
||||
try {
|
||||
validateSamlSignature(holder, postBinding, GeneralConstants.SAML_RESPONSE_KEY);
|
||||
} catch (VerificationException e) {
|
||||
log.error("Failed to verify saml response signature", e);
|
||||
|
||||
challenge = new AuthChallenge() {
|
||||
@Override
|
||||
public boolean challenge(HttpFacade exchange) {
|
||||
SamlAuthenticationError error = new SamlAuthenticationError(SamlAuthenticationError.Reason.INVALID_SIGNATURE);
|
||||
exchange.getRequest().setError(error);
|
||||
exchange.getResponse().sendError(403);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getResponseCode() {
|
||||
return 403;
|
||||
}
|
||||
};
|
||||
return AuthOutcome.FAILED;
|
||||
}
|
||||
}
|
||||
return handleLoginResponse((ResponseType) statusResponse);
|
||||
} finally {
|
||||
sessionStore.setCurrentAction(SamlSessionStore.CurrentAction.NONE);
|
||||
}
|
||||
return handleLoginResponse((ResponseType)statusResponse);
|
||||
|
||||
} else {
|
||||
if (deployment.getIDP().getSingleLogoutService().validateResponseSignature()) {
|
||||
if (sessionStore.isLoggingOut()) {
|
||||
try {
|
||||
validateSamlSignature(holder, postBinding, GeneralConstants.SAML_RESPONSE_KEY);
|
||||
} catch (VerificationException e) {
|
||||
log.error("Failed to verify saml response signature", e);
|
||||
if (deployment.getIDP().getSingleLogoutService().validateResponseSignature()) {
|
||||
try {
|
||||
validateSamlSignature(holder, postBinding, GeneralConstants.SAML_RESPONSE_KEY);
|
||||
} catch (VerificationException e) {
|
||||
log.error("Failed to verify saml response signature", e);
|
||||
return AuthOutcome.FAILED;
|
||||
}
|
||||
}
|
||||
return handleLogoutResponse(holder, statusResponse, relayState);
|
||||
} finally {
|
||||
sessionStore.setCurrentAction(SamlSessionStore.CurrentAction.NONE);
|
||||
}
|
||||
|
||||
} else if (sessionStore.isLoggingIn()) {
|
||||
try {
|
||||
challenge = new AuthChallenge() {
|
||||
@Override
|
||||
public boolean challenge(HttpFacade exchange) {
|
||||
SamlAuthenticationError error = new SamlAuthenticationError(SamlAuthenticationError.Reason.ERROR_STATUS, statusResponse);
|
||||
exchange.getRequest().setError(error);
|
||||
exchange.getResponse().sendError(403);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getResponseCode() {
|
||||
return 403;
|
||||
}
|
||||
};
|
||||
return AuthOutcome.FAILED;
|
||||
} finally {
|
||||
sessionStore.setCurrentAction(SamlSessionStore.CurrentAction.NONE);
|
||||
}
|
||||
}
|
||||
// todo need to check that it is actually a LogoutResponse
|
||||
return handleLogoutResponse(holder, statusResponse, relayState);
|
||||
return AuthOutcome.NOT_ATTEMPTED;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -239,7 +287,7 @@ public abstract class SamlAuthenticator {
|
|||
}
|
||||
}
|
||||
|
||||
protected AuthOutcome handleLoginResponse(ResponseType responseType) {
|
||||
protected AuthOutcome handleLoginResponse(ResponseType responseType) {
|
||||
AssertionType assertion = null;
|
||||
try {
|
||||
assertion = AssertionUtil.getAssertion(responseType, deployment.getDecryptionKey());
|
||||
|
@ -248,7 +296,20 @@ public abstract class SamlAuthenticator {
|
|||
}
|
||||
} catch (Exception e) {
|
||||
log.error("Error extracting SAML assertion, e");
|
||||
return AuthOutcome.FAILED;
|
||||
challenge = new AuthChallenge() {
|
||||
@Override
|
||||
public boolean challenge(HttpFacade exchange) {
|
||||
SamlAuthenticationError error = new SamlAuthenticationError(SamlAuthenticationError.Reason.EXTRACTION_FAILURE);
|
||||
exchange.getRequest().setError(error);
|
||||
exchange.getResponse().sendError(403);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getResponseCode() {
|
||||
return 403;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
SubjectType subject = assertion.getSubject();
|
||||
|
@ -308,14 +369,14 @@ public abstract class SamlAuthenticator {
|
|||
AuthnStatementType authn = null;
|
||||
for (Object statement : assertion.getStatements()) {
|
||||
if (statement instanceof AuthnStatementType) {
|
||||
authn = (AuthnStatementType)statement;
|
||||
authn = (AuthnStatementType) statement;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
URI nameFormat = subjectNameID.getFormat();
|
||||
String nameFormatString = nameFormat == null ? JBossSAMLURIConstants.NAMEID_FORMAT_UNSPECIFIED.get() : nameFormat.toString();
|
||||
String nameFormatString = nameFormat == null ? JBossSAMLURIConstants.NAMEID_FORMAT_UNSPECIFIED.get() : nameFormat.toString();
|
||||
final SamlPrincipal principal = new SamlPrincipal(principalName, principalName, nameFormatString, attributes, friendlyAttributes);
|
||||
String index = authn == null ? null : authn.getSessionIndex();
|
||||
final String sessionIndex = index;
|
||||
|
@ -341,9 +402,9 @@ public abstract class SamlAuthenticator {
|
|||
protected abstract void completeAuthentication(SamlSession account);
|
||||
|
||||
private String getAttributeValue(Object attrValue) {
|
||||
String value = null;
|
||||
String value = null;
|
||||
if (attrValue instanceof String) {
|
||||
value = (String)attrValue;
|
||||
value = (String) attrValue;
|
||||
} else if (attrValue instanceof Node) {
|
||||
Node roleNode = (Node) attrValue;
|
||||
value = roleNode.getFirstChild().getNodeValue();
|
||||
|
@ -372,6 +433,7 @@ public abstract class SamlAuthenticator {
|
|||
protected SAMLDocumentHolder extractRedirectBindingResponse(String response) {
|
||||
return SAMLRequestParser.parseRequestRedirectBinding(response);
|
||||
}
|
||||
|
||||
protected SAMLDocumentHolder extractPostBindingResponse(String response) {
|
||||
byte[] samlBytes = PostBindingUtil.base64Decode(response);
|
||||
String xml = new String(samlBytes);
|
||||
|
@ -379,7 +441,6 @@ public abstract class SamlAuthenticator {
|
|||
}
|
||||
|
||||
|
||||
|
||||
protected AuthOutcome initiateLogin() {
|
||||
challenge = new InitiateLogin(deployment, sessionStore);
|
||||
return AuthOutcome.NOT_ATTEMPTED;
|
||||
|
@ -445,5 +506,4 @@ public abstract class SamlAuthenticator {
|
|||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package org.keycloak.adapters.saml;
|
||||
|
||||
import org.keycloak.adapters.spi.AdapterSessionStore;
|
||||
import org.keycloak.dom.saml.v2.protocol.StatusResponseType;
|
||||
import org.keycloak.dom.saml.v2.protocol.StatusType;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -9,6 +11,19 @@ import java.util.List;
|
|||
* @version $Revision: 1 $
|
||||
*/
|
||||
public interface SamlSessionStore extends AdapterSessionStore {
|
||||
public static final String CURRENT_ACTION = "SAML_CURRENT_ACTION";
|
||||
public static final String SAML_LOGIN_ERROR_STATUS = "SAML_LOGIN_ERROR_STATUS";
|
||||
public static final String SAML_LOGOUT_ERROR_STATUS = "SAML_LOGOUT_ERROR_STATUS";
|
||||
|
||||
enum CurrentAction {
|
||||
NONE,
|
||||
LOGGING_IN,
|
||||
LOGGING_OUT
|
||||
}
|
||||
void setCurrentAction(CurrentAction action);
|
||||
boolean isLoggingIn();
|
||||
boolean isLoggingOut();
|
||||
|
||||
boolean isLoggedIn();
|
||||
SamlSession getAccount();
|
||||
void saveAccount(SamlSession account);
|
||||
|
|
|
@ -260,15 +260,6 @@ public abstract class AbstractSamlAuthenticator extends LoginAuthenticator {
|
|||
AuthChallenge challenge = authenticator.getChallenge();
|
||||
if (challenge != null) {
|
||||
challenge.challenge(facade);
|
||||
if (challenge.errorPage() && errorPage != null) {
|
||||
Response response = (Response)res;
|
||||
try {
|
||||
response.sendRedirect(response.encodeRedirectURL(URIUtil.addPaths(request.getContextPath(), errorPage)));
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return Authentication.SEND_CONTINUE;
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ import org.keycloak.adapters.spi.SessionIdMapper;
|
|||
import org.keycloak.adapters.jetty.spi.JettyUserSessionManagement;
|
||||
import org.keycloak.adapters.saml.SamlSession;
|
||||
import org.keycloak.adapters.saml.SamlSessionStore;
|
||||
import org.keycloak.dom.saml.v2.protocol.StatusType;
|
||||
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
|
@ -37,6 +38,28 @@ public class JettySamlSessionStore implements SamlSessionStore {
|
|||
this.sessionManagement = sessionManagement;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCurrentAction(CurrentAction action) {
|
||||
if (action == CurrentAction.NONE && request.getSession(false) == null) return;
|
||||
request.getSession().setAttribute(CURRENT_ACTION, action);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLoggingIn() {
|
||||
HttpSession session = request.getSession(false);
|
||||
if (session == null) return false;
|
||||
CurrentAction action = (CurrentAction)session.getAttribute(CURRENT_ACTION);
|
||||
return action == CurrentAction.LOGGING_IN;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLoggingOut() {
|
||||
HttpSession session = request.getSession(false);
|
||||
if (session == null) return false;
|
||||
CurrentAction action = (CurrentAction)session.getAttribute(CURRENT_ACTION);
|
||||
return action == CurrentAction.LOGGING_OUT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void logoutAccount() {
|
||||
HttpSession session = request.getSession(false);
|
||||
|
|
|
@ -7,6 +7,7 @@ import org.keycloak.adapters.spi.SessionIdMapper;
|
|||
import org.keycloak.adapters.saml.SamlSession;
|
||||
import org.keycloak.adapters.saml.SamlSessionStore;
|
||||
import org.keycloak.adapters.servlet.FilterSessionStore;
|
||||
import org.keycloak.dom.saml.v2.protocol.StatusType;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletRequestWrapper;
|
||||
|
@ -29,6 +30,28 @@ public class FilterSamlSessionStore extends FilterSessionStore implements SamlSe
|
|||
this.idMapper = idMapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCurrentAction(CurrentAction action) {
|
||||
if (action == CurrentAction.NONE && request.getSession(false) == null) return;
|
||||
request.getSession().setAttribute(CURRENT_ACTION, action);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLoggingIn() {
|
||||
HttpSession session = request.getSession(false);
|
||||
if (session == null) return false;
|
||||
CurrentAction action = (CurrentAction)session.getAttribute(CURRENT_ACTION);
|
||||
return action == CurrentAction.LOGGING_IN;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLoggingOut() {
|
||||
HttpSession session = request.getSession(false);
|
||||
if (session == null) return false;
|
||||
CurrentAction action = (CurrentAction)session.getAttribute(CURRENT_ACTION);
|
||||
return action == CurrentAction.LOGGING_OUT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void logoutAccount() {
|
||||
HttpSession session = request.getSession(false);
|
||||
|
|
|
@ -137,11 +137,6 @@ public class SamlFilter implements Filter {
|
|||
if (challenge != null) {
|
||||
log.fine("challenge");
|
||||
challenge.challenge(facade);
|
||||
if (challenge.errorPage()) {
|
||||
response.sendError(challenge.getResponseCode());
|
||||
return;
|
||||
}
|
||||
log.fine("sending challenge");
|
||||
return;
|
||||
}
|
||||
if (!facade.isEnded()) {
|
||||
|
|
|
@ -213,10 +213,6 @@ public abstract class AbstractSamlAuthenticatorValve extends FormAuthenticator i
|
|||
loginConfig = request.getContext().getLoginConfig();
|
||||
}
|
||||
challenge.challenge(facade);
|
||||
if (challenge.errorPage()) {
|
||||
log.fine("error page");
|
||||
if (forwardToErrorPageInternal(request, response, loginConfig))return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -9,6 +9,8 @@ import org.keycloak.adapters.spi.HttpFacade;
|
|||
import org.keycloak.adapters.spi.SessionIdMapper;
|
||||
import org.keycloak.adapters.tomcat.CatalinaUserSessionManagement;
|
||||
import org.keycloak.adapters.tomcat.GenericPrincipalFactory;
|
||||
import org.keycloak.dom.saml.v2.protocol.StatusResponseType;
|
||||
import org.keycloak.dom.saml.v2.protocol.StatusType;
|
||||
|
||||
import javax.servlet.http.HttpSession;
|
||||
import java.io.IOException;
|
||||
|
@ -41,6 +43,28 @@ public class CatalinaSamlSessionStore implements SamlSessionStore {
|
|||
this.facade = facade;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCurrentAction(CurrentAction action) {
|
||||
if (action == CurrentAction.NONE && request.getSession(false) == null) return;
|
||||
request.getSession().setAttribute(CURRENT_ACTION, action);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLoggingIn() {
|
||||
HttpSession session = request.getSession(false);
|
||||
if (session == null) return false;
|
||||
CurrentAction action = (CurrentAction)session.getAttribute(CURRENT_ACTION);
|
||||
return action == CurrentAction.LOGGING_IN;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLoggingOut() {
|
||||
HttpSession session = request.getSession(false);
|
||||
if (session == null) return false;
|
||||
CurrentAction action = (CurrentAction)session.getAttribute(CURRENT_ACTION);
|
||||
return action == CurrentAction.LOGGING_OUT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void logoutAccount() {
|
||||
Session sessionInternal = request.getSessionInternal(false);
|
||||
|
|
|
@ -55,10 +55,6 @@ public abstract class AbstractSamlAuthMech implements AuthenticationMechanism {
|
|||
public ChallengeResult sendChallenge(HttpServerExchange exchange, SecurityContext securityContext) {
|
||||
AuthChallenge challenge = exchange.getAttachment(KEYCLOAK_CHALLENGE_ATTACHMENT_KEY);
|
||||
if (challenge != null) {
|
||||
if (challenge.errorPage() && errorPage != null) {
|
||||
Integer code = servePage(exchange, errorPage);
|
||||
return new ChallengeResult(true, code);
|
||||
}
|
||||
UndertowHttpFacade facade = createFacade(exchange);
|
||||
if (challenge.challenge(facade)) {
|
||||
return new ChallengeResult(true, exchange.getResponseCode());
|
||||
|
|
|
@ -13,9 +13,12 @@ import org.keycloak.adapters.saml.SamlSession;
|
|||
import org.keycloak.adapters.saml.SamlSessionStore;
|
||||
import org.keycloak.adapters.undertow.UndertowUserSessionManagement;
|
||||
import org.keycloak.common.util.KeycloakUriBuilder;
|
||||
import org.keycloak.dom.saml.v2.protocol.StatusType;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import java.io.IOException;
|
||||
import java.security.Principal;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
@ -34,6 +37,7 @@ public class ServletSamlSessionStore implements SamlSessionStore {
|
|||
private final SecurityContext securityContext;
|
||||
private final SessionIdMapper idMapper;
|
||||
|
||||
|
||||
public ServletSamlSessionStore(HttpServerExchange exchange, UndertowUserSessionManagement sessionManagement,
|
||||
SecurityContext securityContext,
|
||||
SessionIdMapper idMapper) {
|
||||
|
@ -43,6 +47,28 @@ public class ServletSamlSessionStore implements SamlSessionStore {
|
|||
this.idMapper = idMapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCurrentAction(CurrentAction action) {
|
||||
if (action == CurrentAction.NONE && getRequest().getSession(false) == null) return;
|
||||
getRequest().getSession().setAttribute(CURRENT_ACTION, action);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLoggingIn() {
|
||||
HttpSession session = getRequest().getSession(false);
|
||||
if (session == null) return false;
|
||||
CurrentAction action = (CurrentAction)session.getAttribute(CURRENT_ACTION);
|
||||
return action == CurrentAction.LOGGING_IN;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLoggingOut() {
|
||||
HttpSession session = getRequest().getSession(false);
|
||||
if (session == null) return false;
|
||||
CurrentAction action = (CurrentAction)session.getAttribute(CURRENT_ACTION);
|
||||
return action == CurrentAction.LOGGING_OUT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void logoutAccount() {
|
||||
HttpSession session = getSession(false);
|
||||
|
@ -170,8 +196,18 @@ public class ServletSamlSessionStore implements SamlSessionStore {
|
|||
}
|
||||
|
||||
protected HttpSession getSession(boolean create) {
|
||||
final ServletRequestContext servletRequestContext = exchange.getAttachment(ServletRequestContext.ATTACHMENT_KEY);
|
||||
HttpServletRequest req = (HttpServletRequest) servletRequestContext.getServletRequest();
|
||||
HttpServletRequest req = getRequest();
|
||||
return req.getSession(create);
|
||||
}
|
||||
|
||||
private HttpServletResponse getResponse() {
|
||||
final ServletRequestContext servletRequestContext = exchange.getAttachment(ServletRequestContext.ATTACHMENT_KEY);
|
||||
return (HttpServletResponse)servletRequestContext.getServletResponse();
|
||||
|
||||
}
|
||||
|
||||
private HttpServletRequest getRequest() {
|
||||
final ServletRequestContext servletRequestContext = exchange.getAttachment(ServletRequestContext.ATTACHMENT_KEY);
|
||||
return (HttpServletRequest) servletRequestContext.getServletRequest();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
*/
|
||||
package org.keycloak.dom.saml.v2.protocol;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.net.URI;
|
||||
|
||||
/**
|
||||
|
@ -39,7 +40,7 @@ import java.net.URI;
|
|||
* </complexType>
|
||||
* </pre>
|
||||
*/
|
||||
public class StatusCodeType {
|
||||
public class StatusCodeType implements Serializable {
|
||||
|
||||
protected StatusCodeType statusCode;
|
||||
protected URI value;
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
*/
|
||||
package org.keycloak.dom.saml.v2.protocol;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Java class for StatusType complex type.
|
||||
|
@ -38,7 +40,7 @@ package org.keycloak.dom.saml.v2.protocol;
|
|||
* </complexType>
|
||||
* </pre>
|
||||
*/
|
||||
public class StatusType {
|
||||
public class StatusType implements Serializable {
|
||||
|
||||
protected String statusMessage;
|
||||
protected StatusCodeType statusCode;
|
||||
|
|
|
@ -1,6 +1,12 @@
|
|||
package org.keycloak.saml;
|
||||
|
||||
import org.keycloak.dom.saml.v2.assertion.NameIDType;
|
||||
import org.keycloak.dom.saml.v2.protocol.StatusCodeType;
|
||||
import org.keycloak.dom.saml.v2.protocol.StatusResponseType;
|
||||
import org.keycloak.dom.saml.v2.protocol.StatusType;
|
||||
import org.keycloak.saml.common.constants.JBossSAMLURIConstants;
|
||||
import org.keycloak.saml.common.exceptions.ConfigurationException;
|
||||
import org.keycloak.saml.common.exceptions.ParsingException;
|
||||
import org.keycloak.saml.common.exceptions.ProcessingException;
|
||||
import org.keycloak.saml.processing.api.saml.v2.response.SAML2Response;
|
||||
import org.keycloak.saml.processing.core.saml.v2.common.IDGenerator;
|
||||
|
@ -9,8 +15,11 @@ import org.keycloak.saml.processing.core.saml.v2.holders.IDPInfoHolder;
|
|||
import org.keycloak.saml.processing.core.saml.v2.holders.IssuerInfoHolder;
|
||||
import org.keycloak.saml.processing.core.saml.v2.holders.SPInfoHolder;
|
||||
import org.keycloak.dom.saml.v2.protocol.ResponseType;
|
||||
import org.keycloak.saml.processing.core.saml.v2.util.XMLTimeUtil;
|
||||
import org.w3c.dom.Document;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
|
||||
* @version $Revision: 1 $
|
||||
|
@ -38,29 +47,25 @@ public class SAML2ErrorResponseBuilder {
|
|||
|
||||
|
||||
public Document buildDocument() throws ProcessingException {
|
||||
Document samlResponse = null;
|
||||
ResponseType responseType = null;
|
||||
|
||||
SAML2Response saml2Response = new SAML2Response();
|
||||
try {
|
||||
StatusResponseType statusResponse = new StatusResponseType(IDGenerator.create("ID_"), XMLTimeUtil.getIssueInstant());
|
||||
|
||||
// Create a response type
|
||||
String id = IDGenerator.create("ID_");
|
||||
statusResponse.setStatus(JBossSAMLAuthnResponseFactory.createStatusTypeForResponder(status));
|
||||
NameIDType issuer = new NameIDType();
|
||||
issuer.setValue(this.issuer);
|
||||
|
||||
IssuerInfoHolder issuerHolder = new IssuerInfoHolder(issuer);
|
||||
issuerHolder.setStatusCode(status);
|
||||
statusResponse.setIssuer(issuer);
|
||||
statusResponse.setDestination(destination);
|
||||
|
||||
IDPInfoHolder idp = new IDPInfoHolder();
|
||||
idp.setNameIDFormatValue(null);
|
||||
idp.setNameIDFormat(JBossSAMLURIConstants.NAMEID_FORMAT_PERSISTENT.get());
|
||||
SAML2Response saml2Response = new SAML2Response();
|
||||
return saml2Response.convert(statusResponse);
|
||||
} catch (ConfigurationException e) {
|
||||
throw new ProcessingException(e);
|
||||
} catch (ParsingException e) {
|
||||
throw new ProcessingException(e);
|
||||
}
|
||||
|
||||
SPInfoHolder sp = new SPInfoHolder();
|
||||
sp.setResponseDestinationURI(destination);
|
||||
|
||||
responseType = saml2Response.createResponseType(id);
|
||||
responseType.setStatus(JBossSAMLAuthnResponseFactory.createStatusTypeForResponder(status));
|
||||
responseType.setDestination(destination);
|
||||
|
||||
return samlResponse;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,63 +1,35 @@
|
|||
package org.keycloak.protocol.saml.clientregistration;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
import org.keycloak.events.EventBuilder;
|
||||
import org.keycloak.exportimport.ClientDescriptionConverter;
|
||||
import org.keycloak.models.KeycloakSession;
|
||||
import org.keycloak.services.clientregistration.ClientRegistrationAuth;
|
||||
import org.keycloak.services.clientregistration.ClientRegistrationProvider;
|
||||
import org.keycloak.protocol.saml.EntityDescriptorDescriptionConverter;
|
||||
import org.keycloak.representations.idm.ClientRepresentation;
|
||||
import org.keycloak.services.clientregistration.AbstractClientRegistrationProvider;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.Response;
|
||||
import java.net.URI;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:sthorger@redhat.com">Stian Thorgersen</a>
|
||||
*/
|
||||
public class EntityDescriptorClientRegistrationProvider implements ClientRegistrationProvider {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(EntityDescriptorClientRegistrationProvider.class);
|
||||
|
||||
private KeycloakSession session;
|
||||
private EventBuilder event;
|
||||
private ClientRegistrationAuth auth;
|
||||
public class EntityDescriptorClientRegistrationProvider extends AbstractClientRegistrationProvider {
|
||||
|
||||
public EntityDescriptorClientRegistrationProvider(KeycloakSession session) {
|
||||
this.session = session;
|
||||
super(session);
|
||||
}
|
||||
|
||||
// @POST
|
||||
// @Consumes(MediaType.APPLICATION_XML)
|
||||
// @Produces(MediaType.APPLICATION_JSON)
|
||||
// public Response create(String descriptor) {
|
||||
// event.event(EventType.CLIENT_REGISTER);
|
||||
//
|
||||
// auth.requireCreate();
|
||||
//
|
||||
// ClientRepresentation client = session.getProvider(ClientDescriptionConverter.class, EntityDescriptorDescriptionConverter.ID).convertToInternal(descriptor);
|
||||
//
|
||||
// try {
|
||||
// ClientModel clientModel = RepresentationToModel.createClient(session, session.getContext().getRealm(), client, true);
|
||||
// client = ModelToRepresentation.toRepresentation(clientModel);
|
||||
// URI uri = session.getContext().getUri().getAbsolutePathBuilder().path(clientModel.getId()).build();
|
||||
//
|
||||
// logger.infov("Created client {0}", client.getClientId());
|
||||
//
|
||||
// event.client(client.getClientId()).success();
|
||||
//
|
||||
// return Response.created(uri).entity(client).build();
|
||||
// } catch (ModelDuplicateException e) {
|
||||
// return ErrorResponse.exists("Client " + client.getClientId() + " already exists");
|
||||
// }
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAuth(ClientRegistrationAuth auth) {
|
||||
this.auth = auth;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEvent(EventBuilder event) {
|
||||
this.event = event;
|
||||
@POST
|
||||
@Consumes(MediaType.APPLICATION_XML)
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public Response createSaml(String descriptor) {
|
||||
ClientRepresentation client = session.getProvider(ClientDescriptionConverter.class, EntityDescriptorDescriptionConverter.ID).convertToInternal(descriptor);
|
||||
client = create(client);
|
||||
URI uri = session.getContext().getUri().getAbsolutePathBuilder().path(client.getClientId()).build();
|
||||
return Response.created(uri).entity(client).build();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -148,24 +148,17 @@ public abstract class AbstractUsernameFormAuthenticator extends AbstractFormAuth
|
|||
public boolean validatePassword(AuthenticationFlowContext context, UserModel user, MultivaluedMap<String, String> inputData) {
|
||||
List<UserCredentialModel> credentials = new LinkedList<>();
|
||||
String password = inputData.getFirst(CredentialRepresentation.PASSWORD);
|
||||
if (password == null || password.isEmpty()) {
|
||||
invalidPassword(context, user);
|
||||
return false;
|
||||
}
|
||||
credentials.add(UserCredentialModel.password(password));
|
||||
boolean valid = context.getSession().users().validCredentials(context.getRealm(), user, credentials);
|
||||
if (!valid) {
|
||||
invalidPassword(context, user);
|
||||
context.getEvent().user(user);
|
||||
context.getEvent().error(Errors.INVALID_USER_CREDENTIALS);
|
||||
Response challengeResponse = invalidCredentials(context);
|
||||
context.failureChallenge(AuthenticationFlowError.INVALID_CREDENTIALS, challengeResponse);
|
||||
context.clearUser();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void invalidPassword(AuthenticationFlowContext context, UserModel user) {
|
||||
context.getEvent().user(user);
|
||||
context.getEvent().error(Errors.INVALID_USER_CREDENTIALS);
|
||||
Response challengeResponse = invalidCredentials(context);
|
||||
context.failureChallenge(AuthenticationFlowError.INVALID_CREDENTIALS, challengeResponse);
|
||||
context.clearUser();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,15 +31,6 @@ public class ValidatePassword extends AbstractDirectGrantAuthenticator {
|
|||
MultivaluedMap<String, String> inputData = context.getHttpRequest().getDecodedFormParameters();
|
||||
List<UserCredentialModel> credentials = new LinkedList<>();
|
||||
String password = inputData.getFirst(CredentialRepresentation.PASSWORD);
|
||||
if (password == null || password.isEmpty()) {
|
||||
if (context.getUser() != null) {
|
||||
context.getEvent().user(context.getUser());
|
||||
}
|
||||
context.getEvent().error(Errors.INVALID_USER_CREDENTIALS);
|
||||
Response challengeResponse = errorResponse(Response.Status.UNAUTHORIZED.getStatusCode(), "invalid_grant", "Invalid user credentials");
|
||||
context.failure(AuthenticationFlowError.INVALID_USER, challengeResponse);
|
||||
return;
|
||||
}
|
||||
credentials.add(UserCredentialModel.password(password));
|
||||
boolean valid = context.getSession().users().validCredentials(context.getRealm(), context.getUser(), credentials);
|
||||
if (!valid) {
|
||||
|
|
|
@ -60,7 +60,8 @@ public class ExportImportManager {
|
|||
|
||||
// Check if master realm was exported. If it's not, then it needs to be created before other realms are imported
|
||||
if (!importProvider.isMasterRealmExported()) {
|
||||
new ApplianceBootstrap().bootstrap(sessionFactory, contextPath);
|
||||
ApplianceBootstrap.setupDefaultRealm(sessionFactory, contextPath);
|
||||
ApplianceBootstrap.setupDefaultUser(sessionFactory);
|
||||
}
|
||||
|
||||
importProvider.importModel(sessionFactory, strategy);
|
||||
|
@ -69,7 +70,8 @@ public class ExportImportManager {
|
|||
|
||||
if (!realmName.equals(Config.getAdminRealm())) {
|
||||
// Check if master realm exists. If it's not, then it needs to be created before other realm is imported
|
||||
new ApplianceBootstrap().bootstrap(sessionFactory, contextPath);
|
||||
ApplianceBootstrap.setupDefaultRealm(sessionFactory, contextPath);
|
||||
ApplianceBootstrap.setupDefaultUser(sessionFactory);
|
||||
}
|
||||
|
||||
importProvider.importRealm(sessionFactory, realmName, strategy);
|
||||
|
|
|
@ -1,90 +0,0 @@
|
|||
/*
|
||||
* Copyright 2015 Red Hat Inc. and/or its affiliates and other contributors
|
||||
* as indicated by the @author tags. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
|
||||
package org.keycloak.offlineconfig;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
import org.keycloak.Config;
|
||||
import org.keycloak.models.KeycloakSession;
|
||||
import org.keycloak.models.KeycloakSessionFactory;
|
||||
import org.keycloak.models.RealmModel;
|
||||
import org.keycloak.models.RealmProvider;
|
||||
import org.keycloak.models.UserModel;
|
||||
import org.keycloak.models.UserProvider;
|
||||
import org.keycloak.services.managers.ApplianceBootstrap;
|
||||
|
||||
/**
|
||||
* Static utility class that performs recovery on the master admin account.
|
||||
*
|
||||
* @author Stan Silvert ssilvert@redhat.com (C) 2015 Red Hat Inc.
|
||||
*/
|
||||
public class AdminRecovery {
|
||||
private static final Logger log = Logger.getLogger(AdminRecovery.class);
|
||||
|
||||
public static final String RECOVER_ADMIN_ACCOUNT = "keycloak.recover-admin";
|
||||
public static final String TEMP_ADMIN_PASSWORD = "keycloak.temp-admin-password";
|
||||
|
||||
// Don't allow instances
|
||||
private AdminRecovery() {}
|
||||
|
||||
public static void recover(KeycloakSessionFactory sessionFactory) {
|
||||
if (!needRecovery()) return;
|
||||
|
||||
KeycloakSession session = sessionFactory.create();
|
||||
|
||||
session.getTransaction().begin();
|
||||
try {
|
||||
doRecover(session, getTempAdminPassword());
|
||||
session.getTransaction().commit();
|
||||
log.info("*******************************");
|
||||
log.info("Recovered Master Admin account.");
|
||||
log.info("*******************************");
|
||||
} finally {
|
||||
session.close();
|
||||
System.clearProperty(RECOVER_ADMIN_ACCOUNT);
|
||||
System.clearProperty(TEMP_ADMIN_PASSWORD);
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean needRecovery() {
|
||||
String strNeedRecovery = System.getProperty(RECOVER_ADMIN_ACCOUNT, "false");
|
||||
return Boolean.parseBoolean(strNeedRecovery);
|
||||
}
|
||||
|
||||
private static String getTempAdminPassword() {
|
||||
String tempAdminPassword = System.getProperty(TEMP_ADMIN_PASSWORD);
|
||||
if ((tempAdminPassword == null) || tempAdminPassword.isEmpty()) {
|
||||
throw new OfflineConfigException("Must provide temporary admin password to recover admin account.");
|
||||
}
|
||||
return tempAdminPassword;
|
||||
}
|
||||
|
||||
private static void doRecover(KeycloakSession session, String tempAdminPassword) {
|
||||
RealmProvider realmProvider = session.realms();
|
||||
UserProvider userProvider = session.users();
|
||||
|
||||
String adminRealmName = Config.getAdminRealm();
|
||||
RealmModel realm = realmProvider.getRealmByName(adminRealmName);
|
||||
UserModel adminUser = userProvider.getUserByUsername("admin", realm);
|
||||
|
||||
if (adminUser == null) {
|
||||
adminUser = userProvider.addUser(realm, "admin");
|
||||
}
|
||||
|
||||
ApplianceBootstrap.setupAdminUser(session, realm, adminUser, tempAdminPassword);
|
||||
}
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
/*
|
||||
* Copyright 2015 Red Hat Inc. and/or its affiliates and other contributors
|
||||
* as indicated by the @author tags. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
|
||||
package org.keycloak.offlineconfig;
|
||||
|
||||
/**
|
||||
* Runtime exception thrown when an offline configuration fails. Offline
|
||||
* configuration is defined as any configuration done before the Keycloak Server
|
||||
* starts accepting requests.
|
||||
*
|
||||
* @author Stan Silvert ssilvert@redhat.com (C) 2015 Red Hat Inc.
|
||||
*/
|
||||
public class OfflineConfigException extends IllegalStateException {
|
||||
|
||||
public OfflineConfigException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
}
|
|
@ -5,8 +5,7 @@ import org.keycloak.exportimport.ClientDescriptionConverter;
|
|||
import org.keycloak.exportimport.ClientDescriptionConverterFactory;
|
||||
import org.keycloak.models.KeycloakSession;
|
||||
import org.keycloak.models.KeycloakSessionFactory;
|
||||
import org.keycloak.models.utils.KeycloakModelUtils;
|
||||
import org.keycloak.protocol.oidc.representations.OIDCClientRepresentation;
|
||||
import org.keycloak.representations.oidc.OIDCClientRepresentation;
|
||||
import org.keycloak.representations.idm.ClientRepresentation;
|
||||
import org.keycloak.services.clientregistration.oidc.DescriptionConverter;
|
||||
import org.keycloak.util.JsonSerialization;
|
||||
|
|
|
@ -4,6 +4,8 @@ import org.keycloak.OAuth2Constants;
|
|||
import org.keycloak.models.KeycloakSession;
|
||||
import org.keycloak.models.RealmModel;
|
||||
import org.keycloak.protocol.oidc.representations.OIDCConfigurationRepresentation;
|
||||
import org.keycloak.services.clientregistration.ClientRegistrationService;
|
||||
import org.keycloak.services.clientregistration.oidc.OIDCClientRegistrationProviderFactory;
|
||||
import org.keycloak.services.resources.RealmsResource;
|
||||
import org.keycloak.services.Urls;
|
||||
import org.keycloak.wellknown.WellKnownProvider;
|
||||
|
@ -48,6 +50,7 @@ public class OIDCWellKnownProvider implements WellKnownProvider {
|
|||
config.setUserinfoEndpoint(uriBuilder.clone().path(OIDCLoginProtocolService.class, "issueUserInfo").build(realm.getName(), OIDCLoginProtocol.LOGIN_PROTOCOL).toString());
|
||||
config.setLogoutEndpoint(uriBuilder.clone().path(OIDCLoginProtocolService.class, "logout").build(realm.getName(), OIDCLoginProtocol.LOGIN_PROTOCOL).toString());
|
||||
config.setJwksUri(uriBuilder.clone().path(OIDCLoginProtocolService.class, "certs").build(realm.getName(), OIDCLoginProtocol.LOGIN_PROTOCOL).toString());
|
||||
config.setRegistrationEndpoint(RealmsResource.clientRegistrationUrl(uriInfo).path(ClientRegistrationService.class, "provider").build(realm.getName(), OIDCClientRegistrationProviderFactory.ID).toString());
|
||||
|
||||
config.setIdTokenSigningAlgValuesSupported(DEFAULT_ID_TOKEN_SIGNING_ALG_VALUES_SUPPORTED);
|
||||
config.setResponseTypesSupported(DEFAULT_RESPONSE_TYPES_SUPPORTED);
|
||||
|
|
|
@ -1,177 +0,0 @@
|
|||
package org.keycloak.protocol.oidc.representations;
|
||||
|
||||
import org.codehaus.jackson.annotate.JsonProperty;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:sthorger@redhat.com">Stian Thorgersen</a>
|
||||
*/
|
||||
public class OIDCClientRepresentation {
|
||||
|
||||
@JsonProperty("redirect_uris")
|
||||
private List<String> redirectUris;
|
||||
|
||||
@JsonProperty("token_endpoint_auth_method")
|
||||
private String tokenEndpointAuthMethod;
|
||||
|
||||
@JsonProperty("grant_types")
|
||||
private String grantTypes;
|
||||
|
||||
@JsonProperty("response_types")
|
||||
private String responseTypes;
|
||||
|
||||
@JsonProperty("client_name")
|
||||
private String clientName;
|
||||
|
||||
@JsonProperty("client_uri")
|
||||
private String clientUri;
|
||||
|
||||
@JsonProperty("logo_uri")
|
||||
private String logoUri;
|
||||
|
||||
@JsonProperty("scope")
|
||||
private String scope;
|
||||
|
||||
@JsonProperty("contacts")
|
||||
private String contacts;
|
||||
|
||||
@JsonProperty("tos_uri")
|
||||
private String tos_uri;
|
||||
|
||||
@JsonProperty("policy_uri")
|
||||
private String policy_uri;
|
||||
|
||||
@JsonProperty("jwks_uri")
|
||||
private String jwks_uri;
|
||||
|
||||
@JsonProperty("jwks")
|
||||
private String jwks;
|
||||
|
||||
@JsonProperty("software_id")
|
||||
private String softwareId;
|
||||
|
||||
@JsonProperty("software_version")
|
||||
private String softwareVersion;
|
||||
|
||||
public List<String> getRedirectUris() {
|
||||
return redirectUris;
|
||||
}
|
||||
|
||||
public void setRedirectUris(List<String> redirectUris) {
|
||||
this.redirectUris = redirectUris;
|
||||
}
|
||||
|
||||
public String getTokenEndpointAuthMethod() {
|
||||
return tokenEndpointAuthMethod;
|
||||
}
|
||||
|
||||
public void setTokenEndpointAuthMethod(String tokenEndpointAuthMethod) {
|
||||
this.tokenEndpointAuthMethod = tokenEndpointAuthMethod;
|
||||
}
|
||||
|
||||
public String getGrantTypes() {
|
||||
return grantTypes;
|
||||
}
|
||||
|
||||
public void setGrantTypes(String grantTypes) {
|
||||
this.grantTypes = grantTypes;
|
||||
}
|
||||
|
||||
public String getResponseTypes() {
|
||||
return responseTypes;
|
||||
}
|
||||
|
||||
public void setResponseTypes(String responseTypes) {
|
||||
this.responseTypes = responseTypes;
|
||||
}
|
||||
|
||||
public String getClientName() {
|
||||
return clientName;
|
||||
}
|
||||
|
||||
public void setClientName(String clientName) {
|
||||
this.clientName = clientName;
|
||||
}
|
||||
|
||||
public String getClientUri() {
|
||||
return clientUri;
|
||||
}
|
||||
|
||||
public void setClientUri(String clientUri) {
|
||||
this.clientUri = clientUri;
|
||||
}
|
||||
|
||||
public String getLogoUri() {
|
||||
return logoUri;
|
||||
}
|
||||
|
||||
public void setLogoUri(String logoUri) {
|
||||
this.logoUri = logoUri;
|
||||
}
|
||||
|
||||
public String getScope() {
|
||||
return scope;
|
||||
}
|
||||
|
||||
public void setScope(String scope) {
|
||||
this.scope = scope;
|
||||
}
|
||||
|
||||
public String getContacts() {
|
||||
return contacts;
|
||||
}
|
||||
|
||||
public void setContacts(String contacts) {
|
||||
this.contacts = contacts;
|
||||
}
|
||||
|
||||
public String getTos_uri() {
|
||||
return tos_uri;
|
||||
}
|
||||
|
||||
public void setTos_uri(String tos_uri) {
|
||||
this.tos_uri = tos_uri;
|
||||
}
|
||||
|
||||
public String getPolicy_uri() {
|
||||
return policy_uri;
|
||||
}
|
||||
|
||||
public void setPolicy_uri(String policy_uri) {
|
||||
this.policy_uri = policy_uri;
|
||||
}
|
||||
|
||||
public String getJwks_uri() {
|
||||
return jwks_uri;
|
||||
}
|
||||
|
||||
public void setJwks_uri(String jwks_uri) {
|
||||
this.jwks_uri = jwks_uri;
|
||||
}
|
||||
|
||||
public String getJwks() {
|
||||
return jwks;
|
||||
}
|
||||
|
||||
public void setJwks(String jwks) {
|
||||
this.jwks = jwks;
|
||||
}
|
||||
|
||||
public String getSoftwareId() {
|
||||
return softwareId;
|
||||
}
|
||||
|
||||
public void setSoftwareId(String softwareId) {
|
||||
this.softwareId = softwareId;
|
||||
}
|
||||
|
||||
public String getSoftwareVersion() {
|
||||
return softwareVersion;
|
||||
}
|
||||
|
||||
public void setSoftwareVersion(String softwareVersion) {
|
||||
this.softwareVersion = softwareVersion;
|
||||
}
|
||||
|
||||
}
|
|
@ -7,7 +7,6 @@ import org.codehaus.jackson.annotate.JsonProperty;
|
|||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:sthorger@redhat.com">Stian Thorgersen</a>
|
||||
|
@ -48,6 +47,9 @@ public class OIDCConfigurationRepresentation {
|
|||
@JsonProperty("response_modes_supported")
|
||||
private List<String> responseModesSupported;
|
||||
|
||||
@JsonProperty("registration_endpoint")
|
||||
private String registrationEndpoint;
|
||||
|
||||
protected Map<String, Object> otherClaims = new HashMap<String, Object>();
|
||||
|
||||
public String getIssuer() {
|
||||
|
@ -138,6 +140,14 @@ public class OIDCConfigurationRepresentation {
|
|||
this.responseModesSupported = responseModesSupported;
|
||||
}
|
||||
|
||||
public String getRegistrationEndpoint() {
|
||||
return registrationEndpoint;
|
||||
}
|
||||
|
||||
public void setRegistrationEndpoint(String registrationEndpoint) {
|
||||
this.registrationEndpoint = registrationEndpoint;
|
||||
}
|
||||
|
||||
@JsonAnyGetter
|
||||
public Map<String, Object> getOtherClaims() {
|
||||
return otherClaims;
|
||||
|
|
|
@ -0,0 +1,125 @@
|
|||
package org.keycloak.services.clientregistration;
|
||||
|
||||
import org.keycloak.events.EventBuilder;
|
||||
import org.keycloak.events.EventType;
|
||||
import org.keycloak.models.ClientInitialAccessModel;
|
||||
import org.keycloak.models.ClientModel;
|
||||
import org.keycloak.models.KeycloakSession;
|
||||
import org.keycloak.models.ModelDuplicateException;
|
||||
import org.keycloak.models.utils.ModelToRepresentation;
|
||||
import org.keycloak.models.utils.RepresentationToModel;
|
||||
import org.keycloak.representations.idm.ClientRepresentation;
|
||||
import org.keycloak.services.ErrorResponseException;
|
||||
import org.keycloak.services.ForbiddenException;
|
||||
|
||||
import javax.ws.rs.core.Response;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:sthorger@redhat.com">Stian Thorgersen</a>
|
||||
*/
|
||||
public abstract class AbstractClientRegistrationProvider implements ClientRegistrationProvider {
|
||||
|
||||
protected KeycloakSession session;
|
||||
protected EventBuilder event;
|
||||
protected ClientRegistrationAuth auth;
|
||||
|
||||
public AbstractClientRegistrationProvider(KeycloakSession session) {
|
||||
this.session = session;
|
||||
}
|
||||
|
||||
public ClientRepresentation create(ClientRepresentation client) {
|
||||
event.event(EventType.CLIENT_REGISTER);
|
||||
|
||||
auth.requireCreate();
|
||||
|
||||
try {
|
||||
ClientModel clientModel = RepresentationToModel.createClient(session, session.getContext().getRealm(), client, true);
|
||||
if (client.getClientId() == null) {
|
||||
clientModel.setClientId(clientModel.getId());
|
||||
}
|
||||
|
||||
client = ModelToRepresentation.toRepresentation(clientModel);
|
||||
|
||||
String registrationAccessToken = ClientRegistrationTokenUtils.updateRegistrationAccessToken(session, clientModel);
|
||||
|
||||
client.setRegistrationAccessToken(registrationAccessToken);
|
||||
|
||||
if (auth.isInitialAccessToken()) {
|
||||
ClientInitialAccessModel initialAccessModel = auth.getInitialAccessModel();
|
||||
initialAccessModel.decreaseRemainingCount();
|
||||
}
|
||||
|
||||
event.client(client.getClientId()).success();
|
||||
return client;
|
||||
} catch (ModelDuplicateException e) {
|
||||
throw new ErrorResponseException(ErrorCodes.INVALID_CLIENT_METADATA, "Client Identifier in use", Response.Status.BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
|
||||
public ClientRepresentation get(String clientId) {
|
||||
event.event(EventType.CLIENT_INFO);
|
||||
|
||||
ClientModel client = session.getContext().getRealm().getClientByClientId(clientId);
|
||||
auth.requireView(client);
|
||||
|
||||
ClientRepresentation rep = ModelToRepresentation.toRepresentation(client);
|
||||
|
||||
if (auth.isRegistrationAccessToken()) {
|
||||
String registrationAccessToken = ClientRegistrationTokenUtils.updateRegistrationAccessToken(session, client);
|
||||
rep.setRegistrationAccessToken(registrationAccessToken);
|
||||
}
|
||||
|
||||
event.client(client.getClientId()).success();
|
||||
return rep;
|
||||
}
|
||||
|
||||
public ClientRepresentation update(String clientId, ClientRepresentation rep) {
|
||||
event.event(EventType.CLIENT_UPDATE).client(clientId);
|
||||
|
||||
ClientModel client = session.getContext().getRealm().getClientByClientId(clientId);
|
||||
auth.requireUpdate(client);
|
||||
|
||||
if (!client.getClientId().equals(rep.getClientId())) {
|
||||
throw new ErrorResponseException(ErrorCodes.INVALID_CLIENT_METADATA, "Client Identifier modified", Response.Status.BAD_REQUEST);
|
||||
}
|
||||
|
||||
RepresentationToModel.updateClient(rep, client);
|
||||
rep = ModelToRepresentation.toRepresentation(client);
|
||||
|
||||
if (auth.isRegistrationAccessToken()) {
|
||||
String registrationAccessToken = ClientRegistrationTokenUtils.updateRegistrationAccessToken(session, client);
|
||||
rep.setRegistrationAccessToken(registrationAccessToken);
|
||||
}
|
||||
|
||||
event.client(client.getClientId()).success();
|
||||
return rep;
|
||||
}
|
||||
|
||||
public void delete(String clientId) {
|
||||
event.event(EventType.CLIENT_DELETE).client(clientId);
|
||||
|
||||
ClientModel client = session.getContext().getRealm().getClientByClientId(clientId);
|
||||
auth.requireUpdate(client);
|
||||
|
||||
if (session.getContext().getRealm().removeClient(client.getId())) {
|
||||
event.client(client.getClientId()).success();
|
||||
} else {
|
||||
throw new ForbiddenException();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAuth(ClientRegistrationAuth auth) {
|
||||
this.auth = auth;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEvent(EventBuilder event) {
|
||||
this.event = event;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
}
|
||||
|
||||
}
|
|
@ -25,7 +25,7 @@ public class ClientRegistrationService {
|
|||
}
|
||||
|
||||
@Path("{provider}")
|
||||
public Object getProvider(@PathParam("provider") String providerId) {
|
||||
public Object provider(@PathParam("provider") String providerId) {
|
||||
checkSsl();
|
||||
|
||||
ClientRegistrationProvider provider = session.getProvider(ClientRegistrationProvider.class, providerId);
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue