[utilities COMMIT] /changepass/trunk/src/main/java/net/shibboleth/infra/passwd/PasswordChangeServlet.java
noreply at shibboleth.net
noreply at shibboleth.net
Tue Jul 30 11:17:35 EDT 2013
Author: scantor
Date: Tue Jul 30 11:17:35 2013
New Revision: 419
URL: http://svn.shibboleth.net/view/utilities?rev=419&view=rev
Log:
Patch in support for service credentials to do password change.
Modified:
changepass/trunk/src/main/java/net/shibboleth/infra/passwd/PasswordChangeServlet.java
Modified: changepass/trunk/src/main/java/net/shibboleth/infra/passwd/PasswordChangeServlet.java
URL: http://svn.shibboleth.net/view/utilities/changepass/trunk/src/main/java/net/shibboleth/infra/passwd/PasswordChangeServlet.java?rev=419&r1=418&r2=419&view=diff
==============================================================================
--- changepass/trunk/src/main/java/net/shibboleth/infra/passwd/PasswordChangeServlet.java (original)
+++ changepass/trunk/src/main/java/net/shibboleth/infra/passwd/PasswordChangeServlet.java Tue Jul 30 11:17:35 2013
@@ -45,6 +45,7 @@
import edu.vt.middleware.ldap.AttributesFactory;
import edu.vt.middleware.ldap.Ldap;
import edu.vt.middleware.ldap.Ldap.AttributeModification;
+import edu.vt.middleware.ldap.LdapConfig;
import edu.vt.middleware.ldap.LdapConfig.SearchScope;
import edu.vt.middleware.ldap.auth.Authenticator;
import edu.vt.middleware.ldap.auth.AuthenticatorConfig;
@@ -99,6 +100,12 @@
/** Name of the initialization parameter that carries user identifier attribute name. */
public static final String LDAP_UID_PARAM = "ldapUserAttribute";
+ /** Name of the initialization parameter that carries administrative DN. */
+ public static final String LDAP_BIND_PARAM = "ldapBindDN";
+
+ /** Name of the initialization parameter that carries administrative password. */
+ public static final String LDAP_BIND_PASSWD_PARAM = "ldapBindPassword";
+
/**
* Name of the initialization parameter that gives the amount of time, as an ISO8601 duration, to "remember" a
* failed authentication attempt.
@@ -240,15 +247,23 @@
log.debug("LDAP configuration. URL: {}, BaseDN: {}, UseID Field: {}", new Object[] {ldapUrl, ldapBaseDN,
ldapUserIdField,});
- final AuthenticatorConfig ldapConfig = new AuthenticatorConfig(ldapUrl, ldapBaseDN);
+ final AuthenticatorConfig authConfig = new AuthenticatorConfig(ldapUrl, ldapBaseDN);
+ authConfig.setBatchSize(1);
+ authConfig.setUserField(new String[] {ldapUserIdField});
+ authConfig.setSearchScope(SearchScope.ONELEVEL);
+ authConfig.setSearchResultHandlers(new SearchResultHandler[] {new FqdnSearchResultHandler(),
+ new EntryDnSearchResultHandler(),});
+
+ final LdapConfig ldapConfig = new LdapConfig(ldapUrl, ldapBaseDN);
ldapConfig.setBatchSize(1);
- ldapConfig.setUserField(new String[] {ldapUserIdField});
ldapConfig.setSearchScope(SearchScope.ONELEVEL);
ldapConfig.setSearchResultHandlers(new SearchResultHandler[] {new FqdnSearchResultHandler(),
new EntryDnSearchResultHandler(),});
+ ldapConfig.setBindDn(StringSupport.trimOrNull(servletConfig.getServletContext().getInitParameter(LDAP_BIND_PARAM)));
+ ldapConfig.setBindCredential(servletConfig.getServletContext().getInitParameter(LDAP_BIND_PASSWD_PARAM));
ldap = new Ldap(ldapConfig);
- authenticator = new Authenticator(ldapConfig);
+ authenticator = new Authenticator(authConfig);
}
/**
@@ -484,4 +499,4 @@
}
}
}
-}
+}
More information about the commits
mailing list