Skip to content

Commit ce03aa9

Browse files
Use Task.CompletedTask
1 parent 9d47694 commit ce03aa9

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/MakingSense.AspNetCore.Authentication.SimpleToken/SimpleTokenAuthenticationHandler.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,6 @@ public static string ExtractToken(HttpRequest request)
7676
return null;
7777
}
7878

79-
static readonly Task DoneTask = Task.FromResult(0);
80-
8179
/// <summary>
8280
/// Searches the 'Authorization' header for a 'Bearer' token. If the 'Bearer' token is found, it is validated using <see cref="TokenValidationParameters"/> set in the options.
8381
/// </summary>
@@ -112,8 +110,8 @@ protected override async Task<AuthenticateResult> HandleAuthenticateAsync()
112110
}
113111
}
114112

115-
// Ugly patch to make this method should to be async in order to allow result caching by caller
116-
await DoneTask;
113+
// Ugly patch to make this method should to be async in order to allow result caching by caller
114+
await Task.CompletedTask;
117115

118116
return AuthenticateResult.Fail("Authorization token has been detected but it cannot be read.");
119117
}

0 commit comments

Comments
 (0)