use of org.maxkey.persistence.redis.RedisConnection in project MaxKey by dromara.
the class RedisAuthorizationCodeServices method store.
@Override
protected void store(String code, OAuth2Authentication authentication) {
RedisConnection conn = connectionFactory.getConnection();
conn.setexObject(PREFIX + code, codeValiditySeconds, authentication);
conn.close();
}
use of org.maxkey.persistence.redis.RedisConnection in project MaxKey by dromara.
the class RedisAuthorizationCodeServices method remove.
@Override
public OAuth2Authentication remove(String code) {
RedisConnection conn = connectionFactory.getConnection();
OAuth2Authentication auth = conn.getObject(PREFIX + code);
conn.delete(PREFIX + code);
return auth;
}
use of org.maxkey.persistence.redis.RedisConnection in project MaxKey by dromara.
the class RedisOtpTokenStore method validate.
@Override
public boolean validate(UserInfo userInfo, String token, String type, int interval) {
RedisConnection conn = connectionFactory.getConnection();
OneTimePassword otp = (OneTimePassword) conn.getObject(PREFIX + userInfo.getUsername() + "_" + type + "_" + token);
conn.delete(PREFIX + userInfo.getUsername() + "_" + type + "_" + token);
conn.close();
if (otp != null) {
return true;
}
return false;
}
use of org.maxkey.persistence.redis.RedisConnection in project MaxKey by dromara.
the class RedisOtpTokenStore method store.
@Override
public void store(UserInfo userInfo, String token, String receiver, String type) {
DateTime currentDateTime = new DateTime();
OneTimePassword otp = new OneTimePassword();
otp.setId(userInfo.getUsername() + "_" + type + "_" + token);
otp.setType(type);
otp.setUsername(userInfo.getUsername());
otp.setToken(token);
otp.setReceiver(receiver);
otp.setCreateTime(currentDateTime.toString("yyyy-MM-dd HH:mm:ss"));
RedisConnection conn = connectionFactory.getConnection();
conn.setexObject(PREFIX + otp.getId(), validitySeconds, otp);
conn.close();
}
use of org.maxkey.persistence.redis.RedisConnection in project MaxKey by dromara.
the class RedisRemeberMeService method save.
@Override
public void save(RemeberMe remeberMe) {
RedisConnection conn = connectionFactory.getConnection();
conn.setexObject(PREFIX + remeberMe.getUsername(), serviceTicketValiditySeconds, remeberMe);
conn.close();
}
Aggregations