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


Java PersistentRememberMeToken类代码示例

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


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

示例1: onLoginSuccess

import org.springframework.security.web.authentication.rememberme.PersistentRememberMeToken; //导入依赖的package包/类
protected void onLoginSuccess(HttpServletRequest request, HttpServletResponse response,
		Authentication successfulAuthentication) {

	LoginUser user = (LoginUser) successfulAuthentication.getPrincipal();

	logger.debug("Creating new persistent login for user " + user.getUsername());

	PersistentRememberMeToken persistentToken = new PersistentRememberMeToken(user.getUserId(),
			generateSeriesData(), generateTokenData(), new Date());
	try {
		tokenRepository.createNewToken(persistentToken);
		addCookie(persistentToken, request, response);
	} catch (Exception e) {
		logger.error("Failed to save persistent token ", e);
	}
}
 
开发者ID:KayuraTeam,项目名称:kayura-uasp,代码行数:17,代码来源:PersistentRememberMeServices.java

示例2: getTokenForSeries

import org.springframework.security.web.authentication.rememberme.PersistentRememberMeToken; //导入依赖的package包/类
@Override
public PersistentRememberMeToken getTokenForSeries(String seriesId) {
    try {
        return getJdbcTemplate().queryForObject(sqlSelect, new RowMapper<PersistentRememberMeToken>() {
            public PersistentRememberMeToken mapRow(ResultSet rs, int rowNum) throws SQLException {
                //String username, String series, String tokenValue, Date date
                return new PersistentRememberMeToken(rs.getString(3),
                        rs.getString(1),
                        rs.getString(2),
                        rs.getTimestamp(4));
            }
        }, seriesId);
    } catch (EmptyResultDataAccessException zeroResults) {
        if (logger.isInfoEnabled()) {
            logger.info("Querying token for series '" + seriesId + "' returned no results.", zeroResults);
        }
    } catch (IncorrectResultSizeDataAccessException moreThanOne) {
        logger.error("Querying token for series '" + seriesId + "' returned more than one value. Series" +
                " should be unique");
    } catch (DataAccessException e) {
        logger.error("Failed to load token for series " + seriesId, e);
    }

    return null;
}
 
开发者ID:OlegNyr,项目名称:GisGMP,代码行数:26,代码来源:MemberRepositoryImpl.java

示例3: createNewToken

import org.springframework.security.web.authentication.rememberme.PersistentRememberMeToken; //导入依赖的package包/类
@Override
public void createNewToken(PersistentRememberMeToken token) {
	logger.info("Creating Token for user : {}", token.getUsername());
	UserSessions userSession = new UserSessions();
	userSession.setUserEmail(token.getUsername());
	userSession.setSeries(token.getSeries());
	userSession.setSessionToken(token.getTokenValue());
	userSession.setLastLogin(token.getDate());
	persist(userSession);

}
 
开发者ID:mustafamym,项目名称:FeedbackCollectionAndMgmtSystem,代码行数:12,代码来源:HibernateTokenRepositoryImpl.java

示例4: getTokenForSeries

import org.springframework.security.web.authentication.rememberme.PersistentRememberMeToken; //导入依赖的package包/类
@Override
public PersistentRememberMeToken getTokenForSeries(String seriesId) {
	logger.info("Fetch Token if any for seriesId : {}", seriesId);
	try {
		Criteria crit = createEntityCriteria();
		crit.add(Restrictions.eq("series", seriesId));
		UserSessions userSession = (UserSessions) crit.uniqueResult();

		return new PersistentRememberMeToken(userSession.getUserEmail(), userSession.getSeries(),
				userSession.getSessionToken(), userSession.getLastLogin());
	} catch (Exception e) {
		logger.info("Token not found...");
		return null;
	}
}
 
开发者ID:mustafamym,项目名称:FeedbackCollectionAndMgmtSystem,代码行数:16,代码来源:HibernateTokenRepositoryImpl.java

