Skip to content

Commit

Permalink
[JENKINS-11562] we don't need a password or similar token to authenti…
Browse files Browse the repository at this point in the history
…cate as only admins may enter the login name anyway
  • Loading branch information
kutzi committed Nov 3, 2011
1 parent fa1e72f commit 16e1c39
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 20 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>org.jvnet.hudson.plugins</groupId>
<artifactId>instant-messaging-parent</artifactId>
<version>1.17</version>
<version>1.18-SNAPSHOT</version>
<relativePath>../instant-messaging-parent-plugin/pom.xml</relativePath>
</parent>

Expand All @@ -29,7 +29,7 @@
</licenses>

<properties>
<version.instant-messaging.plugin>1.19</version.instant-messaging.plugin>
<version.instant-messaging.plugin>1.21-SNAPSHOT</version.instant-messaging.plugin>
</properties>

<dependencies>
Expand Down
Expand Up @@ -32,9 +32,6 @@

import net.sf.json.JSONObject;

import org.acegisecurity.Authentication;
import org.acegisecurity.AuthenticationException;
import org.acegisecurity.providers.UsernamePasswordAuthenticationToken;
import org.apache.commons.lang.StringUtils;
import org.jivesoftware.smack.Roster.SubscriptionMode;
import org.jivesoftware.smack.proxy.ProxyInfo.ProxyType;
Expand Down Expand Up @@ -122,7 +119,6 @@ public class JabberPublisherDescriptor extends BuildStepDescriptor<Publisher> im
private String commandPrefix = DEFAULT_COMMAND_PREFIX;
private String defaultIdSuffix;
private String hudsonCiLogin;
private String hudsonCiPassword;
private String subscriptionMode = SubscriptionMode.accept_all.name();
private boolean emailAddressAsJabberId;

Expand Down Expand Up @@ -283,15 +279,16 @@ private void applyDefaultIdSuffix(final HttpServletRequest req) {

private void applyHudsonLoginPassword(HttpServletRequest req) throws FormException {
this.hudsonCiLogin = Util.fixEmptyAndTrim(req.getParameter(PARAMETERNAME_HUDSON_LOGIN));
this.hudsonCiPassword = Util.fixEmptyAndTrim(req.getParameter(PARAMETERNAME_HUDSON_PASSWORD));
if(this.hudsonCiLogin != null) {
Authentication auth = new UsernamePasswordAuthenticationToken(this.hudsonCiLogin, this.hudsonCiPassword);
try {
Hudson.getInstance().getSecurityRealm().getSecurityComponents().manager.authenticate(auth);
} catch (AuthenticationException e) {
throw new FormException(e, "Bad Jenkins credentials");
}
}

// TODO: add validation of login name, again?
// if(this.hudsonCiLogin != null) {
// Authentication auth = new UsernamePasswordAuthenticationToken(this.hudsonCiLogin, this.hudsonCiPassword);
// try {
// Hudson.getInstance().getSecurityRealm().getSecurityComponents().manager.authenticate(auth);
// } catch (AuthenticationException e) {
// throw new FormException(e, "Bad Jenkins credentials");
// }
// }
}

private void applyProxy(final HttpServletRequest req) throws FormException {
Expand Down Expand Up @@ -765,11 +762,6 @@ String getServiceName() {
return JabberUtil.getDomainPart(getJabberId());
}

@Override
public String getHudsonPassword() {
return this.hudsonCiPassword;
}

@Override
public String getHudsonUserName() {
return this.hudsonCiLogin;
Expand Down

0 comments on commit 16e1c39

Please sign in to comment.