installation text
This commit is contained in:
parent
1f63e87cd6
commit
cbf46720c7
18 changed files with 310 additions and 340 deletions
107
core/src/main/java/org/keycloak/representations/config/AdapterConfig.java
Executable file
107
core/src/main/java/org/keycloak/representations/config/AdapterConfig.java
Executable file
|
@ -0,0 +1,107 @@
|
||||||
|
package org.keycloak.representations.config;
|
||||||
|
|
||||||
|
import org.codehaus.jackson.annotate.JsonProperty;
|
||||||
|
import org.codehaus.jackson.annotate.JsonPropertyOrder;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configuration for Java based adapters
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
|
||||||
|
* @version $Revision: 1 $
|
||||||
|
*/
|
||||||
|
@JsonPropertyOrder({"realm", "realm-public-key", "auth-url", "code-url", "ssl-not-required",
|
||||||
|
"resource", "credentials",
|
||||||
|
"use-resource-role-mappings",
|
||||||
|
"enable-cors", "cors-max-age", "cors-allowed-methods",
|
||||||
|
"expose-token", "bearer-only",
|
||||||
|
"connection-pool-size",
|
||||||
|
"allow-any-hostname", "disable-trust-manager", "truststore", "truststore-password",
|
||||||
|
"client-keystore", "client-keystore-password", "client-key-password"
|
||||||
|
})
|
||||||
|
public class AdapterConfig extends BaseAdapterConfig {
|
||||||
|
|
||||||
|
@JsonProperty("allow-any-hostname")
|
||||||
|
protected boolean allowAnyHostname;
|
||||||
|
@JsonProperty("disable-trust-manager")
|
||||||
|
protected boolean disableTrustManager;
|
||||||
|
@JsonProperty("truststore")
|
||||||
|
protected String truststore;
|
||||||
|
@JsonProperty("truststore-password")
|
||||||
|
protected String truststorePassword;
|
||||||
|
@JsonProperty("client-keystore")
|
||||||
|
protected String clientKeystore;
|
||||||
|
@JsonProperty("client-keystore-password")
|
||||||
|
protected String clientKeystorePassword;
|
||||||
|
@JsonProperty("client-key-password")
|
||||||
|
protected String clientKeyPassword;
|
||||||
|
@JsonProperty("connection-pool-size")
|
||||||
|
protected int connectionPoolSize = 20;
|
||||||
|
|
||||||
|
public boolean isAllowAnyHostname() {
|
||||||
|
return allowAnyHostname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAllowAnyHostname(boolean allowAnyHostname) {
|
||||||
|
this.allowAnyHostname = allowAnyHostname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isDisableTrustManager() {
|
||||||
|
return disableTrustManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDisableTrustManager(boolean disableTrustManager) {
|
||||||
|
this.disableTrustManager = disableTrustManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTruststore() {
|
||||||
|
return truststore;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTruststore(String truststore) {
|
||||||
|
this.truststore = truststore;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTruststorePassword() {
|
||||||
|
return truststorePassword;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTruststorePassword(String truststorePassword) {
|
||||||
|
this.truststorePassword = truststorePassword;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getClientKeystore() {
|
||||||
|
return clientKeystore;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setClientKeystore(String clientKeystore) {
|
||||||
|
this.clientKeystore = clientKeystore;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getClientKeystorePassword() {
|
||||||
|
return clientKeystorePassword;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setClientKeystorePassword(String clientKeystorePassword) {
|
||||||
|
this.clientKeystorePassword = clientKeystorePassword;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getClientKeyPassword() {
|
||||||
|
return clientKeyPassword;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setClientKeyPassword(String clientKeyPassword) {
|
||||||
|
this.clientKeyPassword = clientKeyPassword;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getConnectionPoolSize() {
|
||||||
|
return connectionPoolSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setConnectionPoolSize(int connectionPoolSize) {
|
||||||
|
this.connectionPoolSize = connectionPoolSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
111
core/src/main/java/org/keycloak/representations/config/BaseAdapterConfig.java
Executable file
111
core/src/main/java/org/keycloak/representations/config/BaseAdapterConfig.java
Executable file
|
@ -0,0 +1,111 @@
|
||||||
|
package org.keycloak.representations.config;
|
||||||
|
|
||||||
|
import org.codehaus.jackson.annotate.JsonProperty;
|
||||||
|
import org.codehaus.jackson.annotate.JsonPropertyOrder;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Common Adapter configuration
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
|
||||||
|
* @version $Revision: 1 $
|
||||||
|
*/
|
||||||
|
@JsonPropertyOrder({"realm", "realm-public-key", "auth-url", "code-url", "ssl-not-required",
|
||||||
|
"resource", "credentials",
|
||||||
|
"use-resource-role-mappings",
|
||||||
|
"enable-cors", "cors-max-age", "cors-allowed-methods",
|
||||||
|
"expose-token", "bearer-only"})
|
||||||
|
public class BaseAdapterConfig extends BaseRealmConfig {
|
||||||
|
@JsonProperty("resource")
|
||||||
|
protected String resource;
|
||||||
|
@JsonProperty("use-resource-role-mappings")
|
||||||
|
protected boolean useResourceRoleMappings;
|
||||||
|
@JsonProperty("enable-cors")
|
||||||
|
protected boolean cors;
|
||||||
|
@JsonProperty("cors-max-age")
|
||||||
|
protected int corsMaxAge = -1;
|
||||||
|
@JsonProperty("cors-allowed-headers")
|
||||||
|
protected String corsAllowedHeaders;
|
||||||
|
@JsonProperty("cors-allowed-methods")
|
||||||
|
protected String corsAllowedMethods;
|
||||||
|
@JsonProperty("expose-token")
|
||||||
|
protected boolean exposeToken;
|
||||||
|
@JsonProperty("bearer-only")
|
||||||
|
protected boolean bearerOnly;
|
||||||
|
@JsonProperty("credentials")
|
||||||
|
protected Map<String, String> credentials = new HashMap<String, String>();
|
||||||
|
|
||||||
|
public boolean isUseResourceRoleMappings() {
|
||||||
|
return useResourceRoleMappings;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUseResourceRoleMappings(boolean useResourceRoleMappings) {
|
||||||
|
this.useResourceRoleMappings = useResourceRoleMappings;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getResource() {
|
||||||
|
return resource;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setResource(String resource) {
|
||||||
|
this.resource = resource;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isCors() {
|
||||||
|
return cors;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCors(boolean cors) {
|
||||||
|
this.cors = cors;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCorsMaxAge() {
|
||||||
|
return corsMaxAge;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCorsMaxAge(int corsMaxAge) {
|
||||||
|
this.corsMaxAge = corsMaxAge;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCorsAllowedHeaders() {
|
||||||
|
return corsAllowedHeaders;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCorsAllowedHeaders(String corsAllowedHeaders) {
|
||||||
|
this.corsAllowedHeaders = corsAllowedHeaders;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCorsAllowedMethods() {
|
||||||
|
return corsAllowedMethods;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCorsAllowedMethods(String corsAllowedMethods) {
|
||||||
|
this.corsAllowedMethods = corsAllowedMethods;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isExposeToken() {
|
||||||
|
return exposeToken;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExposeToken(boolean exposeToken) {
|
||||||
|
this.exposeToken = exposeToken;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isBearerOnly() {
|
||||||
|
return bearerOnly;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBearerOnly(boolean bearerOnly) {
|
||||||
|
this.bearerOnly = bearerOnly;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, String> getCredentials() {
|
||||||
|
return credentials;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCredentials(Map<String, String> credentials) {
|
||||||
|
this.credentials = credentials;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,24 +1,34 @@
|
||||||
package org.keycloak.representations.idm;
|
package org.keycloak.representations.config;
|
||||||
|
|
||||||
import org.codehaus.jackson.annotate.JsonProperty;
|
import org.codehaus.jackson.annotate.JsonProperty;
|
||||||
|
import org.codehaus.jackson.annotate.JsonPropertyOrder;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="mailto:sthorger@redhat.com">Stian Thorgersen</a>
|
* Common Realm Configuration
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
|
||||||
|
* @version $Revision: 1 $
|
||||||
*/
|
*/
|
||||||
public class ApplicationInstallationRepresentation {
|
@JsonPropertyOrder({"realm", "realm-public-key", "auth-url", "code-url", "ssl-not-required"})
|
||||||
|
public class BaseRealmConfig {
|
||||||
|
@JsonProperty("realm")
|
||||||
protected String realm;
|
protected String realm;
|
||||||
protected String resource;
|
|
||||||
@JsonProperty("realm-public-key")
|
@JsonProperty("realm-public-key")
|
||||||
protected String realmPublicKey;
|
protected String realmKey;
|
||||||
@JsonProperty("auth-url")
|
@JsonProperty("auth-url")
|
||||||
protected String authUrl;
|
protected String authUrl;
|
||||||
@JsonProperty("code-url")
|
@JsonProperty("code-url")
|
||||||
protected String codeUrl;
|
protected String codeUrl;
|
||||||
@JsonProperty("ssl-not-required")
|
@JsonProperty("ssl-not-required")
|
||||||
protected boolean sslNotRequired;
|
protected boolean sslNotRequired;
|
||||||
protected Map<String, String> credentials;
|
|
||||||
|
public boolean isSslNotRequired() {
|
||||||
|
return sslNotRequired;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSslNotRequired(boolean sslNotRequired) {
|
||||||
|
this.sslNotRequired = sslNotRequired;
|
||||||
|
}
|
||||||
|
|
||||||
public String getRealm() {
|
public String getRealm() {
|
||||||
return realm;
|
return realm;
|
||||||
|
@ -28,20 +38,12 @@ public class ApplicationInstallationRepresentation {
|
||||||
this.realm = realm;
|
this.realm = realm;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getResource() {
|
public String getRealmKey() {
|
||||||
return resource;
|
return realmKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setResource(String resource) {
|
public void setRealmKey(String realmKey) {
|
||||||
this.resource = resource;
|
this.realmKey = realmKey;
|
||||||
}
|
|
||||||
|
|
||||||
public String getRealmPublicKey() {
|
|
||||||
return realmPublicKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRealmPublicKey(String realmPublicKey) {
|
|
||||||
this.realmPublicKey = realmPublicKey;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAuthUrl() {
|
public String getAuthUrl() {
|
||||||
|
@ -59,20 +61,4 @@ public class ApplicationInstallationRepresentation {
|
||||||
public void setCodeUrl(String codeUrl) {
|
public void setCodeUrl(String codeUrl) {
|
||||||
this.codeUrl = codeUrl;
|
this.codeUrl = codeUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSslNotRequired() {
|
|
||||||
return sslNotRequired;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSslNotRequired(boolean sslNotRequired) {
|
|
||||||
this.sslNotRequired = sslNotRequired;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map<String, String> getCredentials() {
|
|
||||||
return credentials;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCredentials(Map<String, String> credentials) {
|
|
||||||
this.credentials = credentials;
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -1,6 +1,7 @@
|
||||||
package org.keycloak.util;
|
package org.keycloak.util;
|
||||||
|
|
||||||
import org.codehaus.jackson.map.ObjectMapper;
|
import org.codehaus.jackson.map.ObjectMapper;
|
||||||
|
import org.codehaus.jackson.map.SerializationConfig;
|
||||||
import org.codehaus.jackson.map.annotate.JsonSerialize;
|
import org.codehaus.jackson.map.annotate.JsonSerialize;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -14,10 +15,14 @@ import java.io.InputStream;
|
||||||
*/
|
*/
|
||||||
public class JsonSerialization {
|
public class JsonSerialization {
|
||||||
public static final ObjectMapper mapper = new ObjectMapper();
|
public static final ObjectMapper mapper = new ObjectMapper();
|
||||||
|
public static final ObjectMapper prettyMapper = new ObjectMapper();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
mapper.setSerializationInclusion(JsonSerialize.Inclusion.NON_DEFAULT);
|
mapper.setSerializationInclusion(JsonSerialize.Inclusion.NON_DEFAULT);
|
||||||
mapper.setSerializationInclusion(JsonSerialize.Inclusion.NON_NULL);
|
mapper.setSerializationInclusion(JsonSerialize.Inclusion.NON_NULL);
|
||||||
|
prettyMapper.enable(SerializationConfig.Feature.INDENT_OUTPUT);
|
||||||
|
prettyMapper.setSerializationInclusion(JsonSerialize.Inclusion.NON_DEFAULT);
|
||||||
|
prettyMapper.setSerializationInclusion(JsonSerialize.Inclusion.NON_NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String writeValueAsString(Object obj) throws IOException {
|
public static String writeValueAsString(Object obj) throws IOException {
|
||||||
|
|
|
@ -1,243 +0,0 @@
|
||||||
package org.keycloak.adapters.config;
|
|
||||||
|
|
||||||
import org.codehaus.jackson.annotate.JsonProperty;
|
|
||||||
import org.codehaus.jackson.annotate.JsonPropertyOrder;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
|
|
||||||
* @version $Revision: 1 $
|
|
||||||
*/
|
|
||||||
@JsonPropertyOrder({"realm-url", "realm", "resource", "realm-public-key", "admin-role", "auth-url", "code-url", "allow-any-hostname", "disable-trust-manager", "truststore", "truststore-password", "client-id", "client-credentials"})
|
|
||||||
public class AdapterConfig
|
|
||||||
{
|
|
||||||
@JsonProperty("realm-url")
|
|
||||||
protected String realmUrl;
|
|
||||||
@JsonProperty("realm")
|
|
||||||
protected String realm;
|
|
||||||
@JsonProperty("resource")
|
|
||||||
protected String resource;
|
|
||||||
@JsonProperty("realm-public-key")
|
|
||||||
protected String realmKey;
|
|
||||||
@JsonProperty("auth-url")
|
|
||||||
protected String authUrl;
|
|
||||||
@JsonProperty("code-url")
|
|
||||||
protected String codeUrl;
|
|
||||||
@JsonProperty("use-resource-role-mappings")
|
|
||||||
protected boolean useResourceRoleMappings;
|
|
||||||
|
|
||||||
@JsonProperty("ssl-not-required")
|
|
||||||
protected boolean sslNotRequired;
|
|
||||||
@JsonProperty("allow-any-hostname")
|
|
||||||
protected boolean allowAnyHostname;
|
|
||||||
@JsonProperty("disable-trust-manager")
|
|
||||||
protected boolean disableTrustManager;
|
|
||||||
@JsonProperty("truststore")
|
|
||||||
protected String truststore;
|
|
||||||
@JsonProperty("truststore-password")
|
|
||||||
protected String truststorePassword;
|
|
||||||
@JsonProperty("client-keystore")
|
|
||||||
protected String clientKeystore;
|
|
||||||
@JsonProperty("client-keystore-password")
|
|
||||||
protected String clientKeystorePassword;
|
|
||||||
@JsonProperty("client-key-password")
|
|
||||||
protected String clientKeyPassword;
|
|
||||||
@JsonProperty("credentials")
|
|
||||||
protected Map<String, String> credentials = new HashMap<String, String>();
|
|
||||||
@JsonProperty("connection-pool-size")
|
|
||||||
protected int connectionPoolSize;
|
|
||||||
@JsonProperty("enable-cors")
|
|
||||||
protected boolean cors;
|
|
||||||
@JsonProperty("cors-max-age")
|
|
||||||
protected int corsMaxAge = -1;
|
|
||||||
@JsonProperty("cors-allowed-headers")
|
|
||||||
protected String corsAllowedHeaders;
|
|
||||||
@JsonProperty("cors-allowed-methods")
|
|
||||||
protected String corsAllowedMethods;
|
|
||||||
@JsonProperty("expose-token")
|
|
||||||
protected boolean exposeToken;
|
|
||||||
@JsonProperty("bearer-only")
|
|
||||||
protected boolean bearerOnly;
|
|
||||||
|
|
||||||
public boolean isUseResourceRoleMappings() {
|
|
||||||
return useResourceRoleMappings;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUseResourceRoleMappings(boolean useResourceRoleMappings) {
|
|
||||||
this.useResourceRoleMappings = useResourceRoleMappings;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isSslNotRequired() {
|
|
||||||
return sslNotRequired;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSslNotRequired(boolean sslNotRequired) {
|
|
||||||
this.sslNotRequired = sslNotRequired;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getRealmUrl() {
|
|
||||||
return realmUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRealmUrl(String realmUrl) {
|
|
||||||
this.realmUrl = realmUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getRealm() {
|
|
||||||
return realm;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRealm(String realm) {
|
|
||||||
this.realm = realm;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getResource() {
|
|
||||||
return resource;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setResource(String resource) {
|
|
||||||
this.resource = resource;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getRealmKey() {
|
|
||||||
return realmKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRealmKey(String realmKey) {
|
|
||||||
this.realmKey = realmKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAuthUrl() {
|
|
||||||
return authUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAuthUrl(String authUrl) {
|
|
||||||
this.authUrl = authUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCodeUrl() {
|
|
||||||
return codeUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCodeUrl(String codeUrl) {
|
|
||||||
this.codeUrl = codeUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isAllowAnyHostname() {
|
|
||||||
return allowAnyHostname;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAllowAnyHostname(boolean allowAnyHostname) {
|
|
||||||
this.allowAnyHostname = allowAnyHostname;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isDisableTrustManager() {
|
|
||||||
return disableTrustManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDisableTrustManager(boolean disableTrustManager) {
|
|
||||||
this.disableTrustManager = disableTrustManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTruststore() {
|
|
||||||
return truststore;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTruststore(String truststore) {
|
|
||||||
this.truststore = truststore;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTruststorePassword() {
|
|
||||||
return truststorePassword;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTruststorePassword(String truststorePassword) {
|
|
||||||
this.truststorePassword = truststorePassword;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map<String, String> getCredentials() {
|
|
||||||
return credentials;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getClientKeystore() {
|
|
||||||
return clientKeystore;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setClientKeystore(String clientKeystore) {
|
|
||||||
this.clientKeystore = clientKeystore;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getClientKeystorePassword() {
|
|
||||||
return clientKeystorePassword;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setClientKeystorePassword(String clientKeystorePassword) {
|
|
||||||
this.clientKeystorePassword = clientKeystorePassword;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getClientKeyPassword() {
|
|
||||||
return clientKeyPassword;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setClientKeyPassword(String clientKeyPassword) {
|
|
||||||
this.clientKeyPassword = clientKeyPassword;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getConnectionPoolSize() {
|
|
||||||
return connectionPoolSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setConnectionPoolSize(int connectionPoolSize) {
|
|
||||||
this.connectionPoolSize = connectionPoolSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isCors() {
|
|
||||||
return cors;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCors(boolean cors) {
|
|
||||||
this.cors = cors;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getCorsMaxAge() {
|
|
||||||
return corsMaxAge;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCorsMaxAge(int corsMaxAge) {
|
|
||||||
this.corsMaxAge = corsMaxAge;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCorsAllowedHeaders() {
|
|
||||||
return corsAllowedHeaders;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCorsAllowedHeaders(String corsAllowedHeaders) {
|
|
||||||
this.corsAllowedHeaders = corsAllowedHeaders;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCorsAllowedMethods() {
|
|
||||||
return corsAllowedMethods;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCorsAllowedMethods(String corsAllowedMethods) {
|
|
||||||
this.corsAllowedMethods = corsAllowedMethods;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isExposeToken() {
|
|
||||||
return exposeToken;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setExposeToken(boolean exposeToken) {
|
|
||||||
this.exposeToken = exposeToken;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isBearerOnly() {
|
|
||||||
return bearerOnly;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBearerOnly(boolean bearerOnly) {
|
|
||||||
this.bearerOnly = bearerOnly;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -5,6 +5,7 @@ import org.codehaus.jackson.map.annotate.JsonSerialize;
|
||||||
import org.keycloak.EnvUtil;
|
import org.keycloak.EnvUtil;
|
||||||
import org.keycloak.PemUtils;
|
import org.keycloak.PemUtils;
|
||||||
import org.keycloak.ResourceMetadata;
|
import org.keycloak.ResourceMetadata;
|
||||||
|
import org.keycloak.representations.config.AdapterConfig;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
|
|
|
@ -8,7 +8,7 @@ import org.apache.catalina.connector.Response;
|
||||||
import org.apache.catalina.valves.ValveBase;
|
import org.apache.catalina.valves.ValveBase;
|
||||||
import org.jboss.logging.Logger;
|
import org.jboss.logging.Logger;
|
||||||
import org.keycloak.SkeletonKeySession;
|
import org.keycloak.SkeletonKeySession;
|
||||||
import org.keycloak.adapters.config.AdapterConfig;
|
import org.keycloak.representations.config.AdapterConfig;
|
||||||
import org.keycloak.representations.SkeletonKeyToken;
|
import org.keycloak.representations.SkeletonKeyToken;
|
||||||
|
|
||||||
import javax.management.ObjectName;
|
import javax.management.ObjectName;
|
||||||
|
|
|
@ -13,7 +13,7 @@ import org.jboss.logging.Logger;
|
||||||
import org.keycloak.ResourceMetadata;
|
import org.keycloak.ResourceMetadata;
|
||||||
import org.keycloak.SkeletonKeySession;
|
import org.keycloak.SkeletonKeySession;
|
||||||
import org.keycloak.adapters.as7.config.CatalinaAdapterConfigLoader;
|
import org.keycloak.adapters.as7.config.CatalinaAdapterConfigLoader;
|
||||||
import org.keycloak.adapters.config.AdapterConfig;
|
import org.keycloak.representations.config.AdapterConfig;
|
||||||
import org.keycloak.adapters.config.AdapterConfigLoader;
|
import org.keycloak.adapters.config.AdapterConfigLoader;
|
||||||
|
|
||||||
import javax.security.auth.login.LoginException;
|
import javax.security.auth.login.LoginException;
|
||||||
|
|
|
@ -3,7 +3,7 @@ package org.keycloak.adapters.as7;
|
||||||
import org.apache.catalina.connector.Request;
|
import org.apache.catalina.connector.Request;
|
||||||
import org.apache.catalina.connector.Response;
|
import org.apache.catalina.connector.Response;
|
||||||
import org.jboss.logging.Logger;
|
import org.jboss.logging.Logger;
|
||||||
import org.keycloak.adapters.config.AdapterConfig;
|
import org.keycloak.representations.config.AdapterConfig;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
|
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
|
||||||
|
|
|
@ -17,7 +17,7 @@ import org.keycloak.ResourceMetadata;
|
||||||
import org.keycloak.SkeletonKeyPrincipal;
|
import org.keycloak.SkeletonKeyPrincipal;
|
||||||
import org.keycloak.SkeletonKeySession;
|
import org.keycloak.SkeletonKeySession;
|
||||||
import org.keycloak.adapters.as7.config.CatalinaAdapterConfigLoader;
|
import org.keycloak.adapters.as7.config.CatalinaAdapterConfigLoader;
|
||||||
import org.keycloak.adapters.config.AdapterConfig;
|
import org.keycloak.representations.config.AdapterConfig;
|
||||||
import org.keycloak.adapters.config.RealmConfiguration;
|
import org.keycloak.adapters.config.RealmConfiguration;
|
||||||
import org.keycloak.adapters.config.RealmConfigurationLoader;
|
import org.keycloak.adapters.config.RealmConfigurationLoader;
|
||||||
import org.keycloak.jose.jws.JWSInput;
|
import org.keycloak.jose.jws.JWSInput;
|
||||||
|
|
|
@ -5,7 +5,7 @@ import io.undertow.server.HttpServerExchange;
|
||||||
import io.undertow.util.Headers;
|
import io.undertow.util.Headers;
|
||||||
import org.jboss.logging.Logger;
|
import org.jboss.logging.Logger;
|
||||||
import org.keycloak.SkeletonKeySession;
|
import org.keycloak.SkeletonKeySession;
|
||||||
import org.keycloak.adapters.config.AdapterConfig;
|
import org.keycloak.representations.config.AdapterConfig;
|
||||||
import org.keycloak.representations.SkeletonKeyToken;
|
import org.keycloak.representations.SkeletonKeyToken;
|
||||||
|
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
|
|
|
@ -10,7 +10,7 @@ import org.keycloak.adapters.config.RealmConfiguration;
|
||||||
import org.keycloak.ResourceMetadata;
|
import org.keycloak.ResourceMetadata;
|
||||||
import org.keycloak.SkeletonKeyPrincipal;
|
import org.keycloak.SkeletonKeyPrincipal;
|
||||||
import org.keycloak.SkeletonKeySession;
|
import org.keycloak.SkeletonKeySession;
|
||||||
import org.keycloak.adapters.config.AdapterConfig;
|
import org.keycloak.representations.config.AdapterConfig;
|
||||||
import org.keycloak.representations.SkeletonKeyToken;
|
import org.keycloak.representations.SkeletonKeyToken;
|
||||||
|
|
||||||
import java.security.Principal;
|
import java.security.Principal;
|
||||||
|
|
|
@ -7,7 +7,7 @@ import io.undertow.servlet.ServletExtension;
|
||||||
import io.undertow.servlet.api.DeploymentInfo;
|
import io.undertow.servlet.api.DeploymentInfo;
|
||||||
import io.undertow.servlet.api.ServletSessionConfig;
|
import io.undertow.servlet.api.ServletSessionConfig;
|
||||||
import org.jboss.logging.Logger;
|
import org.jboss.logging.Logger;
|
||||||
import org.keycloak.adapters.config.AdapterConfig;
|
import org.keycloak.representations.config.AdapterConfig;
|
||||||
import org.keycloak.adapters.config.RealmConfigurationLoader;
|
import org.keycloak.adapters.config.RealmConfigurationLoader;
|
||||||
|
|
||||||
import javax.servlet.ServletContext;
|
import javax.servlet.ServletContext;
|
||||||
|
|
|
@ -5,7 +5,7 @@ import io.undertow.server.HttpHandler;
|
||||||
import io.undertow.server.HttpServerExchange;
|
import io.undertow.server.HttpServerExchange;
|
||||||
import io.undertow.util.HttpString;
|
import io.undertow.util.HttpString;
|
||||||
import org.jboss.logging.Logger;
|
import org.jboss.logging.Logger;
|
||||||
import org.keycloak.adapters.config.AdapterConfig;
|
import org.keycloak.representations.config.AdapterConfig;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
|
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
|
||||||
|
|
|
@ -5,7 +5,7 @@ import io.undertow.server.HttpHandler;
|
||||||
import io.undertow.server.HttpServerExchange;
|
import io.undertow.server.HttpServerExchange;
|
||||||
import io.undertow.servlet.handlers.ServletRequestContext;
|
import io.undertow.servlet.handlers.ServletRequestContext;
|
||||||
import org.keycloak.SkeletonKeySession;
|
import org.keycloak.SkeletonKeySession;
|
||||||
import org.keycloak.adapters.config.AdapterConfig;
|
import org.keycloak.representations.config.AdapterConfig;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpSession;
|
import javax.servlet.http.HttpSession;
|
||||||
|
|
|
@ -6,7 +6,7 @@ import io.undertow.servlet.handlers.ServletRequestContext;
|
||||||
import org.keycloak.adapters.config.RealmConfiguration;
|
import org.keycloak.adapters.config.RealmConfiguration;
|
||||||
import org.keycloak.ResourceMetadata;
|
import org.keycloak.ResourceMetadata;
|
||||||
import org.keycloak.SkeletonKeySession;
|
import org.keycloak.SkeletonKeySession;
|
||||||
import org.keycloak.adapters.config.AdapterConfig;
|
import org.keycloak.representations.config.AdapterConfig;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpSession;
|
import javax.servlet.http.HttpSession;
|
||||||
|
|
|
@ -7,8 +7,9 @@ import org.keycloak.models.RealmModel;
|
||||||
import org.keycloak.models.RoleModel;
|
import org.keycloak.models.RoleModel;
|
||||||
import org.keycloak.models.UserCredentialModel;
|
import org.keycloak.models.UserCredentialModel;
|
||||||
import org.keycloak.models.UserModel;
|
import org.keycloak.models.UserModel;
|
||||||
|
import org.keycloak.representations.config.AdapterConfig;
|
||||||
|
import org.keycloak.representations.config.BaseAdapterConfig;
|
||||||
import org.keycloak.representations.idm.ApplicationRepresentation;
|
import org.keycloak.representations.idm.ApplicationRepresentation;
|
||||||
import org.keycloak.representations.idm.ApplicationInstallationRepresentation;
|
|
||||||
import org.keycloak.representations.idm.CredentialRepresentation;
|
import org.keycloak.representations.idm.CredentialRepresentation;
|
||||||
import org.keycloak.representations.idm.RoleRepresentation;
|
import org.keycloak.representations.idm.RoleRepresentation;
|
||||||
import org.keycloak.representations.idm.ScopeMappingRepresentation;
|
import org.keycloak.representations.idm.ScopeMappingRepresentation;
|
||||||
|
@ -175,16 +176,17 @@ public class ApplicationManager {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ApplicationInstallationRepresentation toInstallationRepresentation(RealmModel realmModel, ApplicationModel applicationModel, URI baseUri) {
|
public BaseAdapterConfig toInstallationRepresentation(RealmModel realmModel, ApplicationModel applicationModel, URI baseUri) {
|
||||||
ApplicationInstallationRepresentation rep = new ApplicationInstallationRepresentation();
|
BaseAdapterConfig rep = new BaseAdapterConfig();
|
||||||
rep.setRealm(realmModel.getId());
|
rep.setRealm(realmModel.getId());
|
||||||
rep.setRealmPublicKey(realmModel.getPublicKeyPem());
|
rep.setRealmKey(realmModel.getPublicKeyPem());
|
||||||
rep.setSslNotRequired(realmModel.isSslNotRequired());
|
rep.setSslNotRequired(realmModel.isSslNotRequired());
|
||||||
|
|
||||||
rep.setAuthUrl(Urls.realmLoginPage(baseUri, realmModel.getId()).toString());
|
rep.setAuthUrl(Urls.realmLoginPage(baseUri, realmModel.getId()).toString());
|
||||||
rep.setCodeUrl(Urls.realmCode(baseUri, realmModel.getId()).toString());
|
rep.setCodeUrl(Urls.realmCode(baseUri, realmModel.getId()).toString());
|
||||||
|
rep.setUseResourceRoleMappings(applicationModel.getRoles().size() > 0);
|
||||||
|
|
||||||
rep.setResource(applicationModel.getId());
|
rep.setResource(applicationModel.getName());
|
||||||
|
|
||||||
Map<String, String> creds = new HashMap<String, String>();
|
Map<String, String> creds = new HashMap<String, String>();
|
||||||
creds.put(CredentialRepresentation.PASSWORD, "INSERT APPLICATION PASSWORD");
|
creds.put(CredentialRepresentation.PASSWORD, "INSERT APPLICATION PASSWORD");
|
||||||
|
|
|
@ -7,11 +7,13 @@ import org.keycloak.models.ApplicationModel;
|
||||||
import org.keycloak.models.KeycloakSession;
|
import org.keycloak.models.KeycloakSession;
|
||||||
import org.keycloak.models.RealmModel;
|
import org.keycloak.models.RealmModel;
|
||||||
import org.keycloak.models.UserCredentialModel;
|
import org.keycloak.models.UserCredentialModel;
|
||||||
import org.keycloak.representations.idm.ApplicationInstallationRepresentation;
|
import org.keycloak.representations.config.AdapterConfig;
|
||||||
|
import org.keycloak.representations.config.BaseAdapterConfig;
|
||||||
import org.keycloak.representations.idm.ApplicationRepresentation;
|
import org.keycloak.representations.idm.ApplicationRepresentation;
|
||||||
import org.keycloak.representations.idm.CredentialRepresentation;
|
import org.keycloak.representations.idm.CredentialRepresentation;
|
||||||
import org.keycloak.services.managers.ApplicationManager;
|
import org.keycloak.services.managers.ApplicationManager;
|
||||||
import org.keycloak.services.managers.RealmManager;
|
import org.keycloak.services.managers.RealmManager;
|
||||||
|
import org.keycloak.util.JsonSerialization;
|
||||||
|
|
||||||
import javax.ws.rs.Consumes;
|
import javax.ws.rs.Consumes;
|
||||||
import javax.ws.rs.DELETE;
|
import javax.ws.rs.DELETE;
|
||||||
|
@ -68,11 +70,10 @@ public class ApplicationResource extends RoleContainerResource {
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
public String getInstallation() throws IOException {
|
public String getInstallation() throws IOException {
|
||||||
ApplicationManager applicationManager = new ApplicationManager(new RealmManager(session));
|
ApplicationManager applicationManager = new ApplicationManager(new RealmManager(session));
|
||||||
ApplicationInstallationRepresentation rep = applicationManager.toInstallationRepresentation(realm, application, uriInfo.getBaseUri());
|
BaseAdapterConfig rep = applicationManager.toInstallationRepresentation(realm, application, uriInfo.getBaseUri());
|
||||||
|
|
||||||
// TODO Temporary solution to pretty-print
|
// TODO Temporary solution to pretty-print
|
||||||
ObjectMapper mapper = new ObjectMapper();
|
return JsonSerialization.mapper.writerWithDefaultPrettyPrinter().writeValueAsString(rep);
|
||||||
return mapper.writerWithDefaultPrettyPrinter().writeValueAsString(rep);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@DELETE
|
@DELETE
|
||||||
|
|
Loading…
Reference in a new issue