From 00d34fd6db2d55e605251ff1799d2c572c01cb84 Mon Sep 17 00:00:00 2001 From: Ulrik Sandberg Date: Wed, 3 Nov 2010 00:23:34 +0000 Subject: [PATCH] Finalized implementation and testing of LDAP-173. --- ...igestMd5DirContextAuthenticationStrategy.java | 2 +- .../support/DigestMd5AuthenticationITest.java | 16 ++++++---------- .../src/test/resources/conf/ldap.properties | 4 ++-- .../conf/ldapTemplateDigestMd5TestContext.xml | 2 -- 4 files changed, 9 insertions(+), 15 deletions(-) diff --git a/core/src/main/java/org/springframework/ldap/core/support/DigestMd5DirContextAuthenticationStrategy.java b/core/src/main/java/org/springframework/ldap/core/support/DigestMd5DirContextAuthenticationStrategy.java index 575d1033..f3abbd22 100644 --- a/core/src/main/java/org/springframework/ldap/core/support/DigestMd5DirContextAuthenticationStrategy.java +++ b/core/src/main/java/org/springframework/ldap/core/support/DigestMd5DirContextAuthenticationStrategy.java @@ -24,13 +24,13 @@ import javax.naming.directory.DirContext; * Authentication strategy for LDAP DIGEST-MD5 SASL mechanism. * * @author Marvin S. Addison + * @since 1.3.1 */ public class DigestMd5DirContextAuthenticationStrategy implements DirContextAuthenticationStrategy { /** Authentication type for DIGEST-MD5 auth */ private static final String DIGEST_MD5_AUTHENTICATION = "DIGEST-MD5"; - /* * (non-Javadoc) * @see org.springframework.ldap.core.support.DirContextAuthenticationStrategy#processContextAfterCreation(javax.naming.directory.DirContext, diff --git a/test/integration-tests-openldap/src/test/java/org/springframework/ldap/core/support/DigestMd5AuthenticationITest.java b/test/integration-tests-openldap/src/test/java/org/springframework/ldap/core/support/DigestMd5AuthenticationITest.java index b79ebf25..e65c102e 100644 --- a/test/integration-tests-openldap/src/test/java/org/springframework/ldap/core/support/DigestMd5AuthenticationITest.java +++ b/test/integration-tests-openldap/src/test/java/org/springframework/ldap/core/support/DigestMd5AuthenticationITest.java @@ -9,34 +9,30 @@ import javax.naming.directory.DirContext; import org.junit.Assert; import org.junit.Test; - import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.ldap.NamingException; +import org.springframework.ldap.AuthenticationException; import org.springframework.ldap.core.LdapTemplate; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests; /** * Integration test to verify DIGEST-MD5 authentication support. - * + * * @author Marvin S. Addison - * @version $Revision$ - * */ @ContextConfiguration(locations = { "/conf/ldapTemplateDigestMd5TestContext.xml" }) public class DigestMd5AuthenticationITest extends AbstractJUnit4SpringContextTests { @Autowired private LdapTemplate ldapTemplate; - @Test public void testAuthenticate() { try { - DirContext ctxt = ldapTemplate.getContextSource().getContext("admin", "secret"); + DirContext ctxt = ldapTemplate.getContextSource().getContext("some.person", "password"); Assert.assertNotNull(ctxt); - } catch (NamingException e) { - Assert.fail("DIGEST-MD5 authentication failed: " + e); } - + catch (AuthenticationException e) { + Assert.fail(e.getMessage()); + } } } diff --git a/test/integration-tests-openldap/src/test/resources/conf/ldap.properties b/test/integration-tests-openldap/src/test/resources/conf/ldap.properties index bfd4b0d4..2737fbc7 100644 --- a/test/integration-tests-openldap/src/test/resources/conf/ldap.properties +++ b/test/integration-tests-openldap/src/test/resources/conf/ldap.properties @@ -3,6 +3,6 @@ userDn=cn=admin,dc=jayway,dc=se password=secret base=dc=jayway,dc=se -aws.ami=ami-56ec083f +aws.ami=ami-889c6be1 aws.keypair=spring-ldap-keypair -aws.security.group=spring-ldap \ No newline at end of file +aws.security.group=spring-ldap diff --git a/test/integration-tests-openldap/src/test/resources/conf/ldapTemplateDigestMd5TestContext.xml b/test/integration-tests-openldap/src/test/resources/conf/ldapTemplateDigestMd5TestContext.xml index 596864fd..cecf3feb 100644 --- a/test/integration-tests-openldap/src/test/resources/conf/ldapTemplateDigestMd5TestContext.xml +++ b/test/integration-tests-openldap/src/test/resources/conf/ldapTemplateDigestMd5TestContext.xml @@ -7,7 +7,6 @@ - @@ -18,7 +17,6 @@ -