Skip to content

Commit 2fe8d53

Browse files
committed
Use global config check for global providers and extract oauthEnabled variable
1 parent 2185237 commit 2fe8d53

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

plugins/user-authenticators/oauth2/src/main/java/org/apache/cloudstack/oauth2/api/command/ListOAuthProvidersCmd.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,10 @@ public String authenticate(String command, Map<String, Object[]> params, HttpSes
145145
Domain domain = result.getDomainId() != null ? ApiDBUtils.findDomainById(result.getDomainId()) : null;
146146
OauthProviderResponse r = new OauthProviderResponse(result.getUuid(), result.getProvider(),
147147
result.getDescription(), result.getClientId(), result.getSecretKey(), result.getRedirectUri(), domain);
148-
if (Boolean.TRUE.equals(OAuth2AuthManager.OAuth2IsPluginEnabled.valueInScope(ConfigKey.Scope.Domain, result.getDomainId(), true)) && authenticatorPluginNames.contains(result.getProvider()) && result.isEnabled()) {
148+
boolean oauthEnabled = result.getDomainId() == null
149+
? Boolean.TRUE.equals(OAuth2AuthManager.OAuth2IsPluginEnabled.value())
150+
: Boolean.TRUE.equals(OAuth2AuthManager.OAuth2IsPluginEnabled.valueInScope(ConfigKey.Scope.Domain, result.getDomainId(), true));
151+
if (oauthEnabled && authenticatorPluginNames.contains(result.getProvider()) && result.isEnabled()) {
149152
r.setEnabled(true);
150153
} else {
151154
r.setEnabled(false);

0 commit comments

Comments
 (0)