feat: return the provider
This commit is contained in:
parent
c4a4478b8c
commit
5b7412f20f
@ -326,7 +326,7 @@ public class OAuthService(ILogger<OAuthService> logger, Dictionary<OAuthProvider
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<(OAuthUser? User, string? Message, bool IsSuccess)>
|
public async Task<(OAuthUser? User, string? Message, bool IsSuccess, OAuthProvider? Provider)>
|
||||||
GetOAuthUser(CookieOptions cookieOptions, HttpContext context, string token, CancellationToken cancellation = default)
|
GetOAuthUser(CookieOptions cookieOptions, HttpContext context, string token, CancellationToken cancellation = default)
|
||||||
{
|
{
|
||||||
var requestInfo = new RequestContextInfo(context, cookieOptions);
|
var requestInfo = new RequestContextInfo(context, cookieOptions);
|
||||||
@ -350,7 +350,7 @@ public class OAuthService(ILogger<OAuthService> logger, Dictionary<OAuthProvider
|
|||||||
requestInfo.Fingerprint,
|
requestInfo.Fingerprint,
|
||||||
failedTokenAttemptsCount);
|
failedTokenAttemptsCount);
|
||||||
|
|
||||||
return (null, "Too many unsuccessful token attempts. Please try again later.", false);
|
return (null, "Too many unsuccessful token attempts. Please try again later.", false, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.LogInformation(
|
logger.LogInformation(
|
||||||
@ -364,7 +364,7 @@ public class OAuthService(ILogger<OAuthService> logger, Dictionary<OAuthProvider
|
|||||||
slidingExpiration: failedTokenCacheExpiration,
|
slidingExpiration: failedTokenCacheExpiration,
|
||||||
cancellationToken: cancellation);
|
cancellationToken: cancellation);
|
||||||
|
|
||||||
return (null, "Invalid or expired token.", false);
|
return (null, "Invalid or expired token.", false, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
await cache.RemoveAsync(tokenFailedKey, cancellation);
|
await cache.RemoveAsync(tokenFailedKey, cancellation);
|
||||||
@ -385,6 +385,6 @@ public class OAuthService(ILogger<OAuthService> logger, Dictionary<OAuthProvider
|
|||||||
else
|
else
|
||||||
logger.LogInformation(log, token, requestInfo.Fingerprint);
|
logger.LogInformation(log, token, requestInfo.Fingerprint);
|
||||||
|
|
||||||
return (result.User, result.Message, result.IsSuccess);
|
return (result.User, result.Message, result.IsSuccess, result.Provider);
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user