本文整理汇总了Java中org.springframework.security.authentication.RememberMeAuthenticationToken类的典型用法代码示例。如果您正苦于以下问题:Java RememberMeAuthenticationToken类的具体用法?Java RememberMeAuthenticationToken怎么用?Java RememberMeAuthenticationToken使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RememberMeAuthenticationToken类属于org.springframework.security.authentication包,在下文中一共展示了RememberMeAuthenticationToken类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: authenticate
import org.springframework.security.authentication.RememberMeAuthenticationToken; //导入依赖的package包/类
public void authenticate(Connection<?> connection) {
Facebook facebook = (Facebook) connection.getApi();
String [] fields = { "id", "name", "email", "first_name", "last_name" };
User userProfile = facebook.fetchObject("me", User.class, fields);
String username = userProfile.getName();
log.info("User Profile by facebook {} {} {}", userProfile.getFirstName(), userProfile.getLastName(), userProfile.getEmail());
Optional<io.osoon.domain.User> byEmail = userService.findByEmail(userProfile.getEmail());
io.osoon.domain.User osoonUser;
if (byEmail.isPresent()) {
osoonUser = byEmail.get();
} else {
io.osoon.domain.User newUser = io.osoon.domain.User.of(userProfile.getEmail(), username);
newUser.setImageUrl(connection.getImageUrl());
osoonUser = userService.saveOne(newUser);
}
OSoonUserDetails userDetails = new OSoonUserDetails(osoonUser);
RememberMeAuthenticationToken rememberMeToken = new RememberMeAuthenticationToken("osoon-remember-me", userDetails, null);
SecurityContextHolder.getContext().setAuthentication(rememberMeToken);
log.info("User {} {} {} connected.", userProfile.getFirstName(), userProfile.getLastName(), userProfile.getEmail());
}
开发者ID:spring-sprout,项目名称:osoon,代码行数:26,代码来源:AuthUtil.java
示例2: doFilter
import org.springframework.security.authentication.RememberMeAuthenticationToken; //导入依赖的package包/类
@Override
public void doFilter(ServletRequest servletRequest,
ServletResponse servletResponse,
FilterChain filterChain) throws IOException, ServletException {
Authentication auth = SecurityContextHolder.getContext().getAuthentication();
if (auth != null && auth instanceof RememberMeAuthenticationToken) {
rememberMeServices.loginSuccess((HttpServletRequest) servletRequest,
(HttpServletResponse) servletResponse, auth);
}
filterChain.doFilter(servletRequest, servletResponse);
}
开发者ID:spring-sprout,项目名称:osoon,代码行数:15,代码来源:OSoonRememberMeAuthenticationFilter.java
示例3: isRememberMeAuthenticated
import org.springframework.security.authentication.RememberMeAuthenticationToken; //导入依赖的package包/类
/**
* Check if user is login by remember me cookie, refer
* org.springframework.security.authentication.
* AuthenticationTrustResolverImpl
*/
@SuppressWarnings("unused")
private boolean isRememberMeAuthenticated() {
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
if (authentication == null) {
return false;
}
return RememberMeAuthenticationToken.class.isAssignableFrom(authentication.getClass());
}
开发者ID:yyang325,项目名称:YahooFinanceTradingSystem,代码行数:16,代码来源:LoginController.java
示例4: onValidTokenFound
import org.springframework.security.authentication.RememberMeAuthenticationToken; //导入依赖的package包/类
protected void onValidTokenFound(HttpServletRequest request, HttpServletResponse response, RemoteToken token) {
try {
FlowableAppUser appUser = userCache.get(token.getUserId());
validateRequiredPriviliges(request, response, appUser);
SecurityContextHolder.getContext().setAuthentication(new RememberMeAuthenticationToken(token.getId(),
appUser, appUser.getAuthorities()));
} catch (Exception e) {
LOGGER.trace("Could not set necessary threadlocals for token", e);
redirectOrSendNotPermitted(request, response, token.getUserId());
}
}
开发者ID:flowable,项目名称:flowable-engine,代码行数:13,代码来源:FlowableCookieFilter.java
示例5: convertUsernamePasswordToRememberMeAuthentication
import org.springframework.security.authentication.RememberMeAuthenticationToken; //导入依赖的package包/类
/**
* This is needed so that expressions in spring-security SPEL work properly.
*/
public static void convertUsernamePasswordToRememberMeAuthentication() {
final UsernamePasswordAuthenticationToken usernamePassword = (UsernamePasswordAuthenticationToken) getAuthentication();
final RememberMeAuthenticationToken rememberMe = new RememberMeAuthenticationToken(
ExtendedAnonymousAuthenticationFilter.KEY, usernamePassword.getPrincipal(),
usernamePassword.getAuthorities());
setAuthentication(rememberMe);
}
开发者ID:subes,项目名称:invesdwin-nowicket,代码行数:11,代码来源:SpringSecuritySessionAttributes.java
示例6: isRemembered
import org.springframework.security.authentication.RememberMeAuthenticationToken; //导入依赖的package包/类
public boolean isRemembered(Authentication authentication, String attribute) {
return IS_REMEMBERED.equals(attribute)
&& RememberMeAuthenticationToken.class
.isAssignableFrom(authentication.getClass());
}
开发者ID:zhaojunfei,项目名称:lemon,代码行数:6,代码来源:AuthenticatedVoter.java
示例7: supports
import org.springframework.security.authentication.RememberMeAuthenticationToken; //导入依赖的package包/类
@Override
public boolean supports(Class<?> authentication) {
return (RememberMeAuthenticationToken.class.isAssignableFrom(authentication));
}
开发者ID:EsupPortail,项目名称:esup-ecandidat,代码行数:5,代码来源:SecurityAuthenticationProvider.java
示例8: login
import org.springframework.security.authentication.RememberMeAuthenticationToken; //导入依赖的package包/类
protected void login(User user) {
OSoonUserDetails userDetails = new OSoonUserDetails(user);
RememberMeAuthenticationToken rememberMeToken = new RememberMeAuthenticationToken("osoon-remember-me", userDetails, null);
SecurityContextHolder.getContext().setAuthentication(rememberMeToken);
}
开发者ID:spring-sprout,项目名称:osoon,代码行数:6,代码来源:ControllerTest.java
示例9: isFullyAuthenticated
import org.springframework.security.authentication.RememberMeAuthenticationToken; //导入依赖的package包/类
protected boolean isFullyAuthenticated(Authentication authentication) {
return !(authentication instanceof AnonymousAuthenticationToken ||
authentication instanceof RememberMeAuthenticationToken);
}
开发者ID:mattpwest,项目名称:entelect-spring-webapp-template,代码行数:5,代码来源:CustomAccessDeniedHandler.java
示例10: isRememberMe
import org.springframework.security.authentication.RememberMeAuthenticationToken; //导入依赖的package包/类
@Override
public boolean isRememberMe() {
return getAuthentication() instanceof RememberMeAuthenticationToken;
}
开发者ID:subes,项目名称:invesdwin-nowicket,代码行数:5,代码来源:SpringSecurityAuthenticationService.java
注:本文中的org.springframework.security.authentication.RememberMeAuthenticationToken类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论