jenkinsci / azure-ad-plugin

Authentication and Authorization with Azure AD
https://plugins.jenkins.io/azure-ad/
MIT License
27 stars 56 forks source link

Add support for prompting user account at each login #538

Closed bhartshorn closed 4 months ago

bhartshorn commented 4 months ago

This is a PR to solve my issue https://github.com/jenkinsci/azure-ad-plugin/issues/533. This change was made fairly naively by looking at the other settings available, copy pasting, and adding an if statement in (hopefully) the right place. As mentioned in my issue, I have little experience with Jenkins plug-ins, so forgive me and guide me if I did something dumb here.

Testing done

~I have not yet tested this, I'm looking in to how to manually build and install the plugin for testing. I'll also go back and look if there's automated testing that could be extended for this.~

I took the .hpi file built by the Jenkins CI process for this PR, spun up a new Jenkins instance in docker with the PR .hpi installed, and checked the behavior:

  1. when "Prompt for user account on each login" is unchecked, Entra ID automatically uses the MS account attached to windows, without prompting.
  2. when "Prompt for user account on each login" is checked, Entra ID prompts me for which account to sign in to every time I click "Sign in"

This is successful testing as far as the functionality I need.

I do not see a straightforward way to add a test case (the tests are quite minimal unless I'm missing something).

### Submitter checklist
- [x] Make sure you are opening from a **topic/feature/bugfix branch** (right side) and not your main branch!
- [x] Ensure that the pull request title represents the desired changelog entry
- [x] Please describe what you did
- [x] Link to relevant issues in GitHub or Jira
- [x] Link to relevant pull requests, esp. upstream and downstream changes
- [x] Ensure you have provided tests - that demonstrates feature works or fixes the issue
bhartshorn commented 4 months ago

Pinging @timja as hopefully someone who can review and merge. Thanks!