Thanks to visit codestin.com
Credit goes to github.com

Skip to content

microsoft -> prompt select_account#289

Merged
vishnurk6247 merged 1 commit into
developfrom
CU-86d31qrv3-microsoft-oauth-login
May 19, 2026
Merged

microsoft -> prompt select_account#289
vishnurk6247 merged 1 commit into
developfrom
CU-86d31qrv3-microsoft-oauth-login

Conversation

@rootflo-hardik

@rootflo-hardik rootflo-hardik commented May 19, 2026

Copy link
Copy Markdown
Contributor
  • also fixed minor cache issues in user crud api

Summary by CodeRabbit

  • Bug Fixes

    • User data cache is now properly refreshed when users are created.
    • User data cache is now properly refreshed when users are reactivated.
  • Improvements

    • Microsoft OAuth authentication now prompts for account selection during sign-in.

Review Change Stack

- also fixed minor cache issues in user crud api
@coderabbitai

coderabbitai Bot commented May 19, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

This PR adds cache invalidation to user mutation operations and enhances OAuth account selection. User creation and reactivation now clear cached user data after committing changes. Microsoft OAuth requests explicitly prompt users to select an account during authentication.

Changes

User data cache invalidation

Layer / File(s) Summary
Cache invalidation on mutations
wavefront/server/modules/user_management_module/.../controllers/user_controller.py, wavefront/server/modules/user_management_module/.../services/user_service.py
create_user endpoint gains cache_manager dependency and invalidates user_data_* cache after committing the new user and roles. reactivate_user service method invalidates the same cache pattern after reactivation commit.

OAuth account selection

Layer / File(s) Summary
OAuth prompt parameter
wavefront/server/plugins/authenticator/.../microsoft_oauth/authenticator.py
get_authorization_url adds prompt=select_account query parameter to the OAuth authorization request.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A cache grows stale when users are born,
So now we clear it each morn,
And when accounts select with prompt in sight,
OAuth flows work just right! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title focuses narrowly on the Microsoft OAuth change but omits the cache invalidation fixes to user management, which represent a substantial portion of the changeset.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch CU-86d31qrv3-microsoft-oauth-login

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
wavefront/server/plugins/authenticator/authenticator/microsoft_oauth/authenticator.py (1)

170-170: 💤 Low value

Consider making the prompt parameter configurable.

The prompt value is now hardcoded to select_account, which forces account selection for all OAuth flows. While this may be the desired default behavior for security reasons, consider making it configurable through MicrosoftOAuthConfig to allow flexibility for different deployment scenarios (e.g., some environments might prefer login or want to omit the parameter entirely).

♻️ Proposed approach to make prompt configurable

Add a prompt field to the config class with a sensible default:

# In config.py (MicrosoftOAuthConfig)
prompt: str = 'select_account'

Then reference it in the method:

         params = {
             'response_type': self.config.response_type,
             'client_id': self.config.client_id,
             'redirect_uri': self.config.redirect_uri,
             'scope': ' '.join(self.config.scopes),
             'state': state,
             'response_mode': self.config.response_mode,
-            'prompt': 'select_account',
+            'prompt': self.config.prompt,
         }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@wavefront/server/plugins/authenticator/authenticator/microsoft_oauth/authenticator.py`
at line 170, The hardcoded 'prompt': 'select_account' in the authorization
parameter construction should be made configurable: add a prompt: str =
'select_account' (or Optional[str] = None if you want to allow omission) to
MicrosoftOAuthConfig, update any config parsing/validation to include the new
field, and replace the literal 'prompt' usage in the method that builds the auth
URL (e.g., the function in authenticator.py that assembles authorize_params /
build_authorization_url) to read the value from MicrosoftOAuthConfig and only
include the parameter when the config value is non-empty; also update
docstrings/tests that assume the previous hardcoded behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In
`@wavefront/server/plugins/authenticator/authenticator/microsoft_oauth/authenticator.py`:
- Line 170: The hardcoded 'prompt': 'select_account' in the authorization
parameter construction should be made configurable: add a prompt: str =
'select_account' (or Optional[str] = None if you want to allow omission) to
MicrosoftOAuthConfig, update any config parsing/validation to include the new
field, and replace the literal 'prompt' usage in the method that builds the auth
URL (e.g., the function in authenticator.py that assembles authorize_params /
build_authorization_url) to read the value from MicrosoftOAuthConfig and only
include the parameter when the config value is non-empty; also update
docstrings/tests that assume the previous hardcoded behavior.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4799a2d2-b535-45b2-a408-0702f5dc0c87

📥 Commits

Reviewing files that changed from the base of the PR and between e6a251d and 21d668a.

📒 Files selected for processing (3)
  • wavefront/server/modules/user_management_module/user_management_module/controllers/user_controller.py
  • wavefront/server/modules/user_management_module/user_management_module/services/user_service.py
  • wavefront/server/plugins/authenticator/authenticator/microsoft_oauth/authenticator.py

@vishnurk6247 vishnurk6247 merged commit aaa79e9 into develop May 19, 2026
9 checks passed
@vishnurk6247 vishnurk6247 deleted the CU-86d31qrv3-microsoft-oauth-login branch May 19, 2026 14:04
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