Skip to content

Commit 8e721e4

Browse files
committed
remove an endless loop
1 parent 6ed0d09 commit 8e721e4

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

src/KK.AspNetCore.EasyAuthAuthentication/Services/LocalAuthMeService.cs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,12 @@ public LocalAuthMeService(
5151
/// <param name="options">The <c>EasyAuthAuthenticationOptions</c> to use.</param>
5252
/// <returns>An <see cref="AuthenticateResult" />.</returns>
5353
public async Task<AuthenticateResult> AuthUser(HttpContext context, LocalProviderOption? options)
54-
{
54+
{
5555
this.defaultOptions.ChangeModel(options);
56+
if (context.Request.Path.ToString() == this.defaultOptions.AuthEndpoint || context.Request.Path.ToString() == $"/{this.defaultOptions.AuthEndpoint}")
57+
{
58+
return AuthenticateResult.Fail($"The path {this.defaultOptions.AuthEndpoint} doesn't exsists or don't contain a valid auth json.");
59+
}
5660
try
5761
{
5862
var ticket = await this.CreateUserTicket();
@@ -98,7 +102,16 @@ private async Task<JArray> GetAuthMe(HttpClientHandler handler, HttpRequestMessa
98102
JArray? payload = null;
99103
using (var client = new HttpClient(handler))
100104
{
101-
var response = await client.SendAsync(httpRequest);
105+
HttpResponseMessage? response;
106+
try
107+
{
108+
response = await client.SendAsync(httpRequest);
109+
}
110+
catch (Exception ex)
111+
{
112+
throw ex;
113+
}
114+
102115

103116
if (!response.IsSuccessStatusCode)
104117
{

0 commit comments

Comments
 (0)