You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
RecordTokenValidationError(tokenValidationResult.Exception??newSecurityTokenValidationException($"The TokenHandler: '{tokenHandler}', was unable to validate the Token."),validationFailures);
118
+
}
124
119
}
125
120
catch(Exceptionex)
126
121
{
127
-
Logger.TokenValidationFailed(ex);
128
-
129
-
// Refresh the configuration for exceptions that may be caused by key rollovers. The user can also request a refresh in the event.
/// Gets the ordered list of <see cref="ISecurityTokenValidator"/> used to validate access tokens.
105
115
/// </summary>
116
+
[Obsolete("SecurityTokenValidators is no longer used by default. Use TokenHandlers instead. To continue using SecurityTokenValidators, set UseSecurityTokenValidators to true. See https://aka.ms/aspnetcore8/security-token-changes")]
/// Gets or sets the parameters used to validate identity tokens.
110
126
/// </summary>
@@ -126,15 +142,20 @@ public JwtBearerOptions()
126
142
publicboolIncludeErrorDetails{get;set;}=true;
127
143
128
144
/// <summary>
129
-
/// Gets or sets the <see cref="MapInboundClaims"/> property on the default instance of <see cref="JwtSecurityTokenHandler"/> in SecurityTokenValidators, which is used when determining
130
-
/// whether or not to map claim types that are extracted when validating a <see cref="JwtSecurityToken"/>.
145
+
/// Gets or sets the <see cref="MapInboundClaims"/> property on the default instance of <see cref="JwtSecurityTokenHandler"/> in SecurityTokenValidators, or <see cref="JsonWebTokenHandler"/> in TokenHandlers, which is used when determining
146
+
/// whether or not to map claim types that are extracted when validating a <see cref="JwtSecurityToken"/> or a <see cref="JsonWebToken"/>.
131
147
/// <para>If this is set to true, the Claim Type is set to the JSON claim 'name' after translating using this mapping. Otherwise, no mapping occurs.</para>
132
148
/// <para>The default value is true.</para>
133
149
/// </summary>
134
150
publicboolMapInboundClaims
135
151
{
136
-
get=>_defaultHandler.MapInboundClaims;
137
-
set=>_defaultHandler.MapInboundClaims=value;
152
+
get=>_mapInboundClaims;
153
+
set
154
+
{
155
+
_mapInboundClaims=value;
156
+
_defaultHandler.MapInboundClaims=value;
157
+
_defaultTokenHandler.MapInboundClaims=value;
158
+
}
138
159
}
139
160
140
161
/// <summary>
@@ -152,4 +173,17 @@ public bool MapInboundClaims
152
173
/// Defaults to <see cref="ConfigurationManager{OpenIdConnectConfiguration}.DefaultRefreshInterval" />.
/// Gets or sets whether <see cref="TokenHandlers"/> or <see cref="SecurityTokenValidators"/> will be used to validate the inbound token.
179
+
/// </summary>
180
+
/// <remarks>
181
+
/// The advantages of using TokenHandlers are:
182
+
/// <para>There is an Async model.</para>
183
+
/// <para>The default token handler is a <see cref="JsonWebTokenHandler"/> which is faster than a <see cref="JwtSecurityTokenHandler"/>.</para>
184
+
/// <para>There is an ability to make use of a Last-Known-Good model for metadata that protects applications when metadata is published with errors.</para>
185
+
/// SecurityTokenValidators can be used when <see cref="TokenValidatedContext.SecurityToken"/> needs a <see cref="JwtSecurityToken"/>.
186
+
/// When using TokenHandlers, <see cref="TokenValidatedContext.SecurityToken"/> will be a <see cref="JsonWebToken"/>.
0 commit comments