Package org.springframework.security.web.authentication.rememberme

Examples of org.springframework.security.web.authentication.rememberme.TokenBasedRememberMeServices


    @Marker( SpringSecurityServices.class )
    public static RememberMeServices build(
            final UserDetailsService userDetailsService,
            @Inject @Value( "${spring-security.rememberme.key}" ) final String rememberMeKey ) {

        final TokenBasedRememberMeServices rememberMe = new TokenBasedRememberMeServices(rememberMeKey,userDetailsService);
        return rememberMe;
    }
View Full Code Here


    @Marker( SpringSecurityServices.class )
    public static LogoutHandler buildRememberMeLogoutHandler(
            final UserDetailsService userDetailsService,
            @Inject @Value( "${spring-security.rememberme.key}" ) final String rememberMeKey ) throws Exception {

        final TokenBasedRememberMeServices rememberMe = new TokenBasedRememberMeServices(rememberMeKey,userDetailsService);
        rememberMe.afterPropertiesSet();
        return rememberMe;
    }
View Full Code Here

    @Marker( SpringSecurityServices.class )
    public static RememberMeServices build(
            final UserDetailsService userDetailsService,
            @Inject @Value( "${spring-security.rememberme.key}" ) final String rememberMeKey ) {

        final TokenBasedRememberMeServices rememberMe = new TokenBasedRememberMeServices(rememberMeKey,userDetailsService);
        return rememberMe;
    }
View Full Code Here

    @Marker( SpringSecurityServices.class )
    public static LogoutHandler buildRememberMeLogoutHandler(
            final UserDetailsService userDetailsService,
            @Inject @Value( "${spring-security.rememberme.key}" ) final String rememberMeKey ) throws Exception {

        final TokenBasedRememberMeServices rememberMe = new TokenBasedRememberMeServices(rememberMeKey,userDetailsService);
        rememberMe.afterPropertiesSet();
        return rememberMe;
    }
View Full Code Here

     * @return the {@link TokenBasedRememberMeServices}
     */
    private AbstractRememberMeServices createTokenBasedRememberMeServices(
            H http, String key) {
        UserDetailsService userDetailsService = getUserDetailsService(http);
        return new TokenBasedRememberMeServices(key, userDetailsService);
    }
View Full Code Here

        filter.setAuthenticationManager(mock(AuthenticationManager.class));
        filter.setFilterProcessesUrl("/p");
        filter.afterPropertiesSet();

        assertNotNull(filter.getRememberMeServices());
        filter.setRememberMeServices(new TokenBasedRememberMeServices());
        assertEquals(TokenBasedRememberMeServices.class, filter.getRememberMeServices().getClass());
        assertTrue(filter.getAuthenticationManager() != null);
        assertEquals("/p", filter.getFilterProcessesUrl());
    }
View Full Code Here

    //~ Methods ========================================================================================================

    @Before
    public void createTokenBasedRememberMeServices() {
        services = new TokenBasedRememberMeServices();
        uds = mock(UserDetailsService.class);
        services.setKey("key");
        services.setUserDetailsService(uds);
    }
View Full Code Here

        assertEquals(0, cookie.getMaxAge());
    }

    @Test
    public void loginSuccessIgnoredIfParameterNotSetOrFalse() {
        TokenBasedRememberMeServices services = new TokenBasedRememberMeServices();
        MockHttpServletRequest request = new MockHttpServletRequest();
        request.addParameter(DEFAULT_PARAMETER, "false");

        MockHttpServletResponse response = new MockHttpServletResponse();
        services.loginSuccess(request, response, new TestingAuthenticationToken("someone", "password","ROLE_ABC"));

        Cookie cookie = response.getCookie(SPRING_SECURITY_REMEMBER_ME_COOKIE_KEY);
        assertNull(cookie);
    }
View Full Code Here

    return new UserService();
  }

  @Bean
  public TokenBasedRememberMeServices rememberMeServices() {
    return new TokenBasedRememberMeServices("remember-me-key", userService());
  }
View Full Code Here

    successHandler.setUseReferer(true);

    SimpleUrlAuthenticationFailureHandler failureHandler = new SimpleUrlAuthenticationFailureHandler();
    failureHandler.setDefaultFailureUrl(confMap.get("security.signin_failure"));

    TokenBasedRememberMeServices tbrms = new TokenBasedRememberMeServices(Config.APP_SECRET_KEY, new SimpleUserService());
    tbrms.setAlwaysRemember(true);
    tbrms.setTokenValiditySeconds(Config.SESSION_TIMEOUT_SEC.intValue());
    tbrms.setCookieName(Config.AUTH_COOKIE);
    tbrms.setParameter(Config.AUTH_COOKIE.concat("-remember-me"));
    http.rememberMe().rememberMeServices(tbrms);

    PasswordAuthFilter passwordFilter = new PasswordAuthFilter("/" + PasswordAuthFilter.PASSWORD_ACTION);
    passwordFilter.setAuthenticationManager(authenticationManager());
    passwordFilter.setAuthenticationSuccessHandler(successHandler);
View Full Code Here

TOP

Related Classes of org.springframework.security.web.authentication.rememberme.TokenBasedRememberMeServices

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.