all claims for app

This commit is contained in:
Bill Burke 2014-08-05 19:46:55 -04:00
parent 5b5fea347a
commit a0d7fc12db
3 changed files with 5 additions and 1 deletions

View file

@ -16,6 +16,8 @@ public class ClaimMask {
public static final long ADDRESS = 0x100l; public static final long ADDRESS = 0x100l;
public static final long PHONE = 0x200l; 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) { public static boolean hasName(long mask) {
return (mask & NAME) > 0; return (mask & NAME) > 0;
} }

View file

@ -2,6 +2,7 @@ package org.keycloak.models.utils;
import org.bouncycastle.openssl.PEMWriter; import org.bouncycastle.openssl.PEMWriter;
import org.keycloak.models.ApplicationModel; import org.keycloak.models.ApplicationModel;
import org.keycloak.models.ClaimMask;
import org.keycloak.models.ClientModel; import org.keycloak.models.ClientModel;
import org.keycloak.models.KeycloakSession; import org.keycloak.models.KeycloakSession;
import org.keycloak.models.RealmModel; import org.keycloak.models.RealmModel;
@ -92,6 +93,7 @@ public final class KeycloakModelUtils {
ApplicationModel app = realm.addApplication(name); ApplicationModel app = realm.addApplication(name);
generateSecret(app); generateSecret(app);
app.setFullScopeAllowed(true); app.setFullScopeAllowed(true);
app.setAllowedClaimsMask(ClaimMask.ALL);
return app; return app;
} }

View file

@ -409,7 +409,7 @@ public class RepresentationToModel {
if (resourceRep.getClaims() != null) { if (resourceRep.getClaims() != null) {
setClaims(applicationModel, resourceRep.getClaims()); setClaims(applicationModel, resourceRep.getClaims());
} else { } else {
applicationModel.setAllowedClaimsMask(ClaimMask.USERNAME); applicationModel.setAllowedClaimsMask(ClaimMask.ALL);
} }
return applicationModel; return applicationModel;