SEC-1181: Basic AuthenticationProvider for Active Directory.

This commit is contained in:
Luke Taylor
2011-03-06 22:13:32 +00:00
parent 4dc5d7d16e
commit 530f686149
5 changed files with 389 additions and 153 deletions

View File

@@ -0,0 +1,25 @@
package org.springframework.security.ldap.authentication.ad;
import static org.junit.Assert.*;
import org.junit.*;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
/**
* @author Luke Taylor
*/
public class ActiveDirectoryLdapAuthenticationProviderTests {
@Test
public void simpleAuthenticationWithIsSucessful() throws Exception {
ActiveDirectoryLdapAuthenticationProvider provider =
new ActiveDirectoryLdapAuthenticationProvider(null, "ldap://192.168.1.200/");
Authentication result = provider.authenticate(new UsernamePasswordAuthenticationToken("luke@fenetres.monkeymachine.eu","p!ssw0rd"));
assertEquals(1, result.getAuthorities().size());
assertTrue(result.getAuthorities().contains(new SimpleGrantedAuthority("blah")));
}
}