keycloak-memoizeit
Details
diff --git a/examples/cors/angular-product-app/pom.xml b/examples/cors/angular-product-app/pom.xml
index 4ba033c..0d0b1d6 100755
--- a/examples/cors/angular-product-app/pom.xml
+++ b/examples/cors/angular-product-app/pom.xml
@@ -15,7 +15,7 @@
<description/>
<build>
- <finalName>angular-product</finalName>
+ <finalName>angular-cors-product</finalName>
<plugins>
<plugin>
<groupId>org.jboss.as.plugins</groupId>
diff --git a/examples/cors/angular-product-app/src/main/webapp/js/app.js b/examples/cors/angular-product-app/src/main/webapp/js/app.js
index d093997..f2056cc 100755
--- a/examples/cors/angular-product-app/src/main/webapp/js/app.js
+++ b/examples/cors/angular-product-app/src/main/webapp/js/app.js
@@ -18,7 +18,7 @@ angular.element(document).ready(function ($http) {
console.log('here login');
auth.loggedIn = true;
auth.authz = keycloakAuth;
- auth.logoutUrl = keycloakAuth.authServerUrl + "/realms/" + keycloakAuth.realm + "/tokens/logout?redirect_uri=/angular-product/index.html";
+ auth.logoutUrl = keycloakAuth.authServerUrl + "/realms/" + keycloakAuth.realm + "/tokens/logout?redirect_uri=http://localhost:8080/angular-cors-product/index.html";
module.factory('Auth', function() {
return auth;
});
@@ -33,7 +33,7 @@ module.controller('GlobalCtrl', function($scope, $http) {
$scope.products = [];
$scope.roles = [];
$scope.reloadData = function() {
- $http.get("http://localhost-db:8080/database/products").success(function(data) {
+ $http.get("http://localhost-db:8080/cors-database/products").success(function(data) {
$scope.products = angular.fromJson(data);
});
diff --git a/examples/cors/angular-product-app/src/main/webapp/keycloak.json b/examples/cors/angular-product-app/src/main/webapp/keycloak.json
index d9c653b..40b35a1 100755
--- a/examples/cors/angular-product-app/src/main/webapp/keycloak.json
+++ b/examples/cors/angular-product-app/src/main/webapp/keycloak.json
@@ -1,8 +1,8 @@
{
"realm" : "cors",
"realm-public-key" : "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCrVrCuTtArbgaZzL1hvh0xtL5mc7o0NqPVnYXkLvgcwiC3BjLGw1tGEGoJaXDuSaRllobm53JBhjx33UNv+5z/UMG4kytBWxheNVKnL6GgqlNabMaFfPLPCF8kAgKnsi79NMo+n6KnSY8YeUmec/p2vjO2NjsSAVcWEQMVhJ31LwIDAQAB",
- "auth-server-url" : "/auth",
+ "auth-server-url" : "http://localhost-auth:8080/auth",
"ssl-required" : "external",
- "resource" : "angular-product",
+ "resource" : "angular-cors-product",
"public-client" : true
}
\ No newline at end of file
examples/cors/cors-realm.json 10(+5 -5)
diff --git a/examples/cors/cors-realm.json b/examples/cors/cors-realm.json
index 423ddb2..82dcf0c 100755
--- a/examples/cors/cors-realm.json
+++ b/examples/cors/cors-realm.json
@@ -38,18 +38,18 @@
},
"scopeMappings": [
{
- "client": "angular-product",
+ "client": "angular-cors-product",
"roles": ["user"]
}
],
"applications": [
{
- "name": "angular-product",
+ "name": "angular-cors-product",
"enabled": true,
"publicClient": true,
- "baseUrl": "/angular-product/index.html",
+ "baseUrl": "http://localhost:8080/angular-cors-product/index.html",
"redirectUris": [
- "/angular-product/*"
+ "http://localhost:8080/angular-cors-product/*"
],
"webOrigins": [
"http://localhost:8080"
@@ -59,7 +59,7 @@
"applicationScopeMappings": {
"realm-management": [
{
- "client": "angular-product",
+ "client": "angular-cors-product",
"roles": ["realm-admin"]
}
]
diff --git a/examples/cors/database-service/pom.xml b/examples/cors/database-service/pom.xml
index e1c6dbf..59e76ee 100755
--- a/examples/cors/database-service/pom.xml
+++ b/examples/cors/database-service/pom.xml
@@ -55,7 +55,7 @@
</dependencies>
<build>
- <finalName>database</finalName>
+ <finalName>cors-database</finalName>
<plugins>
<plugin>
<groupId>org.jboss.as.plugins</groupId>
diff --git a/examples/cors/database-service/src/main/webapp/WEB-INF/keycloak.json b/examples/cors/database-service/src/main/webapp/WEB-INF/keycloak.json
index 23f6960..0d29299 100755
--- a/examples/cors/database-service/src/main/webapp/WEB-INF/keycloak.json
+++ b/examples/cors/database-service/src/main/webapp/WEB-INF/keycloak.json
@@ -1,6 +1,6 @@
{
"realm" : "cors-realm",
- "resource" : "database-service",
+ "resource" : "cors-database-service",
"realm-public-key" : "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCrVrCuTtArbgaZzL1hvh0xtL5mc7o0NqPVnYXkLvgcwiC3BjLGw1tGEGoJaXDuSaRllobm53JBhjx33UNv+5z/UMG4kytBWxheNVKnL6GgqlNabMaFfPLPCF8kAgKnsi79NMo+n6KnSY8YeUmec/p2vjO2NjsSAVcWEQMVhJ31LwIDAQAB",
"bearer-only" : true,
"ssl-required": "external",
diff --git a/examples/cors/database-service/src/main/webapp/WEB-INF/web.xml b/examples/cors/database-service/src/main/webapp/WEB-INF/web.xml
index dd90e3a..6d78c1c 100755
--- a/examples/cors/database-service/src/main/webapp/WEB-INF/web.xml
+++ b/examples/cors/database-service/src/main/webapp/WEB-INF/web.xml
@@ -4,7 +4,7 @@
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>database</module-name>
+ <module-name>cors-database</module-name>
<security-constraint>
<web-resource-collection>
examples/cors/README.md 2(+1 -1)
diff --git a/examples/cors/README.md b/examples/cors/README.md
index 998d390..89ac4a8 100755
--- a/examples/cors/README.md
+++ b/examples/cors/README.md
@@ -59,7 +59,7 @@ Step 5: Login and Observe Apps
---------------------------------------
Try going to the customer app and view customer data:
-[http://localhost:8080/angular-product/index.html](http://localhost:8080/angular-product/index.html)
+[http://localhost:8080/angular-cors-product/index.html](http://localhost:8080/angular-cors-product/index.html)
This should take you to the auth-server login screen. Enter username: bburke@redhat.com and password: password. You
should be brought back to a simple and boring HTML page. Click the Reload button to show the product listing. Reload
diff --git a/model/api/src/main/java/org/keycloak/models/utils/RepresentationToModel.java b/model/api/src/main/java/org/keycloak/models/utils/RepresentationToModel.java
index 35a4acb..ec7a3cc 100755
--- a/model/api/src/main/java/org/keycloak/models/utils/RepresentationToModel.java
+++ b/model/api/src/main/java/org/keycloak/models/utils/RepresentationToModel.java
@@ -181,6 +181,9 @@ public class RepresentationToModel {
if (rep.getScopeMappings() != null) {
for (ScopeMappingRepresentation scope : rep.getScopeMappings()) {
ClientModel client = newRealm.findClient(scope.getClient());
+ if (client == null) {
+ throw new RuntimeException("Unknown client specification in realm scope mappings");
+ }
for (String roleString : scope.getRoles()) {
RoleModel role = newRealm.getRole(roleString.trim());
if (role == null) {
@@ -558,6 +561,9 @@ public class RepresentationToModel {
public static void createApplicationScopeMappings(RealmModel realm, ApplicationModel applicationModel, List<ScopeMappingRepresentation> mappings) {
for (ScopeMappingRepresentation mapping : mappings) {
ClientModel client = realm.findClient(mapping.getClient());
+ if (client == null) {
+ throw new RuntimeException("Unknown client specified in application scope mappings");
+ }
for (String roleString : mapping.getRoles()) {
RoleModel role = applicationModel.getRole(roleString.trim());
if (role == null) {