Skip to content

Commit c081374

Browse files
Add nullable attribute to AuthorizationResult.Succeeded (#46092)
1 parent a403939 commit c081374

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

Diff for: src/Security/Authorization/Core/src/AuthorizationResult.cs

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33

44
using System.Collections.Generic;
5+
using System.Diagnostics.CodeAnalysis;
56
using System.Security.Claims;
67

78
namespace Microsoft.AspNetCore.Authorization;
@@ -19,6 +20,7 @@ private AuthorizationResult() { }
1920
/// <summary>
2021
/// True if authorization was successful.
2122
/// </summary>
23+
[MemberNotNullWhen(false, nameof(Failure))]
2224
public bool Succeeded { get; private set; }
2325

2426
/// <summary>

Diff for: src/Security/Authorization/Core/src/DefaultAuthorizationService.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public virtual async Task<AuthorizationResult> AuthorizeAsync(ClaimsPrincipal us
8181
}
8282
else
8383
{
84-
_logger.UserAuthorizationFailed(result.Failure!);
84+
_logger.UserAuthorizationFailed(result.Failure);
8585
}
8686
return result;
8787
}

0 commit comments

Comments
 (0)