public static VerificationCode get_object(string token) { if (string.IsNullOrEmpty(token)) { return(null); } return(RedisAPI.Enabled ? RedisAPI.get_value <VerificationCode>(token) : (Tokens.ContainsKey(token) ? Tokens[token] : null)); }
public static Guid?get_user_id(string ticket) { if (string.IsNullOrEmpty(ticket)) { return(null); } return(RedisAPI.Enabled ? RedisAPI.get_value <Guid?>(ticket) : (!_Tickets.ContainsKey(ticket) ? (Guid?)null : _Tickets[ticket])); }
public static AccessTokenList get_token_list(string ticket) { if (string.IsNullOrEmpty(ticket)) { return(null); } if (RedisAPI.Enabled) { AccessTokenList lst = RedisAPI.get_value <AccessTokenList>(get_redis_token_key(ticket)); return(lst == null ? new AccessTokenList() : lst); } else { if (!APITokens.ContainsKey(ticket)) { APITokens.Add(ticket, new AccessTokenList()); } return(APITokens[ticket]); } }
public static string get_ticket(Guid userId) { return(RedisAPI.Enabled ? RedisAPI.get_value(get_redis_key(userId)) : _Tickets.Keys.Where(u => _Tickets[u] == userId).FirstOrDefault()); }