Skip to content

Commit dade94c

Browse files
committed
Update CertificateAuthenticationHandler.cs
1 parent e52f2fc commit dade94c

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

src/Security/Authentication/Certificate/src/CertificateAuthenticationHandler.cs

+2-10
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
using System.Security.Cryptography.X509Certificates;
99
using System.Text.Encodings.Web;
1010
using System.Threading.Tasks;
11-
1211
using Microsoft.AspNetCore.Authentication;
1312
using Microsoft.Extensions.Logging;
1413
using Microsoft.Extensions.Options;
@@ -145,14 +144,7 @@ protected override Task HandleChallengeAsync(AuthenticationProperties properties
145144
{
146145
// Certificate authentication takes place at the connection level. We can't prompt once we're in
147146
// user code, so the best thing to do is Forbid, not Challenge.
148-
Response.StatusCode = 403;
149-
return Task.CompletedTask;
150-
}
151-
152-
protected override Task HandleForbiddenAsync(AuthenticationProperties properties)
153-
{
154-
Response.StatusCode = 403;
155-
return Task.CompletedTask;
147+
return HandleForbiddenAsync(properties)
156148
}
157149

158150
private X509ChainPolicy BuildChainPolicy(X509Certificate2 certificate)
@@ -168,7 +160,7 @@ private X509ChainPolicy BuildChainPolicy(X509Certificate2 certificate)
168160
revocationMode = X509RevocationMode.NoCheck;
169161
}
170162

171-
X509ChainPolicy chainPolicy = new X509ChainPolicy
163+
var chainPolicy = new X509ChainPolicy
172164
{
173165
RevocationFlag = revocationFlag,
174166
RevocationMode = revocationMode,

0 commit comments

Comments
 (0)