We should add an AuthorizationManager which is an imperative version of ReactiveAuthorizationManager. The class should look something like:
public interface AuthorizationManager<T> {
AuthorizationDecision check(Supplier<Authentication> authentication, T object);
default void verify(Supplier<Authentication> authentication, T object) {
AuthorizationDecision decision = check(authentication, object);
if (!decision.isGranted()) {
throw new AccessDeniedException("Access Denied");
}
}
}
Using something that allows delaying looking up the Authentication like Supplier<Authentication> vs an Authentication directly.
We should also add support for AuthorizationManager in HttpSecurity.authorizeRequests().
Finally, we should change around the existing classes that use AccessDecisionManager should migrate to AuthorizationManager and AccessDecisionManager should be marked as deprecated.
We should add an
AuthorizationManagerwhich is an imperative version ofReactiveAuthorizationManager. The class should look something like:Using something that allows delaying looking up the
AuthenticationlikeSupplier<Authentication>vs anAuthenticationdirectly.We should also add support for
AuthorizationManagerinHttpSecurity.authorizeRequests().Finally, we should change around the existing classes that use
AccessDecisionManagershould migrate toAuthorizationManagerandAccessDecisionManagershould be marked as deprecated.