forked from morficus/Parameterized-Remote-Trigger-Plugin
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
foundational work for integrating the "credentials plugin"
step 1: figure out the UI and create new Class to handle auth see this for details: https://issues.jenkins-ci.org/browse/JENKINS-20826
- Loading branch information
Showing
3 changed files
with
128 additions
and
31 deletions.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
src/main/java/org/jenkinsci/plugins/ParameterizedRemoteTrigger/Auth.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package org.jenkinsci.plugins.ParameterizedRemoteTrigger; | ||
|
||
|
||
import org.kohsuke.stapler.DataBoundConstructor; | ||
|
||
import hudson.Extension; | ||
import hudson.model.AbstractDescribableImpl; | ||
import hudson.model.Descriptor; | ||
|
||
public class Auth extends AbstractDescribableImpl<Auth> { | ||
|
||
private final String value; | ||
private final String username; | ||
private final String apiToken; | ||
|
||
@DataBoundConstructor | ||
public Auth(String value, String username, String apiToken) { | ||
this.value = value; | ||
this.username = username; | ||
this.apiToken = apiToken; | ||
} | ||
|
||
public String getValue() { | ||
return this.value; | ||
} | ||
|
||
public Boolean isMatch(String value) { | ||
return this.getValue().equals(value); | ||
} | ||
|
||
public String getUsername() { | ||
return this.username; | ||
} | ||
|
||
public String getApiToken() { | ||
return this.apiToken; | ||
} | ||
|
||
@Extension | ||
public static class DescriptorImpl extends Descriptor<Auth> { | ||
@Override | ||
public String getDisplayName() { | ||
return ""; | ||
} | ||
} | ||
} |
This file contains 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
68 changes: 45 additions & 23 deletions
68
...sources/org/jenkinsci/plugins/ParameterizedRemoteTrigger/RemoteJenkinsServer/config.jelly
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,53 @@ | ||
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form"> | ||
<f:entry title="Display name" field="displayName" > | ||
<f:textbox /> | ||
</f:entry> | ||
<f:entry title="Display name" field="displayName" > | ||
<f:textbox /> | ||
</f:entry> | ||
|
||
<f:entry title="Enable 'build token root' support" field="hasBuildTokenRootSupport"> | ||
<f:checkbox /> | ||
</f:entry> | ||
|
||
|
||
<!-- <f:optionalBlock title="Add authentication credentials" field="needsAuthentication"> --> | ||
|
||
<f:entry title="Authentication mode"> | ||
<table style="width:100%"> | ||
|
||
<f:radioBlock name="authenticationMode" title="None" value="none" checked="${instance.getAuthenticationMode().isMatch('none')}"> | ||
</f:radioBlock> | ||
|
||
<f:radioBlock name="authenticationMode" title="Username + API Token" value="apiToken" checked="${instance.getAuthenticationMode().isMatch('apiToken')}"> | ||
<f:entry title="Remote Username" field="username" > | ||
<f:textbox /> | ||
</f:entry> | ||
|
||
<f:entry title="API Token" field="apiToken"> | ||
<f:password /> | ||
</f:entry> | ||
</f:radioBlock> | ||
|
||
<f:radioBlock name="authenticationMode" title="Use the Credentials Plugin" value="credentialsPlugin" checked="${instance.getAuthenticationMode().isMatch('credentialsPlugin')}"> | ||
|
||
<f:entry title="Enable 'build token root' support" field="hasBuildTokenRootSupport"> | ||
<f:checkbox /> | ||
</f:entry> | ||
</f:radioBlock> | ||
</table> | ||
</f:entry> | ||
|
||
<f:advanced title="Add/Edit username & token"> | ||
<f:entry title="Remote Username" field="username" > | ||
<!-- </f:optionalBlock> --> | ||
|
||
|
||
<f:entry title="Remote address and port" field="address" description="Remember to indicate the protocol (i.e.: http, https, etc)" > | ||
<f:textbox /> | ||
</f:entry> | ||
<f:entry title="API Token" field="apiToken"> | ||
<f:password /> | ||
<f:validateButton title="Validate Address" method="validateAddress" with="address" /> | ||
|
||
|
||
<f:entry title=""> | ||
<div style="float: left"> | ||
<f:repeatableDeleteButton /> | ||
</div> | ||
</f:entry> | ||
</f:advanced> | ||
|
||
<f:entry title="Remote address and port" field="address" description="Remember to indicate the protocol (i.e.: http, https, etc)" > | ||
<f:textbox /> | ||
</f:entry> | ||
<f:validateButton title="Validate Address" method="validateAddress" with="address" /> | ||
|
||
|
||
<f:entry title=""> | ||
<div style="float: left"> | ||
<f:repeatableDeleteButton /> | ||
</div> | ||
</f:entry> | ||
<hr/> | ||
<f:entry title=""> | ||
<hr/> | ||
</f:entry> | ||
</j:jelly> |