本文整理汇总了Java中org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationException类的典型用法代码示例。如果您正苦于以下问题:Java RememberMeAuthenticationException类的具体用法?Java RememberMeAuthenticationException怎么用?Java RememberMeAuthenticationException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RememberMeAuthenticationException类属于org.springframework.security.web.authentication.rememberme包,在下文中一共展示了RememberMeAuthenticationException类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processAutoLoginCookie
import org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationException; //导入依赖的package包/类
@Override
@Transactional
protected UserDetails processAutoLoginCookie(String[] cookieTokens, HttpServletRequest request, HttpServletResponse response) {
Token token = getPersistentToken(cookieTokens);
String login = token.getUserLogin();
// Token also matches, so login is valid. Update the token value, keeping the *same* series number.
log.debug("Refreshing persistent login token for user '{}', series '{}'", login, token.getSeries());
token.setDate(new Date());
token.setValue(generateTokenData());
token.setIpAddress(request.getRemoteAddr());
token.setUserAgent(request.getHeader("User-Agent"));
try {
tokenRepo.save(token);
addCookie(token, request, response);
} catch (DataAccessException e) {
log.error("Failed to update token: ", e);
throw new RememberMeAuthenticationException("Autologin failed due to data access problem", e);
}
return getUserDetailsService().loadUserByUsername(login);
}
示例2: logout
import org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationException; //导入依赖的package包/类
/**
* When logout occurs, only invalidate the current token, and not all user sessions.
* <p/>
* The standard Spring Security implementations are too basic: they invalidate all tokens for the
* current user, so when he logs out from one browser, all his other sessions are destroyed.
*/
@Override
@Transactional
public void logout(HttpServletRequest request, HttpServletResponse response, Authentication authentication) {
String rememberMeCookie = extractRememberMeCookie(request);
if (rememberMeCookie != null && rememberMeCookie.length() != 0) {
try {
String[] cookieTokens = decodeCookie(rememberMeCookie);
Token token = getPersistentToken(cookieTokens);
tokenRepo.delete(token.getSeries());
} catch (InvalidCookieException ice) {
log.info("Invalid cookie, no persistent token could be deleted");
} catch (RememberMeAuthenticationException rmae) {
log.debug("No persistent token found, so no token could be deleted");
}
}
super.logout(request, response, authentication);
}
示例3: processAutoLoginCookie
import org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationException; //导入依赖的package包/类
@Override
@Transactional
protected UserDetails processAutoLoginCookie(String[] cookieTokens, HttpServletRequest request, HttpServletResponse response) {
PersistentToken token = getPersistentToken(cookieTokens);
String login = token.getUser().getLogin();
// Token also matches, so login is valid. Update the token value, keeping the *same* series number.
log.debug("Refreshing persistent login token for user '{}', series '{}'", login, token.getSeries());
token.setTokenDate(new LocalDate());
token.setTokenValue(generateTokenData());
token.setIpAddress(request.getRemoteAddr());
token.setUserAgent(request.getHeader("User-Agent"));
try {
persistentTokenRepository.saveAndFlush(token);
addCookie(token, request, response);
} catch (DataAccessException e) {
log.error("Failed to update token: ", e);
throw new RememberMeAuthenticationException("Autologin failed due to data access problem", e);
}
return getUserDetailsService().loadUserByUsername(login);
}
示例4: logout
import org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationException; //导入依赖的package包/类
/**
* When logout occurs, only invalidate the current token, and not all user sessions.
* <p/>
* The standard Spring Security implementations are too basic: they invalidate all tokens for the
* current user, so when he logs out from one browser, all his other sessions are destroyed.
*/
@Override
@Transactional
public void logout(HttpServletRequest request, HttpServletResponse response, Authentication authentication) {
String rememberMeCookie = extractRememberMeCookie(request);
if (rememberMeCookie != null && rememberMeCookie.length() != 0) {
try {
String[] cookieTokens = decodeCookie(rememberMeCookie);
PersistentToken token = getPersistentToken(cookieTokens);
persistentTokenRepository.delete(token);
} catch (InvalidCookieException ice) {
log.info("Invalid cookie, no persistent token could be deleted");
} catch (RememberMeAuthenticationException rmae) {
log.debug("No persistent token found, so no token could be deleted");
}
}
super.logout(request, response, authentication);
}
示例5: logout
import org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationException; //导入依赖的package包/类
/**
* When logout occurs, only invalidate the current token, and not all user sessions.
* <p/>
* The standard Spring Security implementations are too basic: they invalidate all tokens for the current user, so when he logs out from one browser, all his other sessions are destroyed.
*/
@Override
@Transactional
public void logout(HttpServletRequest request, HttpServletResponse response, Authentication authentication) {
String rememberMeCookie = extractRememberMeCookie(request);
if (rememberMeCookie != null && rememberMeCookie.length() != 0) {
try {
String[] cookieTokens = decodeCookie(rememberMeCookie);
Token token = getPersistentToken(cookieTokens);
persistentTokenService.delete(token);
} catch (InvalidCookieException ice) {
LOGGER.info("Invalid cookie, no persistent token could be deleted");
} catch (RememberMeAuthenticationException rmae) {
LOGGER.debug("No persistent token found, so no token could be deleted");
}
}
super.logout(request, response, authentication);
}
示例6: processAutoLoginCookie
import org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationException; //导入依赖的package包/类
@Override
@Transactional
protected UserDetails processAutoLoginCookie(String[] cookieTokens, HttpServletRequest request,
HttpServletResponse response) {
PersistentToken token = getPersistentToken(cookieTokens);
String login = token.getUser().getLogin();
// Token also matches, so login is valid. Update the token value, keeping the *same* series number.
log.debug("Refreshing persistent login token for user '{}', series '{}'", login, token.getSeries());
token.setTokenDate(LocalDate.now());
token.setTokenValue(generateTokenData());
token.setIpAddress(request.getRemoteAddr());
token.setUserAgent(request.getHeader("User-Agent"));
try {
persistentTokenRepository.saveAndFlush(token);
addCookie(token, request, response);
} catch (DataAccessException e) {
log.error("Failed to update token: ", e);
throw new RememberMeAuthenticationException("Autologin failed due to data access problem", e);
}
return getUserDetailsService().loadUserByUsername(login);
}
开发者ID:TransparencyInternationalEU,项目名称:lobbycal,代码行数:24,代码来源:CustomPersistentRememberMeServices.java
示例7: processAutoLoginCookie
import org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationException; //导入依赖的package包/类
@Override
@Transactional
protected UserDetails processAutoLoginCookie(final String[] cookieTokens, final HttpServletRequest request, final HttpServletResponse response) {
PersistentToken token = getPersistentToken(cookieTokens);
String login = token.getUser().getLogin();
// Token also matches, so login is valid. Update the token value,
// keeping the *same* series number.
log.debug("Refreshing persistent login token for user '{}', series '{}'", login, token.getSeries());
token.setTokenDate(new LocalDate());
token.setTokenValue(generateTokenData());
token.setIpAddress(request.getRemoteAddr());
token.setUserAgent(request.getHeader("User-Agent"));
try {
persistentTokenRepository.saveAndFlush(token);
addCookie(token, request, response);
} catch (DataAccessException e) {
log.error("Failed to update token: ", e);
throw new RememberMeAuthenticationException("Autologin failed due to data access problem", e);
}
return getUserDetailsService().loadUserByUsername(login);
}
示例8: logout
import org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationException; //导入依赖的package包/类
/**
* When logout occurs, only invalidate the current token, and not all user
* sessions.
* <p/>
* The standard Spring Security implementations are too basic: they
* invalidate all tokens for the current user, so when he logs out from one
* browser, all his other sessions are destroyed.
*/
@Override
@Transactional
public void logout(final HttpServletRequest request, final HttpServletResponse response, final Authentication authentication) {
String rememberMeCookie = extractRememberMeCookie(request);
if (rememberMeCookie != null && rememberMeCookie.length() != 0) {
try {
String[] cookieTokens = decodeCookie(rememberMeCookie);
PersistentToken token = getPersistentToken(cookieTokens);
persistentTokenRepository.delete(token);
} catch (InvalidCookieException ice) {
log.info("Invalid cookie, no persistent token could be deleted");
} catch (RememberMeAuthenticationException rmae) {
log.debug("No persistent token found, so no token could be deleted");
}
}
super.logout(request, response, authentication);
}
示例9: logout
import org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationException; //导入依赖的package包/类
/**
* When logout occurs, only invalidate the current token, and not all user sessions.
* <p/>
* The standard Spring Security implementations are too basic: they invalidate all
* tokens for the current user, so when he logs out from one browser, all his other
* sessions are destroyed.
*/
@Override
public void logout(HttpServletRequest request, HttpServletResponse response,
Authentication authentication) {
String rememberMeCookie = extractRememberMeCookie(request);
if (rememberMeCookie != null && rememberMeCookie.length() != 0) {
try {
String[] cookieTokens = decodeCookie(rememberMeCookie);
removePersistentLogin(getPersistentToken(cookieTokens));
}
catch (InvalidCookieException ice) {
Application.logger
.info("Invalid cookie, no persistent token could be deleted");
}
catch (RememberMeAuthenticationException rmae) {
Application.logger
.debug("No persistent token found, so no token could be deleted");
}
}
super.logout(request, response, authentication);
}
示例10: processAutoLoginCookie
import org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationException; //导入依赖的package包/类
@Override
@Transactional
protected UserDetails processAutoLoginCookie(String[] cookieTokens, HttpServletRequest request, HttpServletResponse response) {
PersistentToken token = getPersistentToken(cookieTokens);
String login = token.getUser().getLogin();
// Token also matches, so login is valid. Update the token value, keeping the *same* series number.
log.debug("Refreshing persistent login token for user '{}', series '{}'", login, token.getSeries());
token.setTokenDate(LocalDate.now());
token.setTokenValue(generateTokenData());
token.setIpAddress(request.getRemoteAddr());
token.setUserAgent(request.getHeader("User-Agent"));
try {
persistentTokenRepository.saveAndFlush(token);
addCookie(token, request, response);
} catch (DataAccessException e) {
log.error("Failed to update token: ", e);
throw new RememberMeAuthenticationException("Autologin failed due to data access problem", e);
}
return getUserDetailsService().loadUserByUsername(login);
}
示例11: logout
import org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationException; //导入依赖的package包/类
/**
* When logout occurs, only invalidate the current token, and not all user sessions. <p/> The standard Spring Security
* implementations are too basic: they invalidate all tokens for the current user, so when he logs out from one browser,
* all his other sessions are destroyed.
*/
@Override
@Transactional
public void logout(HttpServletRequest request, HttpServletResponse response, Authentication authentication) {
String rememberMeCookie = extractRememberMeCookie(request);
if (rememberMeCookie != null && rememberMeCookie.length() != 0) {
try {
String[] cookieTokens = decodeCookie(rememberMeCookie);
PersistentToken token = getPersistentToken(cookieTokens);
persistentTokenRepository.delete(token);
} catch (InvalidCookieException ice) {
log.info("Invalid cookie, no persistent token could be deleted");
} catch (RememberMeAuthenticationException rmae) {
log.debug("No persistent token found, so no token could be deleted");
}
}
super.logout(request, response, authentication);
}
示例12: processAutoLoginCookie
import org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationException; //导入依赖的package包/类
@Override
@Transactional
protected UserDetails processAutoLoginCookie(String[] cookieTokens, HttpServletRequest request, HttpServletResponse response) {
final PersistentToken token = getPersistentToken(cookieTokens);
final String login = token.getUser().getLogin();
// Token also matches, so login is valid. Update the token value, keeping the *same* series number.
log.debug("Refreshing persistent login token for user '{}', series '{}'", login, token.getSeries());
token.setTokenDate(new LocalDate());
token.setTokenValue(generateTokenData());
token.setIpAddress(request.getRemoteAddr());
token.setUserAgent(request.getHeader("User-Agent"));
try {
persistentTokenRepository.saveAndFlush(token);
addCookie(token, request, response);
} catch (final DataAccessException e) {
log.error("Failed to update token: ", e);
throw new RememberMeAuthenticationException("Autologin failed due to data access problem", e);
}
return getUserDetailsService().loadUserByUsername(login);
}
示例13: logout
import org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationException; //导入依赖的package包/类
/**
* <p>
* When logout occurs, only invalidate the current token, and not all user sessions.
* </p>
* The standard Spring Security implementations are too basic: they invalidate all tokens for the current user, so when he logs out from one browser, all
* his other sessions are destroyed.
*
* @param request
* the http request
* @param response
* the http response
* @param authentication
* the authentication
*/
@Override
@Transactional
public void logout(HttpServletRequest request, HttpServletResponse response, Authentication authentication) {
final String rememberMeCookie = extractRememberMeCookie(request);
if (rememberMeCookie != null && rememberMeCookie.length() != 0) {
try {
final String[] cookieTokens = decodeCookie(rememberMeCookie);
final PersistentToken token = getPersistentToken(cookieTokens);
persistentTokenRepository.delete(token);
} catch (final InvalidCookieException ice) {
log.info("Invalid cookie, no persistent token could be deleted");
} catch (final RememberMeAuthenticationException rmae) {
log.debug("No persistent token found, so no token could be deleted");
}
}
super.logout(request, response, authentication);
}