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
Copy file name to clipboardExpand all lines: docs/modules/ROOT/pages/migration.adoc
+32
Original file line number
Diff line number
Diff line change
@@ -459,6 +459,38 @@ The difference is that `AuthorizationManager<MethodInvocation>` replaces `Access
459
459
460
460
Given that, <<_i_use_a_custom_accessdecisionvoter,the same rules apply for adaptation>>, where the goal this time is to implement `AuthorizationManager<MethodInvocationResult>` instead of `AuthorizationManager<MethodInvocation>` and use `AuthorizationManagerAfterMethodInterceptor` instead of `AuthorizationManagerBeforeMethodInterceptor`.
461
461
462
+
===== I use `RunAsManager`
463
+
464
+
There is currently https://github.com/spring-projects/spring-security/issues/11331[no replacement for `RunAsManager`] though one is being considered.
465
+
466
+
It is quite straightforward to adapt a `RunAsManager`, though, to the `AuthorizationManager` API, if needed.
467
+
468
+
Here is some pseudocode to get you started:
469
+
470
+
====
471
+
.Java
472
+
[source,java,role="primary"]
473
+
----
474
+
public final class RunAsAuthorizationManagerAdapter<T> implements AuthorizationManager<T> {
475
+
private final RunAsManager runAs = new RunAsManagerImpl();
476
+
private final SecurityMetadataSource metadata;
477
+
private final AuthorizationManager<T> authorization;
478
+
479
+
// ... constructor
480
+
481
+
public AuthorizationDecision check(Supplier<Authentication> authentication, T object) {
Once you have implemented `AuthorizationManager`, please follow the details in the reference manual for xref:servlet/authorization/method-security.adoc#jc-method-security-custom-authorization-manager[adding a custom `AuthorizationManager`].
0 commit comments