当前位置: 首页>>代码示例>>Java>>正文


Java TokenBasedRememberMeServices类代码示例

本文整理汇总了Java中org.springframework.security.web.authentication.rememberme.TokenBasedRememberMeServices的典型用法代码示例。如果您正苦于以下问题:Java TokenBasedRememberMeServices类的具体用法?Java TokenBasedRememberMeServices怎么用?Java TokenBasedRememberMeServices使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


TokenBasedRememberMeServices类属于org.springframework.security.web.authentication.rememberme包,在下文中一共展示了TokenBasedRememberMeServices类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: init

import org.springframework.security.web.authentication.rememberme.TokenBasedRememberMeServices; //导入依赖的package包/类
@Before
public void init() {
    audienceManagerService = mock(AudienceManagerService.class);
    authenticationManager = mock(AuthenticationManager.class);
    UserDetailsService userDetailsService = mock(UserDetailsService.class);
    TokenBasedRememberMeServices rememberMeServices = spy(new TokenBasedRememberMeServices("key", userDetailsService));
    provider = new AudienceManagerSecurityProvider(audienceManagerService, authenticationManager, rememberMeServices);

    token.setDetails("id");

    doThrow(new BadCredentialsException("Test")).when(authenticationManager).authenticate(any(Authentication.class));
    doReturn(token).when(authenticationManager).authenticate(argThat(new BaseMatcher<Authentication>() {
        @Override
        public boolean matches(Object item) {
            return ((Authentication) item).getPrincipal().equals("user");
        }

        @Override
        public void describeTo(Description description) {
            description.appendText("Username is user");
        }
    }));
}
 
开发者ID:sdl,项目名称:dxa-modules,代码行数:24,代码来源:AudienceManagerSecurityProviderTest.java

示例2: rememberMeServices

import org.springframework.security.web.authentication.rememberme.TokenBasedRememberMeServices; //导入依赖的package包/类
@Bean
    TokenBasedRememberMeServices rememberMeServices() {
        BackendTokenBasedRememberMeServices tokenBasedRememberMeServices = new BackendTokenBasedRememberMeServices(REMEMBER_ME_KEY, userDetailsService);
        tokenBasedRememberMeServices.setCookieName(REMEMBER_ME_TOKEN);
        tokenBasedRememberMeServices.setParameter(REMEMBER_ME_TOKEN);
        tokenBasedRememberMeServices.setTokenValiditySeconds(3600);
        tokenBasedRememberMeServices.setAlwaysRemember(true);
//        tokenBasedRememberMeServices.set;
        return tokenBasedRememberMeServices;
    }
 
开发者ID:lordoftheflies,项目名称:wonderjameeee,代码行数:11,代码来源:SecurityConfiguration.java

示例3: restoreRememberMeAuth

import org.springframework.security.web.authentication.rememberme.TokenBasedRememberMeServices; //导入依赖的package包/类
/**
 * try to restore remember me authentication and create valid session of it
 */
private static void restoreRememberMeAuth(HttpServletRequest request,HttpServletResponse response) {
    TokenBasedRememberMeServices tokenBasedRememberMeServices = ContextHelper.get().beanForType(
            TokenBasedRememberMeServices.class);
    Authentication authentication = tokenBasedRememberMeServices.autoLogin(request, response);
    if (authentication != null) {
        boolean sessionCreated = SessionUtils.setAuthentication(request, authentication, true);
        if (sessionCreated) {
            bindAuthentication(authentication);
        }
    }
}
 
开发者ID:alancnet,项目名称:artifactory,代码行数:15,代码来源:AuthUtils.java

示例4: rememberMeServices

import org.springframework.security.web.authentication.rememberme.TokenBasedRememberMeServices; //导入依赖的package包/类
@Bean
public RememberMeServices rememberMeServices() {
    // TODO Is there some way of exposing the RememberMeServices instance that the remember me configurer creates by default?
    TokenBasedRememberMeServices services = new TokenBasedRememberMeServices("myAppKey", userDetailsService());
    services.setAlwaysRemember(true);
    return services;
}
 
开发者ID:xyfreemind,项目名称:trader,代码行数:8,代码来源:TraderApplication.java

示例5: onActivate

import org.springframework.security.web.authentication.rememberme.TokenBasedRememberMeServices; //导入依赖的package包/类
Object onActivate() {

        // Clear session
        Session session = request.getSession(false);
        if (session != null) {
            session.invalidate();
        }

        // Remove RememberMe cookie
        cookies.removeCookieValue(TokenBasedRememberMeServices.SPRING_SECURITY_REMEMBER_ME_COOKIE_KEY);

        return Home.class;
    }
 
开发者ID:dlwhitehurst,项目名称:musicrecital,代码行数:14,代码来源:Logout.java

示例6: service

