This repository was archived by the owner on Nov 20, 2018. It is now read-only.
File tree 2 files changed +23
-0
lines changed
Microsoft.AspNetCore.Http/Authentication
Microsoft.AspNetCore.Http.Abstractions/Authentication
2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,9 @@ public abstract class AuthenticationManager
22
22
23
23
public abstract Task < AuthenticateInfo > GetAuthenticateInfoAsync ( string authenticationScheme ) ;
24
24
25
+ // Will remove once callees have been updated
26
+ public abstract Task AuthenticateAsync ( AuthenticateContext context ) ;
27
+
25
28
public virtual async Task < ClaimsPrincipal > AuthenticateAsync ( string authenticationScheme )
26
29
{
27
30
return ( await GetAuthenticateInfoAsync ( authenticationScheme ) ) ? . Principal ;
Original file line number Diff line number Diff line change @@ -50,6 +50,26 @@ public override IEnumerable<AuthenticationDescription> GetAuthenticationSchemes(
50
50
return describeContext . Results . Select ( description => new AuthenticationDescription ( description ) ) ;
51
51
}
52
52
53
+ // Remove once callers have been switched to GetAuthenticateInfoAsync
54
+ public override async Task AuthenticateAsync ( AuthenticateContext context )
55
+ {
56
+ if ( context == null )
57
+ {
58
+ throw new ArgumentNullException ( nameof ( context ) ) ;
59
+ }
60
+
61
+ var handler = HttpAuthenticationFeature . Handler ;
62
+ if ( handler != null )
63
+ {
64
+ await handler . AuthenticateAsync ( context ) ;
65
+ }
66
+
67
+ if ( ! context . Accepted )
68
+ {
69
+ throw new InvalidOperationException ( $ "No authentication handler is configured to authenticate for the scheme: { context . AuthenticationScheme } ") ;
70
+ }
71
+ }
72
+
53
73
public override async Task < AuthenticateInfo > GetAuthenticateInfoAsync ( string authenticationScheme )
54
74
{
55
75
if ( authenticationScheme == null )
You can’t perform that action at this time.
0 commit comments