Package org.springframework.security.authentication

Examples of org.springframework.security.authentication.TestingAuthenticationProvider


        config.add("EnsureNonNullHttpRequestAndResponse", filter,"before:*");
    }
   
    //@Marker(SpringSecurityServices.class)
  public static void contributeAuthenticationManager(final OrderedConfiguration<AuthenticationProvider> configuration) {
      configuration.add("test", new TestingAuthenticationProvider());
    }
View Full Code Here


* @author Ben Alex
*/
public class TestingAuthenticationProviderTests extends TestCase {

    public void testAuthenticates() {
        TestingAuthenticationProvider provider = new TestingAuthenticationProvider();
        TestingAuthenticationToken token = new TestingAuthenticationToken("Test", "Password","ROLE_ONE","ROLE_TWO");
        Authentication result = provider.authenticate(token);

        assertTrue(result instanceof TestingAuthenticationToken);

        TestingAuthenticationToken castResult = (TestingAuthenticationToken) result;
        assertEquals("Test", castResult.getPrincipal());
View Full Code Here

        assertTrue(AuthorityUtils.authorityListToSet(castResult.getAuthorities()).contains("ROLE_ONE"));
        assertTrue(AuthorityUtils.authorityListToSet(castResult.getAuthorities()).contains("ROLE_TWO"));
    }

    public void testSupports() {
        TestingAuthenticationProvider provider = new TestingAuthenticationProvider();
        assertTrue(provider.supports(TestingAuthenticationToken.class));
        assertTrue(!provider.supports(String.class));
    }
View Full Code Here

    addComponentInstantiationListener(new SpringComponentInjector(this, appctx, true));

    ProviderManager authMan = new ProviderManager();
    List<TestingAuthenticationProvider> providerList =
      new ArrayList<TestingAuthenticationProvider>();
    providerList.add(new TestingAuthenticationProvider());
    authMan.setProviders(providerList);

    // appctx.putBean("testAuthenticationProvider", authProvider);
    // appctx.putBean("authenticationManager", authMan);
    this.authenticationManager = authMan;
View Full Code Here

TOP

Related Classes of org.springframework.security.authentication.TestingAuthenticationProvider

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.