private async Task <IUserAuth> GetUserAuthByUserNameAsync(IRedisClientFacadeAsync redis, string userNameOrEmail, CancellationToken token = default) { if (userNameOrEmail == null) { return(null); } var isEmail = userNameOrEmail.Contains("@"); var userId = isEmail ? await redis.GetValueFromHashAsync(IndexEmailToUserId, userNameOrEmail, token).ConfigAwait() : await redis.GetValueFromHashAsync(IndexUserNameToUserId, userNameOrEmail, token).ConfigAwait(); return(userId == null ? null : await redis.AsAsync <IUserAuth>().GetByIdAsync(userId, token).ConfigAwait()); }
private async Task <string> GetAuthProviderByUserIdAsync(IRedisClientFacadeAsync redis, string provider, string userId, CancellationToken token = default) { var idx = IndexProviderToUserIdHash(provider); var oAuthProviderId = await redis.GetValueFromHashAsync(idx, userId, token).ConfigAwait(); return(oAuthProviderId); }