import org.springframework.security.web.authentication.rememberme.TokenBasedRememberMeServices; //导入依赖的package包/类
@Override
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

	// Get the entity manager factory if we don't have it
	if (this.entityManagerFactory == null) {
		this.entityManagerFactory = RuntimeBeanLoader.getBean(EntityManagerFactory.class);
	}

	// Create a new entity manager and set it in thread local
	if (this.entityManagerFactory != null) {
		LazyHibernateEntityManagerProvider.setCurrentEntityManager(this.entityManagerFactory.createEntityManager());
	}

	// Process the request normally now
	super.service(request, response);


	// Remove the used entity manager since it's finished with
	LazyHibernateEntityManagerProvider.setCurrentEntityManager(null);

	// We've just authorised the user in the service method so set the Remember Me cookie.
	// Ordinarily this would be done by Spring's UsernamePasswordAuthenticationFilter.
	Authentication auth = SecurityContextHolder.getContext().getAuthentication();
	if (auth != null && auth.isAuthenticated()) {
		if (rememberMeServices == null) {
			rememberMeServices = RuntimeBeanLoader.getBean(TokenBasedRememberMeServices.class);
		}
		rememberMeServices.onLoginSuccess(request, response, auth);
	}
}
 
开发者ID:code-monk,项目名称:vaadin4spring-bits,代码行数:31,代码来源:ServiceWrappedSpringVaadinServlet.java

示例7: rememberMeServices

import org.springframework.security.web.authentication.rememberme.TokenBasedRememberMeServices; //导入依赖的package包/类
/**
 * The {@link RememberMeServices} must be available as a Spring bean for
 * Vaadin4Spring.
 */
@Bean
public RememberMeServices rememberMeServices() {
	return new TokenBasedRememberMeServices(REMEMBERME_KEY, userDetailsService());
}
 
开发者ID:Horuss,项目名称:bbplay,代码行数:9,代码来源:SecurityConfiguration.java

示例8: rememberMeServices

import org.springframework.security.web.authentication.rememberme.TokenBasedRememberMeServices; //导入依赖的package包/类
@Bean
public RememberMeServices rememberMeServices() throws Exception {
    TokenBasedRememberMeServices result = new TokenBasedRememberMeServices("hell0w0r1d", service);
    result.setTokenValiditySeconds(2419200);
    return result;
}
 
开发者ID:nonocast,项目名称:todolist,代码行数:7,代码来源:WebSecurityConfiguration.java

示例9: rememberMeServices

import org.springframework.security.web.authentication.rememberme.TokenBasedRememberMeServices; //导入依赖的package包/类
@Bean
public TokenBasedRememberMeServices rememberMeServices() {
    return new TokenBasedRememberMeServices("remember-me-key", userService());
}
 
开发者ID:michalklempa,项目名称:pbkdf2springsecurity,代码行数:5,代码来源:SecurityConfig.java

示例10: rememberMeServices

import org.springframework.security.web.authentication.rememberme.TokenBasedRememberMeServices; //导入依赖的package包/类
@Bean
public TokenBasedRememberMeServices rememberMeServices() {
	return new TokenBasedRememberMeServices("remember-me-key", userService());
}
 
开发者ID:Upplication,项目名称:The-Punisher,代码行数:5,代码来源:SecurityConfig.java

示例11: rememberMeServices

import org.springframework.security.web.authentication.rememberme.TokenBasedRememberMeServices; //导入依赖的package包/类
@Bean
public TokenBasedRememberMeServices rememberMeServices() {
	return new TokenBasedRememberMeServices(REMEBER_ME_KEY, userService());
}
 
开发者ID:ChuyAMS,项目名称:spring-mvc-kickstart-archetype,代码行数:5,代码来源:SecurityConfig.java

示例12: rememberMeServices

import org.springframework.security.web.authentication.rememberme.TokenBasedRememberMeServices; //导入依赖的package包/类
/**
 * The {@link RememberMeServices} must be available as a Spring bean for Vaadin4Spring.
 */
@Bean
public RememberMeServices rememberMeServices() {
    return new TokenBasedRememberMeServices("myAppKey", userDetailsService());
}
 
开发者ID:peholmst,项目名称:vaadin4spring,代码行数:8,代码来源:Application.java

示例13: removeRememberMeCookie

import org.springframework.security.web.authentication.rememberme.TokenBasedRememberMeServices; //导入依赖的package包/类
private void removeRememberMeCookie() {
    ((WebResponse)getResponse()).clearCookie(
            new Cookie(TokenBasedRememberMeServices.SPRING_SECURITY_REMEMBER_ME_COOKIE_KEY, null));
}
 
开发者ID:mpostelnicu,项目名称:wicket-spring-jpa-bootstrap-boilerplate,代码行数:5,代码来源:Logout.java

示例14: rememberMeServices

import org.springframework.security.web.authentication.rememberme.TokenBasedRememberMeServices; //导入依赖的package包/类
@Bean
public RememberMeServices rememberMeServices() {
    return new TokenBasedRememberMeServices(env.getProperty("appKey"), userDetailsService);
}
 
开发者ID:kTT,项目名称:adjule,代码行数:5,代码来源:SecurityConfig.java

示例15: rememberMeServices

import org.springframework.security.web.authentication.rememberme.TokenBasedRememberMeServices; //导入依赖的package包/类
@Bean
public TokenBasedRememberMeServices rememberMeServices() {
    return new TokenBasedRememberMeServices("remember-me-key", accountService);
}
 
开发者ID:thymeleaf,项目名称:thymeleafexamples-layouts,代码行数:5,代码来源:SecurityConfig.java


注:本文中的org.springframework.security.web.authentication.rememberme.TokenBasedRememberMeServices类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。