From a0d7fc12db8d627d958104ba53aa71bf32fee417 Mon Sep 17 00:00:00 2001 From: Bill Burke Date: Tue, 5 Aug 2014 19:46:55 -0400 Subject: [PATCH] all claims for app --- model/api/src/main/java/org/keycloak/models/ClaimMask.java | 2 ++ .../main/java/org/keycloak/models/utils/KeycloakModelUtils.java | 2 ++ .../java/org/keycloak/models/utils/RepresentationToModel.java | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/model/api/src/main/java/org/keycloak/models/ClaimMask.java b/model/api/src/main/java/org/keycloak/models/ClaimMask.java index 7d4334c9ac..3a650341c5 100755 --- a/model/api/src/main/java/org/keycloak/models/ClaimMask.java +++ b/model/api/src/main/java/org/keycloak/models/ClaimMask.java @@ -16,6 +16,8 @@ public class ClaimMask { public static final long ADDRESS = 0x100l; public static final long PHONE = 0x200l; + public static final long ALL = NAME | USERNAME | PROFILE | PICTURE | WEBSITE | EMAIL | GENDER | LOCALE | ADDRESS | PHONE; + public static boolean hasName(long mask) { return (mask & NAME) > 0; } diff --git a/model/api/src/main/java/org/keycloak/models/utils/KeycloakModelUtils.java b/model/api/src/main/java/org/keycloak/models/utils/KeycloakModelUtils.java index c36dd10849..ca07fdb0e7 100755 --- a/model/api/src/main/java/org/keycloak/models/utils/KeycloakModelUtils.java +++ b/model/api/src/main/java/org/keycloak/models/utils/KeycloakModelUtils.java @@ -2,6 +2,7 @@ package org.keycloak.models.utils; import org.bouncycastle.openssl.PEMWriter; import org.keycloak.models.ApplicationModel; +import org.keycloak.models.ClaimMask; import org.keycloak.models.ClientModel; import org.keycloak.models.KeycloakSession; import org.keycloak.models.RealmModel; @@ -92,6 +93,7 @@ public final class KeycloakModelUtils { ApplicationModel app = realm.addApplication(name); generateSecret(app); app.setFullScopeAllowed(true); + app.setAllowedClaimsMask(ClaimMask.ALL); return app; } 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 ec7a3ccd57..0a9f687e1a 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 @@ -409,7 +409,7 @@ public class RepresentationToModel { if (resourceRep.getClaims() != null) { setClaims(applicationModel, resourceRep.getClaims()); } else { - applicationModel.setAllowedClaimsMask(ClaimMask.USERNAME); + applicationModel.setAllowedClaimsMask(ClaimMask.ALL); } return applicationModel;