diff --git a/common/src/main/java/org/keycloak/common/Profile.java b/common/src/main/java/org/keycloak/common/Profile.java
index 998c280..88d4f70 100755
--- a/common/src/main/java/org/keycloak/common/Profile.java
+++ b/common/src/main/java/org/keycloak/common/Profile.java
@@ -36,6 +36,17 @@ public class Profile {
AUTHORIZATION, IMPERSONATION, SCRIPTS, DOCKER, ACCOUNT2, TOKEN_EXCHANGE
}
+ private enum ProductValue {
+ KEYCLOAK(),
+ RHSSO(Feature.ACCOUNT2);
+
+ private List<Feature> excluded;
+
+ ProductValue(Feature... excluded) {
+ this.excluded = Arrays.asList(excluded);
+ }
+ }
+
private enum ProfileValue {
PRODUCT(Feature.AUTHORIZATION, Feature.SCRIPTS, Feature.DOCKER, Feature.ACCOUNT2, Feature.TOKEN_EXCHANGE),
PREVIEW(Feature.ACCOUNT2),
@@ -43,10 +54,6 @@ public class Profile {
private List<Feature> disabled;
- ProfileValue() {
- this.disabled = Collections.emptyList();
- }
-
ProfileValue(Feature... disabled) {
this.disabled = Arrays.asList(disabled);
}
@@ -54,11 +61,15 @@ public class Profile {
private static final Profile CURRENT = new Profile();
+ private final ProductValue product;
+
private final ProfileValue profile;
private final Set<Feature> disabledFeatures = new HashSet<>();
private Profile() {
+ product = "rh-sso".equals(Version.NAME) ? ProductValue.RHSSO : ProductValue.KEYCLOAK;
+
try {
Properties props = new Properties();
@@ -87,6 +98,7 @@ public class Profile {
}
disabledFeatures.addAll(profile.disabled);
+ disabledFeatures.removeAll(product.excluded);
for (String k : props.stringPropertyNames()) {
if (k.startsWith("feature.")) {
@@ -112,6 +124,9 @@ public class Profile {
}
public static boolean isFeatureEnabled(Feature feature) {
+ if (CURRENT.product.excluded.contains(feature)) {
+ return false;
+ }
return !CURRENT.disabledFeatures.contains(feature);
}