File tree 1 file changed +22
-2
lines changed
project-management/src/main/java/life/qbic/projectmanagement/application/authorization
1 file changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -46,15 +46,35 @@ public static <T> Mono<T> applySecurityContext(Mono<T> original) {
46
46
});
47
47
}
48
48
49
+ /**
50
+ * Same as {@link #applySecurityContext(Mono)} but applies to {@link Flux}.
51
+ *
52
+ * @param original the original reactive stream
53
+ * @param <T> the type of the flux
54
+ * @return the reactive stream for which the security context has been set explicitly
55
+ * @since 1.10.0
56
+ */
49
57
public static <T > Flux <T > applySecurityContextMany (Flux <T > original ) {
50
58
return ReactiveSecurityContextHolder .getContext ().flatMapMany (securityContext -> {
51
59
SecurityContextHolder .setContext (securityContext );
52
60
return original ;
53
61
});
54
62
}
55
63
56
- public static <T > Flux <T > writeSecurityContextMany (Flux <T > original , SecurityContext securityContext ) {
57
- return original .contextWrite (ReactiveSecurityContextHolder .withSecurityContext (Mono .just (securityContext )));
64
+ /**
65
+ * Same as {@link #writeSecurityContext(Mono, SecurityContext)} but applies to {@link Flux}.
66
+ *
67
+ * @param original the original reactive stream
68
+ * @param securityContext the security context to write into the context of the flux
69
+ * @param <T> the type of the flux
70
+ * @return the reactive stream for which the {@link ReactiveSecurityContextHolder} has been
71
+ * configured with the provided {@link SecurityContext}.
72
+ * @since 1.10.0
73
+ */
74
+ public static <T > Flux <T > writeSecurityContextMany (Flux <T > original ,
75
+ SecurityContext securityContext ) {
76
+ return original .contextWrite (
77
+ ReactiveSecurityContextHolder .withSecurityContext (Mono .just (securityContext )));
58
78
}
59
79
60
80
}
You can’t perform that action at this time.
0 commit comments