commit
d429525620
23 changed files with 87 additions and 854 deletions
|
@ -1,16 +0,0 @@
|
||||||
Self Bootstrapping Keycloak Server and Bundled Application
|
|
||||||
==========================================================
|
|
||||||
|
|
||||||
This is an example of bundling the Keycloak server with an app within the same WAR in an EAP 6.x environment.
|
|
||||||
|
|
||||||
* On bootup, a default realm is imported from WEB-INF/testrealm.json if it doesn't exist yet.
|
|
||||||
* On bootup, the adapter config is created on the fly and configured with the testrealm imported.
|
|
||||||
* The application is secured with keycloak (see jboss-web.xml)
|
|
||||||
* web.xml security constraints are set for the secured URLs that are secured by keycloak
|
|
||||||
* Because of weirdness with Resteasy 2.3.x, any secured JAX-RS urls from the application must have a security
|
|
||||||
constraint that denies all as they will be reachable in two places. Under the Keycloak REST url "/rest" and under the
|
|
||||||
application's REST url "/database".
|
|
||||||
* Adapter config can be modified on the fly by getting the AdapterDeploymentContext from a servlet context attribute.
|
|
||||||
* You must specify a host-port context param so that the auth url for AdapterConfig can be set correctly.
|
|
||||||
|
|
||||||
* Run this demo by going to http://localhost:8080/app-bundle. Then click on the url.
|
|
|
@ -1,283 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
|
||||||
<parent>
|
|
||||||
<artifactId>keycloak-parent</artifactId>
|
|
||||||
<groupId>org.keycloak</groupId>
|
|
||||||
<version>1.0-beta-1-SNAPSHOT</version>
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
<artifactId>app-bundle</artifactId>
|
|
||||||
<packaging>war</packaging>
|
|
||||||
<name>Keycloak Server and App Bundle EAP 6.x</name>
|
|
||||||
<description/>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.bouncycastle</groupId>
|
|
||||||
<artifactId>bcprov-jdk16</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.keycloak</groupId>
|
|
||||||
<artifactId>keycloak-core</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.keycloak</groupId>
|
|
||||||
<artifactId>keycloak-adapter-core</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.keycloak</groupId>
|
|
||||||
<artifactId>keycloak-jboss-adapter-core</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.keycloak</groupId>
|
|
||||||
<artifactId>keycloak-as7-adapter</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>net.iharder</groupId>
|
|
||||||
<artifactId>base64</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.keycloak</groupId>
|
|
||||||
<artifactId>keycloak-core-jaxrs</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.keycloak</groupId>
|
|
||||||
<artifactId>keycloak-services</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.google.zxing</groupId>
|
|
||||||
<artifactId>javase</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.keycloak</groupId>
|
|
||||||
<artifactId>keycloak-model-api</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.keycloak</groupId>
|
|
||||||
<artifactId>keycloak-model-jpa</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.keycloak</groupId>
|
|
||||||
<artifactId>keycloak-audit-api</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.keycloak</groupId>
|
|
||||||
<artifactId>keycloak-audit-jpa</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.keycloak</groupId>
|
|
||||||
<artifactId>keycloak-audit-jboss-logging</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<!-- social -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.keycloak</groupId>
|
|
||||||
<artifactId>keycloak-social-core</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.keycloak</groupId>
|
|
||||||
<artifactId>keycloak-social-github</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.keycloak</groupId>
|
|
||||||
<artifactId>keycloak-social-google</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.keycloak</groupId>
|
|
||||||
<artifactId>keycloak-social-twitter</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.twitter4j</groupId>
|
|
||||||
<artifactId>twitter4j-core</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.keycloak</groupId>
|
|
||||||
<artifactId>keycloak-social-facebook</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<!-- forms -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.keycloak</groupId>
|
|
||||||
<artifactId>keycloak-forms-common-freemarker</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.freemarker</groupId>
|
|
||||||
<artifactId>freemarker</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.keycloak</groupId>
|
|
||||||
<artifactId>keycloak-forms-common-themes</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.keycloak</groupId>
|
|
||||||
<artifactId>keycloak-account-api</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.keycloak</groupId>
|
|
||||||
<artifactId>keycloak-account-freemarker</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.keycloak</groupId>
|
|
||||||
<artifactId>keycloak-login-api</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.keycloak</groupId>
|
|
||||||
<artifactId>keycloak-login-freemarker</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.keycloak</groupId>
|
|
||||||
<artifactId>keycloak-js-adapter</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<!-- authentication api -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.keycloak</groupId>
|
|
||||||
<artifactId>keycloak-authentication-api</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.keycloak</groupId>
|
|
||||||
<artifactId>keycloak-authentication-model</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.keycloak</groupId>
|
|
||||||
<artifactId>keycloak-authentication-picketlink</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.picketlink</groupId>
|
|
||||||
<artifactId>picketlink-common</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.picketlink</groupId>
|
|
||||||
<artifactId>picketlink-idm-api</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.picketlink</groupId>
|
|
||||||
<artifactId>picketlink-idm-impl</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.picketlink</groupId>
|
|
||||||
<artifactId>picketlink-idm-simple-schema</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- timer -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.keycloak</groupId>
|
|
||||||
<artifactId>keycloak-timer-api</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.keycloak</groupId>
|
|
||||||
<artifactId>keycloak-timer-basic</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- picketlink -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.keycloak</groupId>
|
|
||||||
<artifactId>keycloak-picketlink-api</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.keycloak</groupId>
|
|
||||||
<artifactId>keycloak-picketlink-realm</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.jboss.spec.javax.servlet</groupId>
|
|
||||||
<artifactId>jboss-servlet-api_3.0_spec</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<!-- resteasy -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.jboss.resteasy</groupId>
|
|
||||||
<artifactId>resteasy-jaxrs</artifactId>
|
|
||||||
<version>${resteasy.version}</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.jboss.resteasy</groupId>
|
|
||||||
<artifactId>resteasy-multipart-provider</artifactId>
|
|
||||||
<version>${resteasy.version}</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.jboss.resteasy</groupId>
|
|
||||||
<artifactId>async-http-servlet-3.0</artifactId>
|
|
||||||
<version>${resteasy.version}</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.jboss.resteasy</groupId>
|
|
||||||
<artifactId>jaxrs-api</artifactId>
|
|
||||||
<version>${resteasy.version}</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.jboss.resteasy</groupId>
|
|
||||||
<artifactId>resteasy-jackson-provider</artifactId>
|
|
||||||
<version>${resteasy.version}</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- CDI -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>javax.enterprise</groupId>
|
|
||||||
<artifactId>cdi-api</artifactId>
|
|
||||||
<version>1.1</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
<build>
|
|
||||||
<finalName>app-bundle</finalName>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.jboss.as.plugins</groupId>
|
|
||||||
<artifactId>jboss-as-maven-plugin</artifactId>
|
|
||||||
<version>7.5.Final</version>
|
|
||||||
</plugin>
|
|
||||||
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-deploy-plugin</artifactId>
|
|
||||||
<configuration>
|
|
||||||
<skip>true</skip>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
|
||||||
<configuration>
|
|
||||||
<source>${maven.compiler.source}</source>
|
|
||||||
<target>${maven.compiler.target}</target>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
</project>
|
|
|
@ -1,72 +0,0 @@
|
||||||
package org.keycloak.example;
|
|
||||||
|
|
||||||
import org.apache.http.HttpEntity;
|
|
||||||
import org.apache.http.HttpResponse;
|
|
||||||
import org.apache.http.client.HttpClient;
|
|
||||||
import org.apache.http.client.methods.HttpGet;
|
|
||||||
import org.keycloak.KeycloakSecurityContext;
|
|
||||||
import org.keycloak.adapters.HttpClientBuilder;
|
|
||||||
import org.keycloak.representations.IDToken;
|
|
||||||
import org.keycloak.util.JsonSerialization;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
|
|
||||||
* @version $Revision: 1 $
|
|
||||||
*/
|
|
||||||
public class CustomerDatabaseClient {
|
|
||||||
|
|
||||||
static class TypedList extends ArrayList<String> {
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class Failure extends Exception {
|
|
||||||
private int status;
|
|
||||||
|
|
||||||
public Failure(int status) {
|
|
||||||
this.status = status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getStatus() {
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static IDToken getIDToken(HttpServletRequest req) {
|
|
||||||
KeycloakSecurityContext session = (KeycloakSecurityContext) req.getAttribute(KeycloakSecurityContext.class.getName());
|
|
||||||
return session.getIdToken();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static List<String> getCustomers(HttpServletRequest req) throws Failure {
|
|
||||||
KeycloakSecurityContext session = (KeycloakSecurityContext) req.getAttribute(KeycloakSecurityContext.class.getName());
|
|
||||||
|
|
||||||
HttpClient client = new HttpClientBuilder()
|
|
||||||
.disableTrustManager().build();
|
|
||||||
try {
|
|
||||||
HttpGet get = new HttpGet("http://localhost:8080/app-bundle/database/customers");
|
|
||||||
get.addHeader("Authorization", "Bearer " + session.getTokenString());
|
|
||||||
try {
|
|
||||||
HttpResponse response = client.execute(get);
|
|
||||||
if (response.getStatusLine().getStatusCode() != 200) {
|
|
||||||
throw new Failure(response.getStatusLine().getStatusCode());
|
|
||||||
}
|
|
||||||
HttpEntity entity = response.getEntity();
|
|
||||||
InputStream is = entity.getContent();
|
|
||||||
try {
|
|
||||||
return JsonSerialization.readValue(is, TypedList.class);
|
|
||||||
} finally {
|
|
||||||
is.close();
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
} finally {
|
|
||||||
client.getConnectionManager().shutdown();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,35 +0,0 @@
|
||||||
/**
|
|
||||||
* JBoss, Home of Professional Open Source
|
|
||||||
* Copyright Red Hat, Inc., and individual contributors.
|
|
||||||
*
|
|
||||||
* 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.example.oauth;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class CustomerDataProvider {
|
|
||||||
|
|
||||||
public List<String> getCustomers() {
|
|
||||||
ArrayList<String> rtn = new ArrayList<String>();
|
|
||||||
rtn.add("Bill Burke");
|
|
||||||
rtn.add("Stian Thorgersen");
|
|
||||||
rtn.add("Stan Silvert");
|
|
||||||
rtn.add("Gabriel Cardoso");
|
|
||||||
rtn.add("Viliam Rockai");
|
|
||||||
rtn.add("Marek Posolda");
|
|
||||||
rtn.add("Boleslaw Dawidowicz");
|
|
||||||
return rtn;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,27 +0,0 @@
|
||||||
package org.keycloak.example.oauth;
|
|
||||||
|
|
||||||
import org.jboss.resteasy.annotations.cache.NoCache;
|
|
||||||
|
|
||||||
import javax.inject.Inject;
|
|
||||||
import javax.ws.rs.GET;
|
|
||||||
import javax.ws.rs.Path;
|
|
||||||
import javax.ws.rs.Produces;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
|
|
||||||
* @version $Revision: 1 $
|
|
||||||
*/
|
|
||||||
@Path("customers")
|
|
||||||
public class CustomerService {
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private CustomerDataProvider provider;
|
|
||||||
|
|
||||||
@GET
|
|
||||||
@Produces("application/json")
|
|
||||||
@NoCache
|
|
||||||
public List<String> getCustomers() {
|
|
||||||
return provider.getCustomers();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,25 +0,0 @@
|
||||||
package org.keycloak.example.oauth;
|
|
||||||
|
|
||||||
import javax.ws.rs.core.Application;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
|
|
||||||
* @version $Revision: 1 $
|
|
||||||
*/
|
|
||||||
public class DataApplication extends Application
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public Set<Class<?>> getClasses() {
|
|
||||||
HashSet<Class<?>> set = new HashSet<Class<?>>();
|
|
||||||
set.add(CustomerService.class);
|
|
||||||
set.add(ProductService.class);
|
|
||||||
return set;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Set<Object> getSingletons() {
|
|
||||||
return super.getSingletons(); //To change body of overridden methods use File | Settings | File Templates.
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,27 +0,0 @@
|
||||||
package org.keycloak.example.oauth;
|
|
||||||
|
|
||||||
import org.jboss.resteasy.annotations.cache.NoCache;
|
|
||||||
|
|
||||||
import javax.ws.rs.GET;
|
|
||||||
import javax.ws.rs.Path;
|
|
||||||
import javax.ws.rs.Produces;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
|
|
||||||
* @version $Revision: 1 $
|
|
||||||
*/
|
|
||||||
@Path("products")
|
|
||||||
public class ProductService {
|
|
||||||
@GET
|
|
||||||
@Produces("application/json")
|
|
||||||
@NoCache
|
|
||||||
public List<String> getProducts() {
|
|
||||||
ArrayList<String> rtn = new ArrayList<String>();
|
|
||||||
rtn.add("iphone");
|
|
||||||
rtn.add("ipad");
|
|
||||||
rtn.add("ipod");
|
|
||||||
return rtn;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,24 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!--
|
|
||||||
|
|
||||||
JBoss, Home of Professional Open Source
|
|
||||||
Copyright Red Hat, Inc., and individual contributors.
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
-->
|
|
||||||
<beans xmlns="http://java.sun.com/xml/ns/javaee"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://jboss.org/schema/cdi/beans_1_0.xsd">
|
|
||||||
|
|
||||||
</beans>
|
|
|
@ -1,41 +0,0 @@
|
||||||
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
|
|
||||||
version="1.0">
|
|
||||||
<persistence-unit name="jpa-keycloak-identity-store" transaction-type="RESOURCE_LOCAL">
|
|
||||||
<jta-data-source>java:jboss/datasources/ExampleDS</jta-data-source>
|
|
||||||
<class>org.keycloak.models.jpa.entities.ApplicationEntity</class>
|
|
||||||
<class>org.keycloak.models.jpa.entities.CredentialEntity</class>
|
|
||||||
<class>org.keycloak.models.jpa.entities.OAuthClientEntity</class>
|
|
||||||
<class>org.keycloak.models.jpa.entities.RealmEntity</class>
|
|
||||||
<class>org.keycloak.models.jpa.entities.RequiredCredentialEntity</class>
|
|
||||||
<class>org.keycloak.models.jpa.entities.AuthenticationProviderEntity</class>
|
|
||||||
<class>org.keycloak.models.jpa.entities.ApplicationRoleEntity</class>
|
|
||||||
<class>org.keycloak.models.jpa.entities.RealmRoleEntity</class>
|
|
||||||
<class>org.keycloak.models.jpa.entities.SocialLinkEntity</class>
|
|
||||||
<class>org.keycloak.models.jpa.entities.AuthenticationLinkEntity</class>
|
|
||||||
<class>org.keycloak.models.jpa.entities.UserEntity</class>
|
|
||||||
<class>org.keycloak.models.jpa.entities.UserSessionEntity</class>
|
|
||||||
<class>org.keycloak.models.jpa.entities.UsernameLoginFailureEntity</class>
|
|
||||||
<class>org.keycloak.models.jpa.entities.UserRoleMappingEntity</class>
|
|
||||||
<class>org.keycloak.models.jpa.entities.ScopeMappingEntity</class>
|
|
||||||
|
|
||||||
<exclude-unlisted-classes>true</exclude-unlisted-classes>
|
|
||||||
|
|
||||||
<properties>
|
|
||||||
<property name="hibernate.hbm2ddl.auto" value="update" />
|
|
||||||
</properties>
|
|
||||||
</persistence-unit>
|
|
||||||
|
|
||||||
<persistence-unit name="jpa-keycloak-audit-store" transaction-type="RESOURCE_LOCAL">
|
|
||||||
<jta-data-source>java:jboss/datasources/ExampleDS</jta-data-source>
|
|
||||||
<class>org.keycloak.audit.jpa.EventEntity</class>
|
|
||||||
|
|
||||||
<exclude-unlisted-classes>true</exclude-unlisted-classes>
|
|
||||||
|
|
||||||
<properties>
|
|
||||||
<property name="hibernate.hbm2ddl.auto" value="update" />
|
|
||||||
</properties>
|
|
||||||
</persistence-unit>
|
|
||||||
|
|
||||||
</persistence>
|
|
|
@ -1,36 +0,0 @@
|
||||||
<jboss-deployment-structure>
|
|
||||||
<deployment>
|
|
||||||
<dependencies>
|
|
||||||
<module name="org.apache.httpcomponents"/>
|
|
||||||
<module name="org.codehaus.jackson.jackson-core-asl"/>
|
|
||||||
<module name="org.codehaus.jackson.jackson-mapper-asl"/>
|
|
||||||
</dependencies>
|
|
||||||
<exclusions>
|
|
||||||
|
|
||||||
<!-- Exclude keycloak modules -->
|
|
||||||
<module name="org.keycloak.keycloak-core" />
|
|
||||||
<module name="org.keycloak.keycloak-adapter-core" />
|
|
||||||
<module name="org.keycloak.keycloak-undertow-adapter" />
|
|
||||||
<module name="org.keycloak.keycloak-as7-adapter" />
|
|
||||||
|
|
||||||
<!--
|
|
||||||
<module name="org.apache.cxf" />
|
|
||||||
<module name="javaee.api" />
|
|
||||||
<module name="javax.ws.rs.api"/>
|
|
||||||
<module name="org.codehaus.jackson.jackson-core-asl" />
|
|
||||||
<module name="org.jboss.resteasy.resteasy-atom-provider" />
|
|
||||||
<module name="org.jboss.resteasy.resteasy-cdi" />
|
|
||||||
<module name="org.jboss.resteasy.resteasy-crypto" />
|
|
||||||
<module name="org.jboss.resteasy.resteasy-jackson-provider" />
|
|
||||||
<module name="org.jboss.resteasy.resteasy-jaxb-provider" />
|
|
||||||
<module name="org.jboss.resteasy.resteasy-jaxrs" />
|
|
||||||
<module name="org.jboss.resteasy.resteasy-jettison-provider" />
|
|
||||||
<module name="org.jboss.resteasy.resteasy-jsapi" />
|
|
||||||
<module name="org.jboss.resteasy.resteasy-json-p-provider" />
|
|
||||||
<module name="org.jboss.resteasy.resteasy-multipart-provider" />
|
|
||||||
<module name="org.jboss.resteasy.resteasy-validator-provider-11" />
|
|
||||||
<module name="org.jboss.resteasy.resteasy-yaml-provider" />
|
|
||||||
-->
|
|
||||||
</exclusions>
|
|
||||||
</deployment>
|
|
||||||
</jboss-deployment-structure>
|
|
|
@ -1,5 +0,0 @@
|
||||||
<jboss-web>
|
|
||||||
<valve>
|
|
||||||
<class-name>org.keycloak.adapters.as7.KeycloakAuthenticatorValve</class-name>
|
|
||||||
</valve>
|
|
||||||
</jboss-web>
|
|
|
@ -1,70 +0,0 @@
|
||||||
{
|
|
||||||
"realm": "demo",
|
|
||||||
"enabled": true,
|
|
||||||
"accessTokenLifespan": 3000,
|
|
||||||
"accessCodeLifespan": 10,
|
|
||||||
"accessCodeLifespanUserAction": 6000,
|
|
||||||
"sslNotRequired": true,
|
|
||||||
"registrationAllowed": false,
|
|
||||||
"social": false,
|
|
||||||
"updateProfileOnInitialSocialLogin": false,
|
|
||||||
"requiredCredentials": [ "password" ],
|
|
||||||
"users" : [
|
|
||||||
{
|
|
||||||
"username" : "bburke@redhat.com",
|
|
||||||
"enabled": true,
|
|
||||||
"email" : "bburke@redhat.com",
|
|
||||||
"firstName": "Bill",
|
|
||||||
"lastName": "Burke",
|
|
||||||
"credentials" : [
|
|
||||||
{ "type" : "password",
|
|
||||||
"value" : "password" }
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"roles" : {
|
|
||||||
"realm" : [
|
|
||||||
{
|
|
||||||
"name": "user",
|
|
||||||
"description": "User privileges"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "admin",
|
|
||||||
"description": "Administrator privileges"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"roleMappings": [
|
|
||||||
{
|
|
||||||
"username": "bburke@redhat.com",
|
|
||||||
"roles": ["user"]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"scopeMappings": [
|
|
||||||
{
|
|
||||||
"client": "customer-portal",
|
|
||||||
"roles": ["user"]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"applications": [
|
|
||||||
{
|
|
||||||
"name": "customer-portal",
|
|
||||||
"enabled": true,
|
|
||||||
"adminUrl": "http://localhost:8080/app-bundle",
|
|
||||||
"baseUrl": "http://localhost:8080/app-bundle",
|
|
||||||
"redirectUris": [
|
|
||||||
"http://localhost:8080/app-bundle/*"
|
|
||||||
],
|
|
||||||
"secret": "password"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"applicationRoleMappings": {
|
|
||||||
"account": [
|
|
||||||
{
|
|
||||||
"username": "bburke@redhat.com",
|
|
||||||
"roles": ["manage-account"]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,130 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
|
|
||||||
version="3.0">
|
|
||||||
|
|
||||||
<module-name>app-bundle</module-name>
|
|
||||||
<context-param>
|
|
||||||
<param-name>host-port</param-name>
|
|
||||||
<param-value>localhost:8080</param-value>
|
|
||||||
</context-param>
|
|
||||||
|
|
||||||
<context-param>
|
|
||||||
<param-name>keycloak.import.realm.resources</param-name>
|
|
||||||
<param-value>/WEB-INF/testrealm.json</param-value>
|
|
||||||
</context-param>
|
|
||||||
|
|
||||||
<servlet>
|
|
||||||
<servlet-name>Keycloak REST Interface</servlet-name>
|
|
||||||
<servlet-class>org.jboss.resteasy.plugins.server.servlet.HttpServlet30Dispatcher</servlet-class>
|
|
||||||
<init-param>
|
|
||||||
<param-name>javax.ws.rs.Application</param-name>
|
|
||||||
<param-value>org.keycloak.services.resources.KeycloakApplication</param-value>
|
|
||||||
</init-param>
|
|
||||||
<init-param>
|
|
||||||
<param-name>resteasy.servlet.mapping.prefix</param-name>
|
|
||||||
<param-value>/</param-value>
|
|
||||||
</init-param>
|
|
||||||
<load-on-startup>1</load-on-startup>
|
|
||||||
<async-supported>true</async-supported>
|
|
||||||
</servlet>
|
|
||||||
|
|
||||||
<servlet>
|
|
||||||
<servlet-name>Customer REST Interface</servlet-name>
|
|
||||||
<servlet-class>org.jboss.resteasy.plugins.server.servlet.HttpServlet30Dispatcher</servlet-class>
|
|
||||||
<init-param>
|
|
||||||
<param-name>javax.ws.rs.Application</param-name>
|
|
||||||
<param-value>org.keycloak.example.oauth.DataApplication</param-value>
|
|
||||||
</init-param>
|
|
||||||
<init-param>
|
|
||||||
<param-name>resteasy.servlet.mapping.prefix</param-name>
|
|
||||||
<param-value>/database</param-value>
|
|
||||||
</init-param>
|
|
||||||
<load-on-startup>2</load-on-startup>
|
|
||||||
<async-supported>true</async-supported>
|
|
||||||
</servlet>
|
|
||||||
|
|
||||||
<listener>
|
|
||||||
<listener-class>org.keycloak.services.listeners.KeycloakSessionDestroyListener</listener-class>
|
|
||||||
</listener>
|
|
||||||
|
|
||||||
<filter>
|
|
||||||
<filter-name>Keycloak Client Connection Filter</filter-name>
|
|
||||||
<filter-class>org.keycloak.services.filters.ClientConnectionFilter</filter-class>
|
|
||||||
</filter>
|
|
||||||
|
|
||||||
<filter>
|
|
||||||
<filter-name>Keycloak Session Management</filter-name>
|
|
||||||
<filter-class>org.keycloak.services.filters.KeycloakSessionServletFilter</filter-class>
|
|
||||||
</filter>
|
|
||||||
|
|
||||||
<filter-mapping>
|
|
||||||
<filter-name>Keycloak Session Management</filter-name>
|
|
||||||
<url-pattern>/*</url-pattern>
|
|
||||||
</filter-mapping>
|
|
||||||
|
|
||||||
<filter-mapping>
|
|
||||||
<filter-name>Keycloak Client Connection Filter</filter-name>
|
|
||||||
<url-pattern>/*</url-pattern>
|
|
||||||
</filter-mapping>
|
|
||||||
|
|
||||||
<servlet-mapping>
|
|
||||||
<servlet-name>Keycloak REST Interface</servlet-name>
|
|
||||||
<url-pattern>/*</url-pattern>
|
|
||||||
</servlet-mapping>
|
|
||||||
|
|
||||||
|
|
||||||
<!-- -->
|
|
||||||
|
|
||||||
|
|
||||||
<welcome-file-list>
|
|
||||||
<welcome-file>index.html</welcome-file>
|
|
||||||
</welcome-file-list>
|
|
||||||
|
|
||||||
<servlet-mapping>
|
|
||||||
<servlet-name>Customer REST Interface</servlet-name>
|
|
||||||
<url-pattern>/database/*</url-pattern>
|
|
||||||
</servlet-mapping>
|
|
||||||
|
|
||||||
<security-constraint>
|
|
||||||
<web-resource-collection>
|
|
||||||
<web-resource-name>Customers</web-resource-name>
|
|
||||||
<url-pattern>/customers/*</url-pattern>
|
|
||||||
</web-resource-collection>
|
|
||||||
<auth-constraint>
|
|
||||||
<role-name>user</role-name>
|
|
||||||
</auth-constraint>
|
|
||||||
</security-constraint>
|
|
||||||
|
|
||||||
<security-constraint>
|
|
||||||
<web-resource-collection>
|
|
||||||
<web-resource-name>Database</web-resource-name>
|
|
||||||
<url-pattern>/database/*</url-pattern>
|
|
||||||
</web-resource-collection>
|
|
||||||
<auth-constraint>
|
|
||||||
<role-name>user</role-name>
|
|
||||||
</auth-constraint>
|
|
||||||
</security-constraint>
|
|
||||||
<security-constraint>
|
|
||||||
<web-resource-collection>
|
|
||||||
<web-resource-name>deny</web-resource-name>
|
|
||||||
<url-pattern>/customers/*</url-pattern>
|
|
||||||
</web-resource-collection>
|
|
||||||
<auth-constraint/>
|
|
||||||
</security-constraint>
|
|
||||||
|
|
||||||
<login-config>
|
|
||||||
<auth-method>BASIC</auth-method>
|
|
||||||
<realm-name>demo</realm-name>
|
|
||||||
</login-config>
|
|
||||||
|
|
||||||
<security-role>
|
|
||||||
<role-name>admin</role-name>
|
|
||||||
</security-role>
|
|
||||||
<security-role>
|
|
||||||
<role-name>user</role-name>
|
|
||||||
</security-role>
|
|
||||||
|
|
||||||
|
|
||||||
</web-app>
|
|
|
@ -1,47 +0,0 @@
|
||||||
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
|
|
||||||
pageEncoding="ISO-8859-1" %>
|
|
||||||
<%@ page import="org.keycloak.example.CustomerDatabaseClient" %>
|
|
||||||
<%@ page import="org.keycloak.util.KeycloakUriBuilder" %>
|
|
||||||
<%@ page import="org.keycloak.representations.IDToken" %>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Customer View Page</title>
|
|
||||||
</head>
|
|
||||||
<body bgcolor="#E3F6CE">
|
|
||||||
<%
|
|
||||||
String logoutUri = KeycloakUriBuilder.fromUri("http://localhost:8080/app-bundle/realms/demo/tokens/logout")
|
|
||||||
.queryParam("redirect_uri", "http://localhost:8080/app-bundle").build().toString();
|
|
||||||
String acctUri = "http://localhost:8080/app-bundle/realms/demo/account?referrer=customer-portal";
|
|
||||||
IDToken idToken = CustomerDatabaseClient.getIDToken(request);
|
|
||||||
%>
|
|
||||||
<p><a href="<%=logoutUri%>">logout</a> | <a
|
|
||||||
href="<%=acctUri%>">manage acct</a></p>
|
|
||||||
Servlet User Principal <b><%=request.getUserPrincipal().getName()%>
|
|
||||||
</b> made this request.
|
|
||||||
<p><b>Caller IDToken values</b> (<i>You can specify what is returned in IDToken in the customer-portal claims page in the admin console</i>:</p>
|
|
||||||
<p>Username: <%=idToken.getPreferredUsername()%></p>
|
|
||||||
<p>Email: <%=idToken.getEmail()%></p>
|
|
||||||
<p>Full Name: <%=idToken.getName()%></p>
|
|
||||||
<p>First: <%=idToken.getGivenName()%></p>
|
|
||||||
<p>Last: <%=idToken.getFamilyName()%></p>
|
|
||||||
<h2>Customer Listing</h2>
|
|
||||||
<%
|
|
||||||
java.util.List<String> list = null;
|
|
||||||
try {
|
|
||||||
list = CustomerDatabaseClient.getCustomers(request);
|
|
||||||
} catch (CustomerDatabaseClient.Failure failure) {
|
|
||||||
out.println("There was a failure processing request. You either didn't configure Keycloak properly, or maybe" +
|
|
||||||
"you just forgot to secure the database service?");
|
|
||||||
out.println("Status from database service invocation was: " + failure.getStatus());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
for (String cust : list) {
|
|
||||||
out.print("<p>");
|
|
||||||
out.print(cust);
|
|
||||||
out.println("</p>");
|
|
||||||
|
|
||||||
}
|
|
||||||
%>
|
|
||||||
<br><br>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1,13 +0,0 @@
|
||||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
|
||||||
"http://www.w3.org/TR/html4/loose.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title></title>
|
|
||||||
</head>
|
|
||||||
<body bgcolor="#E3F6CE">
|
|
||||||
<h1>Customer Portal</h1>
|
|
||||||
|
|
||||||
<p><a href="customers/view.jsp">Customer Listing</a></p>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -201,7 +201,7 @@ module.controller('RealmCreateCtrl', function($scope, Current, Realm, $upload, $
|
||||||
Realm.query(function(data) {
|
Realm.query(function(data) {
|
||||||
Current.realms = data;
|
Current.realms = data;
|
||||||
|
|
||||||
$http.get(authUrl + '/admin/whoami').success(function(user) {
|
WhoAmI.get(function(user) {
|
||||||
Auth.user = user;
|
Auth.user = user;
|
||||||
|
|
||||||
$location.url("/realms/" + realmCopy.realm);
|
$location.url("/realms/" + realmCopy.realm);
|
||||||
|
|
1
pom.xml
1
pom.xml
|
@ -100,7 +100,6 @@
|
||||||
<module>testsuite</module>
|
<module>testsuite</module>
|
||||||
<module>server</module>
|
<module>server</module>
|
||||||
<module>timer</module>
|
<module>timer</module>
|
||||||
<module>bundled-war-example</module>
|
|
||||||
<module>project-integrations</module>
|
<module>project-integrations</module>
|
||||||
<module>export-import</module>
|
<module>export-import</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
|
@ -21,6 +21,16 @@
|
||||||
</auth-constraint>
|
</auth-constraint>
|
||||||
</security-constraint>
|
</security-constraint>
|
||||||
|
|
||||||
|
<security-constraint>
|
||||||
|
<web-resource-collection>
|
||||||
|
<web-resource-name>AdminConsole</web-resource-name>
|
||||||
|
<url-pattern>/admin/*</url-pattern>
|
||||||
|
</web-resource-collection>
|
||||||
|
<auth-constraint>
|
||||||
|
<role-name>admin</role-name>
|
||||||
|
</auth-constraint>
|
||||||
|
</security-constraint>
|
||||||
|
|
||||||
<security-constraint>
|
<security-constraint>
|
||||||
<web-resource-collection>
|
<web-resource-collection>
|
||||||
<web-resource-name>Database</web-resource-name>
|
<web-resource-name>Database</web-resource-name>
|
||||||
|
|
1
project-integrations/aerogear-ups/app/src/main/webapp/admin/admin.html
Executable file
1
project-integrations/aerogear-ups/app/src/main/webapp/admin/admin.html
Executable file
|
@ -0,0 +1 @@
|
||||||
|
<h1>This would be the admin page for the UPS admin console.</h1>
|
|
@ -135,6 +135,17 @@
|
||||||
<artifactId>keycloak-timer-basic</artifactId>
|
<artifactId>keycloak-timer-basic</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.keycloak</groupId>
|
||||||
|
<artifactId>keycloak-export-import-api</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.keycloak</groupId>
|
||||||
|
<artifactId>keycloak-export-import-impl</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jboss.spec.javax.servlet</groupId>
|
<groupId>org.jboss.spec.javax.servlet</groupId>
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
package org.aerogear.ups.security;
|
||||||
|
|
||||||
|
import org.jboss.resteasy.core.Dispatcher;
|
||||||
|
import org.keycloak.models.KeycloakSession;
|
||||||
|
import org.keycloak.models.RealmModel;
|
||||||
|
import org.keycloak.models.UserModel;
|
||||||
|
import org.keycloak.services.managers.RealmManager;
|
||||||
|
import org.keycloak.services.resources.KeycloakApplication;
|
||||||
|
|
||||||
|
import javax.servlet.ServletContext;
|
||||||
|
import javax.ws.rs.core.Context;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
|
||||||
|
* @version $Revision: 1 $
|
||||||
|
*/
|
||||||
|
public class UpsSecurityApplication extends KeycloakApplication {
|
||||||
|
public UpsSecurityApplication(@Context ServletContext context, @Context Dispatcher dispatcher) {
|
||||||
|
super(context, dispatcher);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void setupDefaultRealm(String contextPath) {
|
||||||
|
super.setupDefaultRealm(contextPath);
|
||||||
|
KeycloakSession session = factory.createSession();
|
||||||
|
session.getTransaction().begin();
|
||||||
|
|
||||||
|
// disable master realm by deleting the admin user.
|
||||||
|
try {
|
||||||
|
RealmManager manager = new RealmManager(session);
|
||||||
|
RealmModel master = manager.getKeycloakAdminstrationRealm();
|
||||||
|
UserModel admin = master.getUser("admin");
|
||||||
|
if (admin != null) master.removeUser(admin.getLoginName());
|
||||||
|
session.getTransaction().commit();
|
||||||
|
} finally {
|
||||||
|
session.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -20,6 +20,19 @@
|
||||||
{ "type" : "password",
|
{ "type" : "password",
|
||||||
"value" : "password" }
|
"value" : "password" }
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"username" : "admin",
|
||||||
|
"enabled": true,
|
||||||
|
"firstName": "Bill",
|
||||||
|
"lastName": "Burke",
|
||||||
|
"credentials" : [
|
||||||
|
{ "type" : "password",
|
||||||
|
"value" : "admin" }
|
||||||
|
],
|
||||||
|
"requiredActions": [
|
||||||
|
"UPDATE_PASSWORD"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"roles" : {
|
"roles" : {
|
||||||
|
@ -38,6 +51,10 @@
|
||||||
{
|
{
|
||||||
"username": "bburke@redhat.com",
|
"username": "bburke@redhat.com",
|
||||||
"roles": ["user"]
|
"roles": ["user"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"username": "admin",
|
||||||
|
"roles": ["user", "admin"]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"scopeMappings": [
|
"scopeMappings": [
|
||||||
|
@ -64,6 +81,12 @@
|
||||||
"username": "bburke@redhat.com",
|
"username": "bburke@redhat.com",
|
||||||
"roles": ["manage-account"]
|
"roles": ["manage-account"]
|
||||||
}
|
}
|
||||||
|
],
|
||||||
|
"demo-realm": [
|
||||||
|
{
|
||||||
|
"username": "admin",
|
||||||
|
"roles": ["realm-admin"]
|
||||||
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
<servlet-class>org.jboss.resteasy.plugins.server.servlet.HttpServlet30Dispatcher</servlet-class>
|
<servlet-class>org.jboss.resteasy.plugins.server.servlet.HttpServlet30Dispatcher</servlet-class>
|
||||||
<init-param>
|
<init-param>
|
||||||
<param-name>javax.ws.rs.Application</param-name>
|
<param-name>javax.ws.rs.Application</param-name>
|
||||||
<param-value>org.keycloak.services.resources.KeycloakApplication</param-value>
|
<param-value>org.aerogear.ups.security.UpsSecurityApplication</param-value>
|
||||||
</init-param>
|
</init-param>
|
||||||
<init-param>
|
<init-param>
|
||||||
<param-name>resteasy.servlet.mapping.prefix</param-name>
|
<param-name>resteasy.servlet.mapping.prefix</param-name>
|
||||||
|
|
Loading…
Reference in a new issue