Damans227 commented on code in PR #13867:
URL: https://github.com/apache/cloudstack/pull/13867#discussion_r4249947610
##########
plugins/user-authenticators/oauth2/src/main/java/org/apache/cloudstack/oauth2/OAuth2AuthManagerImpl.java:
##########
@@ -120,20 +120,61 @@ public List<Class<?>> getCommands() {
@Override
public List<UserOAuth2Authenticator>
listUserOAuth2AuthenticationProviders() {
- return userOAuth2AuthenticationProviders;
+ if (userOAuth2AuthenticationProviders == null) {
+ return userOAuth2AuthenticationProviders;
+ }
+ List<UserOAuth2Authenticator> notExcluded = new ArrayList<>();
+ for (UserOAuth2Authenticator provider :
userOAuth2AuthenticationProviders) {
+ if (!isProviderExcluded(provider.getName(), null)) {
+ notExcluded.add(provider);
+ }
+ }
+ return notExcluded;
}
@Override
public UserOAuth2Authenticator getUserOAuth2AuthenticationProvider(String
providerName) {
+ return getUserOAuth2AuthenticationProvider(providerName, null);
+ }
+
+ @Override
+ public UserOAuth2Authenticator getUserOAuth2AuthenticationProvider(String
providerName, Long domainId) {
if (StringUtils.isEmpty(providerName)) {
throw new CloudRuntimeException("OAuth2 authentication provider
name is empty");
}
- if
(!userOAuth2AuthenticationProvidersMap.containsKey(providerName.toLowerCase()))
{
+ if
(!userOAuth2AuthenticationProvidersMap.containsKey(providerName.toLowerCase())
|| isProviderExcluded(providerName, domainId)) {
throw new CloudRuntimeException(String.format("Failed to find
OAuth2 authentication provider by the name: %s.", providerName));
}
return
userOAuth2AuthenticationProvidersMap.get(providerName.toLowerCase());
}
+ // oauth2.plugins.exclude is checked live here rather than relying on the
registry's
+ // registration-time filtering, so a config change takes effect without a
restart and so a
+ // domain-level override can be layered on top of the global list. A
domain can only add
+ // further exclusions, never un-exclude something the global list already
excludes.
Review Comment:
yes, changed it to javadoc
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]