You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
948 B
33 lines
948 B
package com.dsideal.sso.Util;
|
|
|
|
import com.jfinal.kit.PropKit;
|
|
import com.jfinal.plugin.redis.Redis;
|
|
|
|
import java.util.Map;
|
|
|
|
public class SsoLoginStore {
|
|
public static Map<String, Object> get(String sessionId) {
|
|
String redisKey = redisKey(sessionId);
|
|
Map x = Redis.use().hgetAll(redisKey);
|
|
if (x != null) {
|
|
x.put("session_id", sessionId);
|
|
return x;
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public static void put(String sessionId, Map<String, String> loginMap) {
|
|
String redisKey = redisKey(sessionId);
|
|
Redis.use().call(redis -> (redis.hmset(redisKey, loginMap)));
|
|
}
|
|
|
|
public static void remove(String sessionId) {
|
|
String redisKey = redisKey(sessionId);
|
|
Redis.use().del(redisKey);
|
|
}
|
|
|
|
private static String redisKey(String sessionId) {
|
|
return PropKit.get("sso.sessionid").concat("#").concat(sessionId);
|
|
}
|
|
}
|