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
/// Gets or sets the default authorization policy. Defaults to require authenticated users.
27
+
/// Gets or sets the default authorization policy. Defaults to requiring authenticated users.
28
28
/// </summary>
29
29
/// <remarks>
30
-
/// The default policy used when evaluating <see cref="IAuthorizeData"/> with no policy name specified.
30
+
/// - The `DefaultPolicy` applies whenever authorization is required, but no specific policy is set.
31
+
/// - If an `[Authorize]` attribute is present without a policy name, the `DefaultPolicy` is used instead of the `FallbackPolicy`.
32
+
/// - This behavior ensures that endpoints explicitly requesting authorization (via `[Authorize]` or `RequireAuthorization()`) default to a secure policy.
33
+
/// - When non-default behavior is needed, developers should define named policies.
/// Gets or sets the fallback authorization policy used by <see cref="AuthorizationPolicy.CombineAsync(IAuthorizationPolicyProvider, IEnumerable{IAuthorizeData})"/>
36
-
/// when no IAuthorizeData have been provided. As a result, the AuthorizationMiddleware uses the fallback policy
37
-
/// if there are no <see cref="IAuthorizeData"/> instances for a resource. If a resource has any <see cref="IAuthorizeData"/>
38
-
/// then they are evaluated instead of the fallback policy. By default the fallback policy is null, and usually will have no
39
-
/// effect unless you have the AuthorizationMiddleware in your pipeline. It is not used in any way by the
40
-
/// default <see cref="IAuthorizationService"/>.
39
+
/// when no authorization metadata (e.g., `[Authorize]` attribute, `RequireAuthorization()`) is explicitly provided for a resource.
41
40
/// </summary>
41
+
/// <remarks>
42
+
/// - The `FallbackPolicy` only applies when there are no authorization attributes or explicit policies set.
43
+
/// - If a resource has an `[Authorize]` attribute (even without a policy name), the `DefaultPolicy` is used instead of the `FallbackPolicy`.
44
+
/// - This means `FallbackPolicy` is mainly relevant for middleware-based authorization flows where no per-endpoint authorization is specified.
45
+
/// - By default, `FallbackPolicy` is `null`, meaning it has no effect unless explicitly set.
0 commit comments