Skip to content

OAuthProvider: add param enable in register API - #13889

Draft
resmo wants to merge 1 commit into
apache:mainfrom
resmo:feature/register-disabled-oauth
Draft

OAuthProvider: add param enable in register API#13889
resmo wants to merge 1 commit into
apache:mainfrom
resmo:feature/register-disabled-oauth

Conversation

@resmo

@resmo resmo commented Aug 16, 2026

Copy link
Copy Markdown
Member

Description

Before this change, 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.

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • 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
  • Test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

How did you try to break this feature and the system with this change?

this allows to created a provider disabled.
Copilot AI lite review requested due to automatic review settings August 16, 2026 09:17

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the OAuth2 provider registration flow to optionally create providers in a disabled state, instead of always enabling them immediately. It wires the new API parameter through the register command into persistence and adds/updates unit tests around the new behavior and response payload.

Changes:

  • Add optional enabled parameter to registerOauthProvider and pass it through to persistence (defaulting to enabled when omitted).
  • Update register API response to explicitly set the enabled flag based on runtime/provider state (consistent with list/update behavior).
  • Add unit tests covering registering a disabled provider and ensuring the response reflects the disabled state.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
plugins/user-authenticators/oauth2/src/main/java/org/apache/cloudstack/oauth2/OAuth2AuthManagerImpl.java Propagates enabled from the register command into provider persistence (defaults to enabled when null).
plugins/user-authenticators/oauth2/src/main/java/org/apache/cloudstack/oauth2/api/command/RegisterOAuthProviderCmd.java Adds the enabled API parameter and sets the response enabled field based on plugin/provider state.
plugins/user-authenticators/oauth2/src/test/java/org/apache/cloudstack/oauth2/OAuth2AuthManagerImplTest.java Adds a unit test verifying a provider can be registered as disabled.
plugins/user-authenticators/oauth2/src/test/java/org/apache/cloudstack/oauth2/api/command/RegisterOAuthProviderCmdTest.java Updates tests to account for enabled handling and adds coverage for disabled response.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@codecov

codecov Bot commented Aug 16, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 64.70588% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 19.65%. Comparing base (1cd2491) to head (151cee7).

Files with missing lines Patch % Lines
...k/oauth2/api/command/RegisterOAuthProviderCmd.java 61.53% 4 Missing and 1 partial ⚠️
...pache/cloudstack/oauth2/OAuth2AuthManagerImpl.java 75.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##               main   #13889   +/-   ##
=========================================
  Coverage     19.65%   19.65%           
- Complexity    19794    19798    +4     
=========================================
  Files          6368     6368           
  Lines        574889   574903   +14     
  Branches      70353    70356    +3     
=========================================
+ Hits         112985   113003   +18     
+ Misses       449634   449628    -6     
- Partials      12270    12272    +2     
Flag Coverage Δ
uitests 3.41% <ø> (ø)
unittests 20.93% <64.70%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@resmo resmo added this to the 4.24.0 milestone Aug 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants