Skip to content

Commit

Permalink
Add support AuthorizationResult for AuthorizationManager
Browse files Browse the repository at this point in the history
Added a new authorization method to AuthorizationManager that returns AuthorizationResult.

Closes spring-projectsgh-14843
  • Loading branch information
Max Batischev authored and Max Batischev committed Apr 4, 2024
1 parent 9b79f68 commit 7319cf2
Showing 1 changed file with 16 additions and 1 deletion.
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -50,8 +50,23 @@ default void verify(Supplier<Authentication> authentication, T object) {
* @param authentication the {@link Supplier} of the {@link Authentication} to check
* @param object the {@link T} object to check
* @return an {@link AuthorizationDecision} or null if no decision could be made
* @deprecated Use {{@link #authorize(Supplier, Object)}} instead
*/
@Deprecated
@Nullable
AuthorizationDecision check(Supplier<Authentication> authentication, T object);

/**
* Determines if access should be granted for a specific authentication and object.
* @param authentication the {@link Supplier} of the {@link Authentication} to
* authorize
* @param object the {@link T} object to authorize
* @return an {@link AuthorizationResult} or null if no result could be made
* @since 6.3
*/
@Nullable
default AuthorizationResult authorize(Supplier<Authentication> authentication, T object) {
return check(authentication, object);
}

}

0 comments on commit 7319cf2

Please sign in to comment.