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


Java RememberMeAuthenticationException类代码示例

本文整理汇总了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);
}
 
开发者ID:csokafor,项目名称:spring-security-angularjs,代码行数:23,代码来源:RememberMeServices.java

示例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);
}
 
开发者ID:csokafor,项目名称:spring-security-angularjs,代码行数:24,代码来源:RememberMeServices.java

示例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);
}
 
开发者ID:VHAINNOVATIONS,项目名称:BCDS,代码行数:23,代码来源:CustomPersistentRememberMeServices.java

示例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);
}
 
开发者ID:VHAINNOVATIONS,项目名称:BCDS,代码行数:24,代码来源:CustomPersistentRememberMeServices.java

示例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);
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:23,代码来源:CustomPersistentRememberMeServices.java

示例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);
}
 
开发者ID:ServiceCutter,项目名称:ServiceCutter,代码行数:24,代码来源:CustomPersistentRememberMeServices.java

示例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);
}
 
开发者ID:ServiceCutter,项目名称:ServiceCutter,代码行数:26,代码来源:CustomPersistentRememberMeServices.java

示例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);
}
 
开发者ID:ralscha,项目名称:eds-starter6-jpa,代码行数:30,代码来源:CustomPersistentRememberMeServices.java

示例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);
}
 
开发者ID:priitl,项目名称:p2p-webtv,代码行数:22,代码来源:PersistentRememberMeServices.java

示例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);
}
 
开发者ID:priitl,项目名称:p2p-webtv,代码行数:23,代码来源:PersistentRememberMeServices.java

示例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);
}
 
开发者ID:glebreton,项目名称:lapetiterennes,代码行数:23,代码来源:CustomPersistentRememberMeServices.java

示例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);
}
 
开发者ID:glebreton,项目名称:lapetiterennes,代码行数:32,代码来源:CustomPersistentRememberMeServices.java


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