Package org.springframework.security.authentication

Examples of org.springframework.security.authentication.RememberMeAuthenticationProvider


    @Marker( SpringSecurityServices.class )
    public final AuthenticationProvider buildRememberMeAuthenticationProvider(
            @Inject @Value( "${spring-security.rememberme.key}" ) final String rememberMeKey ) throws Exception {

        final RememberMeAuthenticationProvider provider = new RememberMeAuthenticationProvider(rememberMeKey);
        provider.afterPropertiesSet();
        return provider;
    }
View Full Code Here


    @Marker( SpringSecurityServices.class )
    public final AuthenticationProvider buildRememberMeAuthenticationProvider(
            @Inject @Value( "${spring-security.rememberme.key}" ) final String rememberMeKey ) throws Exception {

        final RememberMeAuthenticationProvider provider = new RememberMeAuthenticationProvider(rememberMeKey);
        provider.afterPropertiesSet();
        return provider;
    }
View Full Code Here

        LogoutConfigurer<H> logoutConfigurer = http.getConfigurer(LogoutConfigurer.class);
        if(logoutConfigurer != null) {
            logoutConfigurer.addLogoutHandler(logoutHandler);
        }

        RememberMeAuthenticationProvider authenticationProvider = new RememberMeAuthenticationProvider(
                key);
        authenticationProvider = postProcess(authenticationProvider);
        http.authenticationProvider(authenticationProvider);

        initDefaultLoginFilter(http);
View Full Code Here

*/
public class RememberMeAuthenticationProviderTests extends TestCase {
    //~ Methods ========================================================================================================

    public void testDetectsAnInvalidKey() throws Exception {
        RememberMeAuthenticationProvider aap = new RememberMeAuthenticationProvider();
        aap.setKey("qwerty");

        RememberMeAuthenticationToken token = new RememberMeAuthenticationToken("WRONG_KEY", "Test",
                AuthorityUtils.createAuthorityList("ROLE_ONE", "ROLE_TWO"));

        try {
            aap.authenticate(token);
            fail("Should have thrown BadCredentialsException");
        } catch (BadCredentialsException expected) {
        }
    }
View Full Code Here

        } catch (BadCredentialsException expected) {
        }
    }

    public void testDetectsMissingKey() throws Exception {
        RememberMeAuthenticationProvider aap = new RememberMeAuthenticationProvider();

        try {
            aap.afterPropertiesSet();
            fail("Should have thrown IllegalArgumentException");
        } catch (IllegalArgumentException expected) {
            assertTrue(true);
        }
    }
View Full Code Here

            assertTrue(true);
        }
    }

    public void testGettersSetters() throws Exception {
        RememberMeAuthenticationProvider aap = new RememberMeAuthenticationProvider();
        aap.setKey("qwerty");
        aap.afterPropertiesSet();
        assertEquals("qwerty", aap.getKey());
    }
View Full Code Here

        aap.afterPropertiesSet();
        assertEquals("qwerty", aap.getKey());
    }

    public void testIgnoresClassesItDoesNotSupport() throws Exception {
        RememberMeAuthenticationProvider aap = new RememberMeAuthenticationProvider();
        aap.setKey("qwerty");

        TestingAuthenticationToken token = new TestingAuthenticationToken("user", "password","ROLE_A");
        assertFalse(aap.supports(TestingAuthenticationToken.class));

        // Try it anyway
        assertNull(aap.authenticate(token));
    }
View Full Code Here

        // Try it anyway
        assertNull(aap.authenticate(token));
    }

    public void testNormalOperation() throws Exception {
        RememberMeAuthenticationProvider aap = new RememberMeAuthenticationProvider();
        aap.setKey("qwerty");

        RememberMeAuthenticationToken token = new RememberMeAuthenticationToken("qwerty", "Test",
                AuthorityUtils.createAuthorityList("ROLE_ONE", "ROLE_TWO"));

        Authentication result = aap.authenticate(token);

        assertEquals(result, token);
    }
View Full Code Here

        assertEquals(result, token);
    }

    public void testSupports() {
        RememberMeAuthenticationProvider aap = new RememberMeAuthenticationProvider();
        assertTrue(aap.supports(RememberMeAuthenticationToken.class));
        assertFalse(aap.supports(TestingAuthenticationToken.class));
    }
View Full Code Here

  protected void configure(AuthenticationManagerBuilder auth) throws Exception {
    OpenIDAuthenticationProvider openidProvider = new OpenIDAuthenticationProvider();
    openidProvider.setAuthenticationUserDetailsService(new SimpleUserService());
    auth.authenticationProvider(openidProvider);

    RememberMeAuthenticationProvider rmeProvider = new RememberMeAuthenticationProvider(Config.APP_SECRET_KEY);
    auth.authenticationProvider(rmeProvider);
  }
View Full Code Here

TOP

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

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.