示例5: getTokenForSeries

import org.springframework.security.web.authentication.rememberme.PersistentRememberMeToken; //导入依赖的package包/类
@Override
public PersistentRememberMeToken getTokenForSeries(String seriesId) {
  Long sessionId = Long.valueOf(seriesId);
  return sessionService
      .findSession(sessionId)
      .map(this::toPersistentRememberMeToken)
      .orElse(null);
}
 
开发者ID:springuni,项目名称:springuni-particles,代码行数:9,代码来源:DelegatingPersistentTokenRepository.java

示例6: toPersistentRememberMeToken

import org.springframework.security.web.authentication.rememberme.PersistentRememberMeToken; //导入依赖的package包/类
private PersistentRememberMeToken toPersistentRememberMeToken(Session session) {
  String username = String.valueOf(session.getUserId());
  String series = String.valueOf(session.getId());
  LocalDateTime lastUsedAt =
      Optional.ofNullable(session.getLastUsedAt()).orElseGet(session::getIssuedAt);
  return new PersistentRememberMeToken(
      username, series, session.getToken(), toDate(lastUsedAt));
}
 
开发者ID:springuni,项目名称:springuni-particles,代码行数:9,代码来源:DelegatingPersistentTokenRepository.java

示例7: createNewToken

import org.springframework.security.web.authentication.rememberme.PersistentRememberMeToken; //导入依赖的package包/类
@Override
public void createNewToken(PersistentRememberMeToken token) {
    logger.info("Creating Token for user : {}", token.getUsername());
    PersistentLogin persistentLogin = new PersistentLogin();
    persistentLogin.setUsername(token.getUsername());
    persistentLogin.setSeries(token.getSeries());
    persistentLogin.setToken(token.getTokenValue());
    persistentLogin.setLast_used(token.getDate());
    persist(persistentLogin);

}
 
开发者ID:TomirKlos,项目名称:Webstore,代码行数:12,代码来源:HibernateTokenRepositoryImpl.java

示例8: getTokenForSeries

import org.springframework.security.web.authentication.rememberme.PersistentRememberMeToken; //导入依赖的package包/类
@Override
public PersistentRememberMeToken getTokenForSeries(String seriesId) {
    logger.info("Fetch Token if any for seriesId : {}", seriesId);
    try {
        Criteria crit = createEntityCriteria();
        crit.add(Restrictions.eq("series", seriesId));
        PersistentLogin persistentLogin = (PersistentLogin) crit.uniqueResult();

        return new PersistentRememberMeToken(persistentLogin.getUsername(), persistentLogin.getSeries(),
                persistentLogin.getToken(), persistentLogin.getLast_used());
    } catch (Exception e) {
        logger.info("Token not found...");
        return null;
    }
}
 
开发者ID:TomirKlos,项目名称:Webstore,代码行数:16,代码来源:HibernateTokenRepositoryImpl.java

示例9: getTokenForSeries

import org.springframework.security.web.authentication.rememberme.PersistentRememberMeToken; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public PersistentRememberMeToken getTokenForSeries(String seriesId) {
	RememberMeToken token = this.rememberMeTokenRepository.findBySeries(seriesId);
	if (null == token) {
		return null;
	}
	return new PersistentRememberMeToken(token.getUsername(), token.getSeries(), token.getTokenValue(),
			token.getDate());
}
 
开发者ID:rajadilipkolli,项目名称:springsecuredthymeleafapp,代码行数:11,代码来源:MongoPersistentTokenRepositoryImpl.java

示例10: RememberMeToken

import org.springframework.security.web.authentication.rememberme.PersistentRememberMeToken; //导入依赖的package包/类
/**
 * <p>Constructor for RememberMeToken.</p>
 *
 * @param token a {@link org.springframework.security.web.authentication.rememberme.PersistentRememberMeToken} object.
 */
