You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by "resmo (via GitHub)" <gi...@apache.org> on 2026/08/16 09:17:52 UTC
[PR] OAuthProvider: add param enable in register API [cloudstack]
resmo opened a new pull request, #13889:
URL: https://github.com/apache/cloudstack/pull/13889
When registering a new provider, it will always be enabled from the start.
This change allows to pass `enable` to the register process to control whether the new provider should already be enabled after registering.
### Description
This PR...
<!--- Describe your changes in DETAIL - And how has behaviour functionally changed. -->
<!-- For new features, provide link to FS, dev ML discussion etc. -->
<!-- In case of bug fix, the expected and actual behaviours, steps to reproduce. -->
<!-- When "Fixes: #<id>" is specified, the issue/PR will automatically be closed when this PR gets merged -->
<!-- For addressing multiple issues/PRs, use multiple "Fixes: #<id>" -->
<!-- Fixes: # -->
<!--- ******************************************************************************* -->
<!--- NOTE: AUTOMATION USES THE DESCRIPTIONS TO SET LABELS AND PRODUCE DOCUMENTATION. -->
<!--- PLEASE PUT AN 'X' in only **ONE** box -->
<!--- ******************************************************************************* -->
### Types of changes
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] Enhancement (improves an existing feature and functionality)
- [ ] Cleanup (Code refactoring and cleanup, that may add test cases)
- [ ] Build/CI
- [x] Test (unit or integration test code)
### Feature/Enhancement Scale or Bug Severity
#### Feature/Enhancement Scale
- [ ] Major
- [x] Minor
#### Bug Severity
- [ ] BLOCKER
- [ ] Critical
- [ ] Major
- [x] Minor
- [ ] Trivial
### Screenshots (if appropriate):
### How Has This Been Tested?
<!-- Please describe in detail how you tested your changes. -->
<!-- Include details of your testing environment, and the tests you ran to -->
#### How did you try to break this feature and the system with this change?
<!-- see how your change affects other areas of the code, etc. -->
<!-- Please read the [CONTRIBUTING](https://github.com/apache/cloudstack/blob/main/CONTRIBUTING.md) document -->
--
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: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] OAuthProvider: add param enable in register API [cloudstack]
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #13889:
URL: https://github.com/apache/cloudstack/pull/13889#issuecomment-5306743438
## [Codecov](https://app.codecov.io/gh/apache/cloudstack/pull/13889?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 3.41%. Comparing base ([`1cd2491`](https://app.codecov.io/gh/apache/cloudstack/commit/1cd249160eca49c54917ac76bf165e3c1b9ec1df?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`151cee7`](https://app.codecov.io/gh/apache/cloudstack/commit/151cee7441546857fdf1d2d8454335fa86d059e7?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
> :exclamation: There is a different number of reports uploaded between BASE (1cd2491) and HEAD (151cee7). Click for more details.
>
> <details><summary>HEAD has 1 upload less than BASE</summary>
>
>| Flag | BASE (1cd2491) | HEAD (151cee7) |
>|------|------|------|
>|unittests|1|0|
></details>
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## main #13889 +/- ##
=============================================
- Coverage 19.65% 3.41% -16.25%
=============================================
Files 6368 487 -5881
Lines 574889 41867 -533022
Branches 70353 7912 -62441
=============================================
- Hits 112985 1429 -111556
+ Misses 449634 40238 -409396
+ Partials 12270 200 -12070
```
| [Flag](https://app.codecov.io/gh/apache/cloudstack/pull/13889/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [uitests](https://app.codecov.io/gh/apache/cloudstack/pull/13889/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `3.41% <ø> (ø)` | |
| [unittests](https://app.codecov.io/gh/apache/cloudstack/pull/13889/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
</details>
[:umbrella: View full report in Codecov by Harness](https://app.codecov.io/gh/apache/cloudstack/pull/13889?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
--
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: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] OAuthProvider: add param enabled in register API [cloudstack]
Posted by "vishesh92 (via GitHub)" <gi...@apache.org>.
vishesh92 commented on code in PR #13889:
URL: https://github.com/apache/cloudstack/pull/13889#discussion_r3975758417
##########
plugins/user-authenticators/oauth2/src/main/java/org/apache/cloudstack/oauth2/api/command/RegisterOAuthProviderCmd.java:
##########
@@ -76,6 +79,9 @@ public class RegisterOAuthProviderCmd extends BaseCmd {
@Parameter(name = ApiConstants.TOKEN_URL, type = CommandType.STRING, description = "Token URL for OAuth finalization (only required for keycloak provider)")
private String tokenUrl;
+ @Parameter(name = ApiConstants.ENABLED, type = CommandType.BOOLEAN, description = "OAuth provider will be enabled or disabled based on this value", since = "24.0.0")
Review Comment:
It will be good to specify the default value here.
--
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: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] OAuthProvider: add param enabled in register API [cloudstack]
Posted by "blueorangutan (via GitHub) via commits" <co...@cloudstack.apache.org>.
blueorangutan commented on PR #13889:
URL: https://github.com/apache/cloudstack/pull/13889#issuecomment-6808418682
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 20006
--
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: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] OAuthProvider: add param enabled in register API [cloudstack]
Posted by "RosiKyu (via GitHub) via commits" <co...@cloudstack.apache.org>.
RosiKyu merged PR #13889:
URL: https://github.com/apache/cloudstack/pull/13889
--
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: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] OAuthProvider: add param enabled in register API [cloudstack]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #13889:
URL: https://github.com/apache/cloudstack/pull/13889#discussion_r3969395658
##########
plugins/user-authenticators/oauth2/src/main/java/org/apache/cloudstack/oauth2/api/command/RegisterOAuthProviderCmd.java:
##########
@@ -151,6 +161,22 @@ public void execute() throws ServerApiException, ConcurrentOperationException, E
provider.getAuthorizeUrl(), provider.getTokenUrl(), domain);
response.setResponseName(getCommandName());
response.setObjectName(ApiConstants.OAUTH_PROVIDER);
+
+ List<UserOAuth2Authenticator> userOAuth2AuthenticatorPlugins = _oauth2mgr.listUserOAuth2AuthenticationProviders();
+ List<String> authenticatorPluginNames = new ArrayList<>();
+
+ for (UserOAuth2Authenticator authenticator : userOAuth2AuthenticatorPlugins) {
+ String name = authenticator.getName();
+ authenticatorPluginNames.add(name);
+ }
+
+ boolean oauthEnabled = OAuth2AuthManager.isPluginEnabledForDomain(provider.getDomainId());
Review Comment:
Calling a static `OAuth2AuthManager.isPluginEnabledForDomain(...)` from the API command makes this behavior harder to test/mocks and can bypass instance-level configuration logic in the injected `_oauth2mgr`. Prefer using an instance method on `_oauth2mgr` (the same enablement check used in the manager implementation) so behavior is consistent and testable.
##########
plugins/user-authenticators/oauth2/src/main/java/org/apache/cloudstack/oauth2/OAuth2AuthManagerImpl.java:
##########
@@ -282,7 +283,7 @@ private OauthProviderVO saveOauthProvider(String provider, String description, S
oauthProviderVO.setDomainId(domainId);
oauthProviderVO.setAuthorizeUrl(authorizeUrl);
oauthProviderVO.setTokenUrl(tokenUrl);
- oauthProviderVO.setEnabled(true);
+ oauthProviderVO.setEnabled(enabled == null || enabled);
Review Comment:
New defaulting behavior is introduced here (`null` -> enabled). There’s a test for `enabled=false`, but no coverage asserting the default behavior when `cmd.getEnabled()` is `null` (and optionally `true`). Adding tests for both cases will prevent regressions in the default-enable contract.
##########
plugins/user-authenticators/oauth2/src/main/java/org/apache/cloudstack/oauth2/api/command/RegisterOAuthProviderCmd.java:
##########
@@ -76,6 +79,9 @@ public class RegisterOAuthProviderCmd extends BaseCmd {
@Parameter(name = ApiConstants.TOKEN_URL, type = CommandType.STRING, description = "Token URL for OAuth finalization (only required for keycloak provider)")
private String tokenUrl;
+ @Parameter(name = ApiConstants.ENABLED, type = CommandType.BOOLEAN, description = "OAuth provider will be enabled or disabled based on this value", since = "24.0.0")
Review Comment:
The parameter description doesn’t document the default behavior when `enabled` is omitted (it defaults to enabled per `enabled == null || enabled`). Consider updating the description to explicitly state the default (e.g., 'Defaults to true when not provided') to avoid API consumer confusion.
##########
plugins/user-authenticators/oauth2/src/main/java/org/apache/cloudstack/oauth2/api/command/RegisterOAuthProviderCmd.java:
##########
@@ -151,6 +161,22 @@ public void execute() throws ServerApiException, ConcurrentOperationException, E
provider.getAuthorizeUrl(), provider.getTokenUrl(), domain);
response.setResponseName(getCommandName());
response.setObjectName(ApiConstants.OAUTH_PROVIDER);
+
+ List<UserOAuth2Authenticator> userOAuth2AuthenticatorPlugins = _oauth2mgr.listUserOAuth2AuthenticationProviders();
+ List<String> authenticatorPluginNames = new ArrayList<>();
+
+ for (UserOAuth2Authenticator authenticator : userOAuth2AuthenticatorPlugins) {
+ String name = authenticator.getName();
+ authenticatorPluginNames.add(name);
+ }
+
+ boolean oauthEnabled = OAuth2AuthManager.isPluginEnabledForDomain(provider.getDomainId());
+ if (oauthEnabled && authenticatorPluginNames.contains(provider.getProvider()) && provider.isEnabled()) {
+ response.setEnabled(true);
+ } else {
+ response.setEnabled(false);
+ }
Review Comment:
The response `enabled` value is being computed as a composite of (domain plugin enabled) AND (provider exists in authenticator list) AND (provider.isEnabled). This can misrepresent the newly introduced `enabled` registration flag: an explicitly enabled provider may be returned as disabled if a plugin is temporarily unavailable or disabled for the domain. If the intent of the new parameter is to control the provider’s persisted enabled state, the response should reflect `provider.isEnabled()`; if you also need a computed runtime state, consider exposing a separate field (e.g., `active`/`available`) rather than overloading `enabled`.
##########
plugins/user-authenticators/oauth2/src/main/java/org/apache/cloudstack/oauth2/api/command/RegisterOAuthProviderCmd.java:
##########
@@ -151,6 +161,22 @@ public void execute() throws ServerApiException, ConcurrentOperationException, E
provider.getAuthorizeUrl(), provider.getTokenUrl(), domain);
response.setResponseName(getCommandName());
response.setObjectName(ApiConstants.OAUTH_PROVIDER);
+
+ List<UserOAuth2Authenticator> userOAuth2AuthenticatorPlugins = _oauth2mgr.listUserOAuth2AuthenticationProviders();
+ List<String> authenticatorPluginNames = new ArrayList<>();
+
+ for (UserOAuth2Authenticator authenticator : userOAuth2AuthenticatorPlugins) {
+ String name = authenticator.getName();
+ authenticatorPluginNames.add(name);
+ }
Review Comment:
This builds an intermediate `List<String>` just to do a containment check later. You can simplify by directly checking the provider name against the authenticators (e.g., iterate once and break on match, or use a stream anyMatch), which reduces moving parts and makes the intent clearer.
--
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: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] OAuthProvider: add param enabled in register API [cloudstack]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #13889:
URL: https://github.com/apache/cloudstack/pull/13889#discussion_r3986185713
##########
plugins/user-authenticators/oauth2/src/main/java/org/apache/cloudstack/oauth2/OAuth2AuthManagerImpl.java:
##########
@@ -282,7 +283,7 @@ private OauthProviderVO saveOauthProvider(String provider, String description, S
oauthProviderVO.setDomainId(domainId);
oauthProviderVO.setAuthorizeUrl(authorizeUrl);
oauthProviderVO.setTokenUrl(tokenUrl);
- oauthProviderVO.setEnabled(true);
+ oauthProviderVO.setEnabled(enabled);
Review Comment:
`enabled` is nullable here, but `OauthProviderVO.setEnabled` takes a primitive boolean. The existing `registerOauthProvider` tests leave `cmd.getEnabled()` unstubbed, so Mockito returns null and this call unboxes it to a `NullPointerException`; the manager should also preserve the legacy enabled-by-default behavior independently of the command implementation. Normalize null to true before setting the VO.
##########
plugins/user-authenticators/oauth2/src/main/java/org/apache/cloudstack/oauth2/api/command/RegisterOAuthProviderCmd.java:
##########
@@ -76,6 +79,9 @@ public class RegisterOAuthProviderCmd extends BaseCmd {
@Parameter(name = ApiConstants.TOKEN_URL, type = CommandType.STRING, description = "Token URL for OAuth finalization (only required for keycloak provider)")
private String tokenUrl;
+ @Parameter(name = ApiConstants.ENABLED, type = CommandType.BOOLEAN, description = "OAuth provider will be enabled or disabled based on this value, defaults to true if not specified", since = "24.0.0")
Review Comment:
The API annotation uses `24.0.0`, but the surrounding CloudStack API annotations use the `4.x.0` format (for example, the domain parameters above use `4.23.0`). This publishes an invalid/misleading introduction version in the generated API documentation.
##########
plugins/user-authenticators/oauth2/src/main/java/org/apache/cloudstack/oauth2/api/command/RegisterOAuthProviderCmd.java:
##########
@@ -121,6 +127,13 @@ public String getTokenUrl() {
return tokenUrl;
}
+ public Boolean getEnabled() {
+ if (enabled == null) {
+ return true; // default to enabled if not specified
+ }
+ return enabled;
Review Comment:
The new defaulting branch is not covered: the command tests mock the manager and the manager tests mock `RegisterOAuthProviderCmd`, so none exercises an actual command with `enabled` omitted and verifies that `getEnabled()` returns true. Add a focused test for the omitted-parameter path so a future change cannot regress the non-breaking default.
--
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: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] OAuthProvider: add param enabled in register API [cloudstack]
Posted by "vishesh92 (via GitHub)" <gi...@apache.org>.
vishesh92 commented on PR #13889:
URL: https://github.com/apache/cloudstack/pull/13889#issuecomment-5613780202
@resmo some minor code changes. otherwise the PR looks good.
--
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: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] OAuthProvider: add param enabled in register API [cloudstack]
Posted by "RosiKyu (via GitHub) via commits" <co...@cloudstack.apache.org>.
RosiKyu commented on PR #13889:
URL: https://github.com/apache/cloudstack/pull/13889#issuecomment-6806700335
@blueorangutan package
--
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: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] OAuthProvider: add param enabled in register API [cloudstack]
Posted by "resmo (via GitHub)" <gi...@apache.org>.
resmo commented on PR #13889:
URL: https://github.com/apache/cloudstack/pull/13889#issuecomment-5629919792
@vishesh92 ignore my previous comment, you're right. we can default early and we should. I change the code accordently.
--
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: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] OAuthProvider: add param enabled in register API [cloudstack]
Posted by "DaanHoogland (via GitHub)" <gi...@apache.org>.
DaanHoogland commented on PR #13889:
URL: https://github.com/apache/cloudstack/pull/13889#issuecomment-5478694272
@resmo , is this still draft on purpose?
--
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: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] OAuthProvider: add param enabled in register API [cloudstack]
Posted by "blueorangutan (via GitHub) via commits" <co...@cloudstack.apache.org>.
blueorangutan commented on PR #13889:
URL: https://github.com/apache/cloudstack/pull/13889#issuecomment-6806716360
@RosiKyu a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress.
--
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: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] OAuthProvider: add param enabled in register API [cloudstack]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #13889:
URL: https://github.com/apache/cloudstack/pull/13889#discussion_r3995676311
##########
plugins/user-authenticators/oauth2/src/main/java/org/apache/cloudstack/oauth2/api/command/RegisterOAuthProviderCmd.java:
##########
@@ -151,6 +164,22 @@ public void execute() throws ServerApiException, ConcurrentOperationException, E
provider.getAuthorizeUrl(), provider.getTokenUrl(), domain);
response.setResponseName(getCommandName());
response.setObjectName(ApiConstants.OAUTH_PROVIDER);
+
+ List<UserOAuth2Authenticator> userOAuth2AuthenticatorPlugins = _oauth2mgr.listUserOAuth2AuthenticationProviders();
+ List<String> authenticatorPluginNames = new ArrayList<>();
+
+ for (UserOAuth2Authenticator authenticator : userOAuth2AuthenticatorPlugins) {
+ String name = authenticator.getName();
+ authenticatorPluginNames.add(name);
+ }
Review Comment:
`listUserOAuth2AuthenticationProviders()` can return `null`: the manager field is nullable and its initializer explicitly guards that case at `OAuth2AuthManagerImpl.java:145-150`. With no authenticator plugins configured, this new loop throws after `registerOauthProvider` has already persisted the provider, turning registration into a 500 and leaving the row behind. Treat a null result as an empty list before iterating (or initialize the manager field to an empty list).
--
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: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] OAuthProvider: add param enabled in register API [cloudstack]
Posted by "resmo (via GitHub)" <gi...@apache.org>.
resmo commented on PR #13889:
URL: https://github.com/apache/cloudstack/pull/13889#issuecomment-5603015789
@DaanHoogland ready for merge
--
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: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] OAuthProvider: add param enabled in register API [cloudstack]
Posted by "vishesh92 (via GitHub)" <gi...@apache.org>.
vishesh92 commented on code in PR #13889:
URL: https://github.com/apache/cloudstack/pull/13889#discussion_r3975760824
##########
plugins/user-authenticators/oauth2/src/main/java/org/apache/cloudstack/oauth2/OAuth2AuthManagerImpl.java:
##########
@@ -282,7 +283,7 @@ private OauthProviderVO saveOauthProvider(String provider, String description, S
oauthProviderVO.setDomainId(domainId);
oauthProviderVO.setAuthorizeUrl(authorizeUrl);
oauthProviderVO.setTokenUrl(tokenUrl);
- oauthProviderVO.setEnabled(true);
+ oauthProviderVO.setEnabled(enabled == null || enabled);
Review Comment:
```suggestion
oauthProviderVO.setEnabled(enabled);
```
--
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: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] OAuthProvider: add param enabled in register API [cloudstack]
Posted by "resmo (via GitHub)" <gi...@apache.org>.
resmo commented on code in PR #13889:
URL: https://github.com/apache/cloudstack/pull/13889#discussion_r3978764693
##########
plugins/user-authenticators/oauth2/src/main/java/org/apache/cloudstack/oauth2/OAuth2AuthManagerImpl.java:
##########
@@ -282,7 +283,7 @@ private OauthProviderVO saveOauthProvider(String provider, String description, S
oauthProviderVO.setDomainId(domainId);
oauthProviderVO.setAuthorizeUrl(authorizeUrl);
oauthProviderVO.setTokenUrl(tokenUrl);
- oauthProviderVO.setEnabled(true);
+ oauthProviderVO.setEnabled(enabled == null || enabled);
Review Comment:
the reason to default `enabled` to `true if null` here is that we want to keep the logic for register "as is" (backwarts compatibilty) but on update, we don't want to default it to true but null (keep value of `enabled` as is).
--
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: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] OAuthProvider: add param enabled in register API [cloudstack]
Posted by "vishesh92 (via GitHub)" <gi...@apache.org>.
vishesh92 commented on code in PR #13889:
URL: https://github.com/apache/cloudstack/pull/13889#discussion_r3975764362
##########
plugins/user-authenticators/oauth2/src/main/java/org/apache/cloudstack/oauth2/api/command/RegisterOAuthProviderCmd.java:
##########
@@ -121,6 +127,10 @@ public String getTokenUrl() {
return tokenUrl;
}
+ public Boolean getEnabled() {
+ return enabled;
Review Comment:
The method can return even the boolean primitive type. which might be good for later use.
--
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: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] OAuthProvider: add param enabled in register API [cloudstack]
Posted by "vishesh92 (via GitHub)" <gi...@apache.org>.
vishesh92 commented on code in PR #13889:
URL: https://github.com/apache/cloudstack/pull/13889#discussion_r3975753190
##########
plugins/user-authenticators/oauth2/src/main/java/org/apache/cloudstack/oauth2/api/command/RegisterOAuthProviderCmd.java:
##########
@@ -121,6 +127,10 @@ public String getTokenUrl() {
return tokenUrl;
}
+ public Boolean getEnabled() {
+ return enabled;
Review Comment:
```suggestion
if (enabled == null) {
enabled = true;
}
return enabled;
```
--
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: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] OAuthProvider: add param enabled in register API [cloudstack]
Posted by "resmo (via GitHub)" <gi...@apache.org>.
resmo commented on PR #13889:
URL: https://github.com/apache/cloudstack/pull/13889#issuecomment-5316800395
> clgtm, are yu doing this for automation purposes, @resmo ?
yes, it is an improvment I noticed during the development of ansible module oauth_provider.
--
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: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org