Delete files with old, non-Camel Case name.

This commit is contained in:
Ben Alex
2004-07-28 23:06:04 +00:00
parent f29e6763d4
commit 8c74d459c5
10 changed files with 0 additions and 621 deletions

View File

@@ -1,71 +0,0 @@
package net.sf.acegisecurity.providers.jaas;
import junit.framework.TestCase;
import net.sf.acegisecurity.Authentication;
import net.sf.acegisecurity.AuthenticationException;
import net.sf.acegisecurity.GrantedAuthority;
import net.sf.acegisecurity.GrantedAuthorityImpl;
import net.sf.acegisecurity.providers.UsernamePasswordAuthenticationToken;
import org.springframework.context.support.FileSystemXmlApplicationContext;
import java.util.Arrays;
import java.util.List;
/**
* Insert comments here...
* <br>
*
* @author Ray Krueger
* @version $Id$
*/
public class JAASAuthenticationProviderTests extends TestCase {
private JAASAuthenticationProvider jaasProvider;
protected void setUp() throws Exception {
String resName = "/" + getClass().getName().replace('.', '/') + ".xml";
FileSystemXmlApplicationContext context = new FileSystemXmlApplicationContext(getClass().getResource(resName).toString());
jaasProvider = (JAASAuthenticationProvider) context.getBean("jaasAuthenticationProvider");
}
public void testFull() throws Exception {
GrantedAuthorityImpl role1 = new GrantedAuthorityImpl("ROLE_1");
GrantedAuthorityImpl role2 = new GrantedAuthorityImpl("ROLE_2");
GrantedAuthority[] defaultAuths = new GrantedAuthority[]{
role1,
role2,
};
UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken("user", "password", defaultAuths);
Authentication auth = jaasProvider.authenticate(token);
List list = Arrays.asList(auth.getAuthorities());
assertTrue("GrantedAuthorities does not contain ROLE_TEST",
list.contains(new GrantedAuthorityImpl("ROLE_TEST")));
assertTrue("GrantedAuthorities does not contain ROLE_1", list.contains(role1));
assertTrue("GrantedAuthorities does not contain ROLE_2", list.contains(role2));
}
public void testBadUser() {
try {
jaasProvider.authenticate(new UsernamePasswordAuthenticationToken("asdf", "password"));
fail("LoginException should have been thrown for the bad user");
} catch (AuthenticationException e) {
}
}
public void testBadPassword() {
try {
jaasProvider.authenticate(new UsernamePasswordAuthenticationToken("user", "asdf"));
fail("LoginException should have been thrown for the bad password");
} catch (AuthenticationException e) {
}
}
}

View File

@@ -1,25 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="jaasAuthenticationProvider" class="net.sf.acegisecurity.providers.jaas.JAASAuthenticationProvider">
<property name="loginContextName">
<value>JAASTest</value>
</property>
<property name="loginConfig">
<value>classpath:net/sf/acegisecurity/providers/jaas/login.conf</value>
</property>
<property name="callbackHandlers">
<list>
<bean class="net.sf.acegisecurity.providers.jaas.TestCallbackHandler"/>
<bean class="net.sf.acegisecurity.providers.jaas.JAASNameCallbackHandler"/>
<bean class="net.sf.acegisecurity.providers.jaas.JAASPasswordCallbackHandler"/>
</list>
</property>
<property name="authorityGranters">
<list>
<bean class="net.sf.acegisecurity.providers.jaas.TestAuthorityGranter"/>
</list>
</property>
</bean>
</beans>