public RememberMeToken(PersistentRememberMeToken token) {
    this.series = token.getSeries();
    this.username = token.getUsername();
    this.tokenValue = token.getTokenValue();
    this.date = token.getDate();
}
 
开发者ID:rajadilipkolli,项目名称:springsecuredthymeleafapp,代码行数:12,代码来源:RememberMeToken.java

示例11: createNewToken

import org.springframework.security.web.authentication.rememberme.PersistentRememberMeToken; //导入依赖的package包/类
/**
 * The method provides the functionality to store a new token in the token repository
 * @param token The token that will be stored in the token repository
 */
@Override
public synchronized void createNewToken(PersistentRememberMeToken token) {
    PersistentRememberMeToken current = this.seriesTokens.get(token.getSeries());
    if(current != null) {
        throw new DataIntegrityViolationException("Series Id \'" + token.getSeries() + "\' already exists!");
    } else {
        this.seriesTokens.put(token.getSeries(), token);
        saveTokens();
    }
}
 
开发者ID:castlemock,项目名称:castlemock,代码行数:15,代码来源:SessionTokenRepository.java

示例12: updateToken

import org.springframework.security.web.authentication.rememberme.PersistentRememberMeToken; //导入依赖的package包/类
/**
 * Updates a specific token with a new values to a specific token
 * @param series The token that will be updated
 * @param tokenValue The new token value
 * @param lastUsed Date for when it was last used
 */
@Override
public synchronized void updateToken(String series, String tokenValue, Date lastUsed) {
    PersistentRememberMeToken token = this.getTokenForSeries(series);
    PersistentRememberMeToken newToken = new PersistentRememberMeToken(token.getUsername(), series, tokenValue, new Date());
    this.seriesTokens.put(series, newToken);
    saveTokens();
}
 
开发者ID:castlemock,项目名称:castlemock,代码行数:14,代码来源:SessionTokenRepository.java

示例13: removeUserTokens

import org.springframework.security.web.authentication.rememberme.PersistentRememberMeToken; //导入依赖的package包/类
/**
 * Remove a user token from the repository
 * @param username The token that matches this user name will be removed
 */
@Override
public synchronized void removeUserTokens(String username) {
    Iterator series = this.seriesTokens.keySet().iterator();

    while(series.hasNext()) {
        String seriesId = (String)series.next();
        PersistentRememberMeToken token = this.seriesTokens.get(seriesId);
        if(username.equals(token.getUsername())) {
            series.remove();
        }
    }
    saveTokens();
}
 
开发者ID:castlemock,项目名称:castlemock,代码行数:18,代码来源:SessionTokenRepository.java

示例14: getTokens

import org.springframework.security.web.authentication.rememberme.PersistentRememberMeToken; //导入依赖的package包/类
/**
 * Get all tokens in a token list
 * @return A list of tokens
 */
private SessionTokenList getTokens(){
    final SessionTokenList tokens = new SessionTokenList();
    for(PersistentRememberMeToken persistentRememberMeToken : seriesTokens.values()){
        final SessionToken token = new SessionToken(persistentRememberMeToken);
        tokens.add(token);
    }
    return tokens;
}
 
开发者ID:castlemock,项目名称:castlemock,代码行数:13,代码来源:SessionTokenRepository.java

示例15: createNewToken

import org.springframework.security.web.authentication.rememberme.PersistentRememberMeToken; //导入依赖的package包/类
@Override
public void createNewToken(PersistentRememberMeToken token) {
    PersistentLoginEntity userPersistentToken = new PersistentLoginEntity();
    userPersistentToken.setSeries(token.getSeries());
    userPersistentToken.setUsername(token.getUsername());
    userPersistentToken.setToken(token.getTokenValue());
    userPersistentToken.setLastUsed(token.getDate());
    persistentLoginRepository.save(userPersistentToken);
}
 
开发者ID:saltykovdg,项目名称:java-spring-jspx-hibernate-template,代码行数:10,代码来源:PersistentLoginService.java


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