Search in sources :

Example 1 with Token

use of com.moon.admin.vo.Token in project moon by gentoo111.

the class EhCacheTokenManager method saveToken.

@Override
public Token saveToken(UsernamePasswordToken usernamePasswordToken) {
    Cache cache = cacheManager.getCacheManager().getCache("login_user_tokens");
    String key = UUID.randomUUID().toString();
    Element element = new Element(key, usernamePasswordToken);
    element.setTimeToLive(expireSeconds);
    cache.put(element);
    return new Token(key, DateUtils.addSeconds(new Date(), expireSeconds));
}
Also used : Element(net.sf.ehcache.Element) Token(com.moon.admin.vo.Token) UsernamePasswordToken(org.apache.shiro.authc.UsernamePasswordToken) Date(java.util.Date) Cache(net.sf.ehcache.Cache)

Aggregations

Token (com.moon.admin.vo.Token)1 Date (java.util.Date)1 Cache (net.sf.ehcache.Cache)1 Element (net.sf.ehcache.Element)1 UsernamePasswordToken (org.apache.shiro.authc.UsernamePasswordToken)1