@@ -31,12 +31,17 @@ protected AuthenticateResult() { }
31
31
/// <summary>
32
32
/// Additional state values for the authentication session.
33
33
/// </summary>
34
- public AuthenticationProperties Properties => Ticket ? . Properties ;
34
+ public AuthenticationProperties Properties => Ticket ? . Properties ?? Error ? . Properties ;
35
35
36
36
/// <summary>
37
37
/// Holds failure information from the authentication.
38
38
/// </summary>
39
- public Exception Failure { get ; protected set ; }
39
+ public Exception Failure => Error ? . Failure ;
40
+
41
+ /// <summary>
42
+ /// Holds error information from the authentication.
43
+ /// </summary>
44
+ public AuthenticationError Error { get ; protected set ; }
40
45
41
46
/// <summary>
42
47
/// Indicates that there was no information returned for this authentication scheme.
@@ -73,17 +78,35 @@ public static AuthenticateResult NoResult()
73
78
/// <returns>The result.</returns>
74
79
public static AuthenticateResult Fail ( Exception failure )
75
80
{
76
- return new AuthenticateResult ( ) { Failure = failure } ;
81
+ return new AuthenticateResult ( ) { Error = new AuthenticationError ( failure ) } ;
77
82
}
78
83
79
84
/// <summary>
80
85
/// Indicates that there was a failure during authentication.
81
86
/// </summary>
82
- /// <param name="failureMessage">The failure message.</param>
87
+ /// <param name="failure">The failure exception.</param>
88
+ /// <param name="properties">Additional state values for the authentication session.</param>
83
89
/// <returns>The result.</returns>
84
- public static AuthenticateResult Fail ( string failureMessage )
90
+ public static AuthenticateResult Fail ( Exception failure , AuthenticationProperties properties )
85
91
{
86
- return new AuthenticateResult ( ) { Failure = new Exception ( failureMessage ) } ;
92
+ return new AuthenticateResult ( ) { Error = new AuthenticationError ( failure , properties ) } ;
87
93
}
94
+
95
+ /// <summary>
96
+ /// Indicates that there was a failure during authentication.
97
+ /// </summary>
98
+ /// <param name="failureMessage">The failure message.</param>
99
+ /// <returns>The result.</returns>
100
+ public static AuthenticateResult Fail ( string failureMessage )
101
+ => Fail ( new Exception ( failureMessage ) ) ;
102
+
103
+ /// <summary>
104
+ /// Indicates that there was a failure during authentication.
105
+ /// </summary>
106
+ /// <param name="failureMessage">The failure message.</param>
107
+ /// <param name="properties">Additional state values for the authentication session.</param>
108
+ /// <returns>The result.</returns>
109
+ public static AuthenticateResult Fail ( string failureMessage , AuthenticationProperties properties )
110
+ => Fail ( new Exception ( failureMessage ) , properties ) ;
88
111
}
89
112
}
0 commit comments