nagaboinaramgopal commented on code in PR #14205:
URL: https://github.com/apache/cloudstack/pull/14205#discussion_r4162477162
##########
plugins/user-authenticators/oauth2/src/main/java/org/apache/cloudstack/oauth2/OAuth2AuthManagerImpl.java:
##########
@@ -168,11 +185,17 @@ public OauthProviderVO
registerOauthProvider(RegisterOAuthProviderCmd cmd) {
Long domainId =
normalizeGlobalScope(resolveDomainIdFromIdOrPath(cmd.getDomainId(),
cmd.getDomainPath()));
String authorizeUrl = StringUtils.trim(cmd.getAuthorizeUrl());
String tokenUrl = StringUtils.trim(cmd.getTokenUrl());
+ String type = StringUtils.trim(cmd.getType());
+ String issuerUrl = StringUtils.trim(cmd.getIssuerUrl());
if (!isOAuthPluginEnabled(domainId)) {
throw new CloudRuntimeException("OAuth is not enabled, please
enable to register");
}
+ if (StringUtils.isNotBlank(type) &&
!userOAuth2AuthenticationProvidersMap.containsKey(type.toLowerCase())) {
+ throw new CloudRuntimeException(String.format("No OAuth2 provider
plugin is available for the type %s", type));
Review Comment:
You're right, the name wins during dispatch so the type gets silently
ignored. I've added a check at registration that rejects an OIDC type when the
name belongs to a built-in provider, with a message asking for a different
name. Thanks for catching this.
--
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]