@@ -81,7 +81,7 @@ public abstract class SecurityExpressionRoot<T> implements SecurityExpressionOpe
8181 */
8282 @ Deprecated (since = "7.0" )
8383 public SecurityExpressionRoot (Authentication authentication ) {
84- this (() -> authentication );
84+ this (() -> authentication , null );
8585 }
8686
8787 /**
@@ -94,12 +94,7 @@ public SecurityExpressionRoot(Authentication authentication) {
9494 */
9595 @ Deprecated (since = "7.0" )
9696 public SecurityExpressionRoot (Supplier <Authentication > authentication ) {
97- this .authentication = SingletonSupplier .of (() -> {
98- Authentication value = authentication .get ();
99- Assert .notNull (value , "Authentication object cannot be null" );
100- return value ;
101- });
102- this .object = null ;
97+ this (authentication , null );
10398 }
10499
105100 /**
@@ -110,7 +105,7 @@ public SecurityExpressionRoot(Supplier<Authentication> authentication) {
110105 * @param object the object being authorized
111106 * @since 7.0
112107 */
113- public SecurityExpressionRoot (Supplier <Authentication > authentication , T object ) {
108+ public SecurityExpressionRoot (Supplier <Authentication > authentication , @ Nullable T object ) {
114109 this .authentication = SingletonSupplier .of (() -> {
115110 Authentication value = authentication .get ();
116111 Assert .notNull (value , "Authentication object cannot be null" );
@@ -174,7 +169,7 @@ public final boolean isFullyAuthenticated() {
174169 return isGranted (this .authorizationManagerFactory .fullyAuthenticated ());
175170 }
176171
177- @ SuppressWarnings ("DataFlowIssue" )
172+ @ SuppressWarnings ({ "DataFlowIssue" , "NullAway" } )
178173 private boolean isGranted (AuthorizationManager <T > authorizationManager ) {
179174 AuthorizationResult authorizationResult = authorizationManager .authorize (this .authentication , this .object );
180175 return (authorizationResult != null && authorizationResult .isGranted ());
0 commit comments