[JENKINS-37468] Only offer valid credentials in the credentials drop down#18
Merged
nemccarthy merged 1 commit intojenkinsci:masterfrom Sep 22, 2016
Merged
Conversation
…down. - There was a mismatch between the dropdown list and the credentials lookup. As only username password credentials are supported, only those should be listed - Use Task.getDefaultAuthenticationOf(job) to ensure that the drop-down and lookup respects the authorize-project plugin - Use CredentialsProvider.listCredentials based lookups for drop-down selection to ensure that dynamic credentials providers are not forced to retrieve the password where it is not required.
|
This pull request originates from a CloudBees employee. At CloudBees, we require that all pull requests be reviewed by other CloudBees employees before we seek to have the change accepted. If you want to learn more about our process please see this explanation. |
oleg-nenashev
approved these changes
Sep 21, 2016
| import com.cloudbees.plugins.credentials.common.StandardUsernamePasswordCredentials; | ||
| import com.cloudbees.plugins.credentials.domains.URIRequirementBuilder; | ||
| import hudson.Extension; | ||
| import hudson.model.*; |
| @@ -109,8 +115,12 @@ public String getcredentialsId() { | |||
|
|
|||
| private StandardUsernamePasswordCredentials getCredentials() { | |||
Member
There was a problem hiding this comment.
NIT: Would be nice to have annotations if you change the code around
Member
Author
|
@reviewbybees done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See JENKINS-37468
I feel that the RFE is currently technically impossible as the REST API for query of the pull requests does not provide any support for SSH based authentication.
As such the RFE should probably be rejected.
Behind the RFE however, there is a valid bug. Namely that the drop down of credentials was including all Username based credentials (which would include SSH keys) yet only UsernamePassword credentials were being used.
This PR fixes the drop-down population to be restricted to Username Password credentials only.
Additionally this PR tidies up some of the usage of credentials (esp with respect to the interactions with the authorize-project plugin) and switches to the more modern APIs for populating drop-down boxes.
@reviewbybees @jenkinsci/code-reviewers