Skip to content

Commit

Permalink
chore(jans-auth-server): move enabledFeatureFlags out of AppConfigura…
Browse files Browse the repository at this point in the history
…tion to avoid patch issues on jans-config-api side #3577 (#3581)
  • Loading branch information
yuriyz committed Jan 10, 2023
1 parent ea9382e commit 8fd14ef
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.jans.as.model.common;

import io.jans.as.model.configuration.AppConfiguration;
import io.jans.doc.annotation.DocFeatureFlag;
import org.apache.commons.lang3.StringUtils;

Expand Down Expand Up @@ -78,6 +79,10 @@ public static FeatureFlagType fromValue(String v) {
return UNKNOWN;
}

public static Set<FeatureFlagType> from(AppConfiguration appConfiguration) {
return fromValues(appConfiguration.getFeatureFlags());
}

public static Set<FeatureFlagType> fromValues(List<String> values) {
Set<FeatureFlagType> result = new HashSet<>();
if (values == null || values.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -904,12 +904,8 @@ public void setCheckUserPresenceOnRefreshToken(Boolean checkUserPresenceOnRefres
this.checkUserPresenceOnRefreshToken = checkUserPresenceOnRefreshToken;
}

public Set<FeatureFlagType> getEnabledFeatureFlags() {
return FeatureFlagType.fromValues(getFeatureFlags());
}

public boolean isFeatureEnabled(FeatureFlagType flagType) {
final Set<FeatureFlagType> flags = getEnabledFeatureFlags();
final Set<FeatureFlagType> flags = FeatureFlagType.from(this);
if (flags.isEmpty())
return true;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public String errorAsJson(IErrorType type, String reason) {
}

public void validateFeatureEnabled(FeatureFlagType flagType) {
final Set<FeatureFlagType> enabledFlags = appConfiguration.getEnabledFeatureFlags();
final Set<FeatureFlagType> enabledFlags = FeatureFlagType.from(appConfiguration);
if (enabledFlags.isEmpty()) { // no restrictions
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,7 @@ public void setLastFinishedTime(long lastFinishedTime) {
* should be more than 0 seconds of interval
*/
private void initCibaRequestsProcessor() {
final Set<FeatureFlagType> featureFlags = appConfiguration.getEnabledFeatureFlags();
final Set<FeatureFlagType> featureFlags = FeatureFlagType.from(appConfiguration);
if ((featureFlags.isEmpty() || featureFlags.contains(FeatureFlagType.CIBA)) && appConfiguration.getBackchannelRequestsProcessorJobIntervalSec() > 0) {
if (cibaRequestsProcessorJob != null) {
cibaRequestsProcessorJob.initTimer();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public void create() {

public boolean init() {
try {
final Set<FeatureFlagType> featureFlags = appConfiguration.getEnabledFeatureFlags();
final Set<FeatureFlagType> featureFlags = FeatureFlagType.from(appConfiguration);
if (!featureFlags.isEmpty() && !featureFlags.contains(FeatureFlagType.STAT)) {
log.trace("Stat service is not enabled.");
return false;
Expand Down

0 comments on commit 8fd14ef

Please sign in to comment.