diff options
author | Joel Baranick <joel.baranick@ensighten.com> | 2015-10-28 12:54:10 -0700 |
---|---|---|
committer | Joel Baranick <joel.baranick@ensighten.com> | 2015-10-28 12:54:10 -0700 |
commit | f2294ad4c37592d4046fd02e35439340278b09a0 (patch) | |
tree | 0c9f4640a5b91f41fe6b73c2de67055c05bc9668 /src/main | |
parent | 8101c2fc7b6ca2b2fa1d835f2c5b2a5f159539a0 (diff) | |
download | bbprb-f2294ad4c37592d4046fd02e35439340278b09a0.tar.gz |
Add support for plaintext username/password unless credentials are specified.
Diffstat (limited to 'src/main')
3 files changed, 29 insertions, 2 deletions
diff --git a/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketBuildTrigger.java b/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketBuildTrigger.java index 974d3eb..09802af 100644 --- a/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketBuildTrigger.java +++ b/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketBuildTrigger.java @@ -32,6 +32,8 @@ public class BitbucketBuildTrigger extends Trigger<AbstractProject<?, ?>> { private final String projectPath; private final String cron; private final String credentialsId; + private final String username; + private final String password; private final String repositoryOwner; private final String repositoryName; private final String ciSkipPhrases; @@ -48,6 +50,8 @@ public class BitbucketBuildTrigger extends Trigger<AbstractProject<?, ?>> { String projectPath, String cron, String credentialsId, + String username, + String password, String repositoryOwner, String repositoryName, String ciSkipPhrases, @@ -58,6 +62,8 @@ public class BitbucketBuildTrigger extends Trigger<AbstractProject<?, ?>> { this.projectPath = projectPath; this.cron = cron; this.credentialsId = credentialsId; + this.username = username; + this.password = password; this.repositoryOwner = repositoryOwner; this.repositoryName = repositoryName; this.ciSkipPhrases = ciSkipPhrases; @@ -77,6 +83,14 @@ public class BitbucketBuildTrigger extends Trigger<AbstractProject<?, ?>> { return credentialsId; } + public String getUsername() { + return username; + } + + public String getPassword() { + return password; + } + public String getRepositoryOwner() { return repositoryOwner; } diff --git a/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketRepository.java b/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketRepository.java index 8606c45..fb43f12 100644 --- a/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketRepository.java +++ b/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketRepository.java @@ -45,10 +45,17 @@ public class BitbucketRepository { public void init() { trigger = this.builder.getTrigger(); + String username = trigger.getUsername(); + String password = trigger.getPassword(); StandardUsernamePasswordCredentials credentials = getCredentials(trigger.getCredentialsId()); + if (credentials != null) { + username = credentials.getUsername(); + password = credentials.getPassword().getPlainText(); + } + client = new ApiClient( - credentials.getUsername(), - credentials.getPassword().getPlainText(), + username, + password, trigger.getRepositoryOwner(), trigger.getRepositoryName()); } diff --git a/src/main/resources/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketBuildTrigger/config.jelly b/src/main/resources/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketBuildTrigger/config.jelly index df43e5a..db5ca0f 100644 --- a/src/main/resources/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketBuildTrigger/config.jelly +++ b/src/main/resources/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketBuildTrigger/config.jelly @@ -5,6 +5,12 @@ <f:entry title="${%Credentials}" field="credentialsId"> <c:select/> </f:entry> + <f:entry title="Bitbucket BasicAuth Username" field="username"> + <f:textbox /> + </f:entry> + <f:entry title="Bitbucket BasicAuth Password" field="password"> + <f:password /> + </f:entry> <f:entry title="RepositoryOwner" field="repositoryOwner"> <f:textbox /> </f:entry> |