This repository was archived by the owner on Nov 20, 2018. It is now read-only.
File tree 2 files changed +13
-3
lines changed
Microsoft.AspNet.Http/Authentication
Microsoft.AspNet.Http.Core/Authentication
2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -20,17 +20,17 @@ public class AuthenticationDescription
20
20
/// Initializes a new instance of the <see cref="AuthenticationDescription"/> class
21
21
/// </summary>
22
22
public AuthenticationDescription ( )
23
+ : this ( items : null )
23
24
{
24
- Items = new Dictionary < string , object > ( StringComparer . Ordinal ) ;
25
25
}
26
26
27
27
/// <summary>
28
28
/// Initializes a new instance of the <see cref="AuthenticationDescription"/> class
29
29
/// </summary>
30
30
/// <param name="items"></param>
31
- public AuthenticationDescription ( [ NotNull ] IDictionary < string , object > items )
31
+ public AuthenticationDescription ( IDictionary < string , object > items )
32
32
{
33
- Items = items ;
33
+ Items = items ?? new Dictionary < string , object > ( StringComparer . Ordinal ) ; ;
34
34
}
35
35
36
36
/// <summary>
Original file line number Diff line number Diff line change @@ -61,6 +61,11 @@ public override AuthenticationResult Authenticate([NotNull] string authenticatio
61
61
throw new InvalidOperationException ( $ "The following authentication scheme was not accepted: { authenticationScheme } ") ;
62
62
}
63
63
64
+ if ( authenticateContext . Principal == null )
65
+ {
66
+ return null ;
67
+ }
68
+
64
69
return new AuthenticationResult ( authenticateContext . Principal ,
65
70
new AuthenticationProperties ( authenticateContext . Properties ) ,
66
71
new AuthenticationDescription ( authenticateContext . Description ) ) ;
@@ -82,6 +87,11 @@ public override async Task<AuthenticationResult> AuthenticateAsync([NotNull] str
82
87
throw new InvalidOperationException ( $ "The following authentication scheme was not accepted: { authenticationScheme } ") ;
83
88
}
84
89
90
+ if ( authenticateContext . Principal == null )
91
+ {
92
+ return null ;
93
+ }
94
+
85
95
return new AuthenticationResult ( authenticateContext . Principal ,
86
96
new AuthenticationProperties ( authenticateContext . Properties ) ,
87
97
new AuthenticationDescription ( authenticateContext . Description ) ) ;
You can’t perform that action at this time.
0 commit comments