package org.jenkinsci.plugins.p4.client; import hudson.util.Secret; import java.io.Serializable; import org.jenkinsci.plugins.p4.credentials.P4PasswordImpl; import org.jenkinsci.plugins.p4.credentials.P4StandardCredentials; import org.jenkinsci.plugins.p4.credentials.P4TicketImpl; public class AuthorisationConfig implements Serializable { private static final long serialVersionUID = 1L; private String username; private AuthorisationType type; private Secret password; private String ticketValue; private String ticketPath; private String client; public AuthorisationConfig(P4StandardCredentials credential) { if (credential instanceof P4PasswordImpl) { P4PasswordImpl p = (P4PasswordImpl) credential; this.type = AuthorisationType.PASSWORD; this.username = p.getUsername(); this.password = p.getPassword(); } if (credential instanceof P4TicketImpl) { P4TicketImpl t = (P4TicketImpl) credential; this.type = AuthorisationType.TICKET; this.username = t.getUsername(); if (t.isTicketValueSet()) { this.type = AuthorisationType.TICKET; this.ticketValue = t.getTicketValue(); } if (t.isTicketPathSet()) { this.type = AuthorisationType.TICKETPATH; this.ticketPath = t.getTicketPath(); } } } public String toString() { StringBuffer sb = new StringBuffer(); sb.append(username); sb.append((client != null) ? "@" + client : "@no-client"); return sb.toString(); } @Override public boolean equals(Object obj) { if (obj instanceof ConnectionConfig) { ConnectionConfig comp = (ConnectionConfig) obj; return this.toString().equals(comp.toString()); } else { return false; } } @Override public int hashCode() { int hash = 7; hash = (int) (1777 * hash + this.toString().hashCode()); return hash; } public String getClient() { return client; } public void setClient(String client) { this.client = client; } public String getUsername() { return username; } public String getPassword() { return password.getPlainText(); } public AuthorisationType getType() { return type; } public String getTicketValue() { return ticketValue; } public String getTicketPath() { return ticketPath; } }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 11053 | Paul Allen | Branching using p4-jenkins | ||
//guest/perforce_software/p4jenkins/main/src/main/java/org/jenkinsci/plugins/p4/client/AuthorisationConfig.java | |||||
#1 | 9690 | Paul Allen |
[Branching using p4-jenkins] Release 1.0.1 |
||
//guest/paul_allen/dev/p4-jenkins/p4-client/src/main/java/org/jenkinsci/plugins/p4/client/AuthorisationConfig.java | |||||
#1 | 9672 | Paul Allen | Refactor name from 'p4_client' to 'p4'. | ||
//guest/paul_allen/dev/p4-jenkins/p4-client/src/main/java/org/jenkinsci/plugins/p4_client/client/AuthorisationConfig.java | |||||
#2 | 8940 | Paul Allen |
Major refactor for the ConnectionHelper class to simplify serialisation. Fixed remote Jenkins JNLP slave connection issue. ClientHelper now extends ConnectionHelper and takes on all methods that require a client workspace. P4StandardCredentials is sent to the remote node instead of Credentials ID due to an issue accessing the Credentials store over a remote connection. For simplicity Client ID (workspace name) is serialised instead of the Workspace object. |
||
#1 | 8629 | Paul Allen |
Added p4java with connection/authorisation helper classes. Included SSL support and detection of Unicode servers. |