Optimizing async tasks (ConfigureAwait(false))
This commit is contained in:
@@ -58,7 +58,7 @@ namespace AMWD.Common.AspNetCore.Security.BasicAuthentication
|
||||
string password = plain[(username.Length + 1)..];
|
||||
|
||||
var ipAddress = Context.GetRemoteIpAddress();
|
||||
principal = await validator.ValidateAsync(username, password, ipAddress, Context.RequestAborted);
|
||||
principal = await validator.ValidateAsync(username, password, ipAddress, Context.RequestAborted).ConfigureAwait(false);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
@@ -51,14 +51,14 @@ namespace AMWD.Common.AspNetCore.Security.BasicAuthentication
|
||||
string username = plain.Split(':').First();
|
||||
string password = plain[(username.Length + 1)..];
|
||||
|
||||
var principal = await validator.ValidateAsync(username, password, httpContext.GetRemoteIpAddress(), httpContext.RequestAborted);
|
||||
var principal = await validator.ValidateAsync(username, password, httpContext.GetRemoteIpAddress(), httpContext.RequestAborted).ConfigureAwait(false);
|
||||
if (principal == null)
|
||||
{
|
||||
SetAuthenticateRequest(httpContext, validator.Realm);
|
||||
return;
|
||||
}
|
||||
|
||||
await next.Invoke(httpContext);
|
||||
await next.Invoke(httpContext).ConfigureAwait(false);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user