Class ReactiveUserContextCaller


  • @Validated
    public class ReactiveUserContextCaller
    extends Object
    The reactive user context caller.
    Author:
    Christian Bremer
    • Field Detail

      • EMPTY_GROUPS_SUPPLIER

        public static final Supplier<reactor.core.publisher.Mono<Set<String>>> EMPTY_GROUPS_SUPPLIER
        The constant EMPTY_GROUPS_SUPPLIER.
      • EMPTY_USER_CONTEXT_SUPPLIER

        public static final Supplier<reactor.core.publisher.Mono<UserContext>> EMPTY_USER_CONTEXT_SUPPLIER
        The constant EMPTY_USER_CONTEXT_SUPPLIER.
      • FORBIDDEN_SUPPLIER

        public static final Supplier<reactor.core.publisher.Mono<UserContext>> FORBIDDEN_SUPPLIER
        The constant FORBIDDEN_SUPPLIER.
    • Constructor Detail

      • ReactiveUserContextCaller

        public ReactiveUserContextCaller()
        Instantiates a new reactive user context caller.
      • ReactiveUserContextCaller

        public ReactiveUserContextCaller​(@Nullable
                                         Supplier<reactor.core.publisher.Mono<Set<String>>> groupsSupplier,
                                         @Nullable
                                         Supplier<reactor.core.publisher.Mono<UserContext>> unauthenticatedSupplier)
        Instantiates a new reactive user context caller.
        Parameters:
        groupsSupplier - the groups supplier
        unauthenticatedSupplier - the unauthenticated supplier
      • ReactiveUserContextCaller

        public ReactiveUserContextCaller​(@Nullable
                                         Function<org.springframework.security.core.Authentication,​reactor.core.publisher.Mono<Set<String>>> groupsFn,
                                         @Nullable
                                         Supplier<reactor.core.publisher.Mono<UserContext>> unauthenticatedSupplier)
        Instantiates a new reactive user context caller.
        Parameters:
        groupsFn - the groups fn
        unauthenticatedSupplier - the unauthenticated supplier
    • Method Detail

      • oneWithUserContext

        public <R> reactor.core.publisher.Mono<R> oneWithUserContext​(@NotNull
                                                                     @NotNull Function<UserContext,​? extends reactor.core.publisher.Mono<R>> function)
        One with user context mono.
        Type Parameters:
        R - the type parameter
        Parameters:
        function - the function
        Returns:
        the mono
      • oneWithUserContext

        public static <R> reactor.core.publisher.Mono<R> oneWithUserContext​(@NotNull
                                                                            @NotNull Function<UserContext,​? extends reactor.core.publisher.Mono<R>> function,
                                                                            @Nullable
                                                                            Function<org.springframework.security.core.Authentication,​reactor.core.publisher.Mono<Set<String>>> groupsFn,
                                                                            @Nullable
                                                                            Supplier<reactor.core.publisher.Mono<UserContext>> unauthenticatedSupplier)
        One with user context mono.
        Type Parameters:
        R - the type parameter
        Parameters:
        function - the function
        groupsFn - the groups fn
        unauthenticatedSupplier - the unauthenticated supplier
        Returns:
        the mono
      • oneWithUserContext

        public static <R> reactor.core.publisher.Mono<R> oneWithUserContext​(@NotNull
                                                                            @NotNull Function<UserContext,​? extends reactor.core.publisher.Mono<R>> function,
                                                                            @Nullable
                                                                            Supplier<reactor.core.publisher.Mono<Set<String>>> groupsSupplier,
                                                                            @Nullable
                                                                            Supplier<reactor.core.publisher.Mono<UserContext>> unauthenticatedSupplier)
        One with user context mono.
        Type Parameters:
        R - the type parameter
        Parameters:
        function - the function
        groupsSupplier - the groups supplier
        unauthenticatedSupplier - the unauthenticated supplier
        Returns:
        the mono
      • manyWithUserContext

        public <R> reactor.core.publisher.Flux<R> manyWithUserContext​(@NotNull
                                                                      @NotNull Function<UserContext,​? extends org.reactivestreams.Publisher<R>> function)
        Many with user context flux.
        Type Parameters:
        R - the type parameter
        Parameters:
        function - the function
        Returns:
        the flux
      • manyWithUserContext

        public static <R> reactor.core.publisher.Flux<R> manyWithUserContext​(@NotNull
                                                                             @NotNull Function<UserContext,​? extends org.reactivestreams.Publisher<R>> function,
                                                                             @Nullable
                                                                             Function<org.springframework.security.core.Authentication,​reactor.core.publisher.Mono<Set<String>>> groupsFn,
                                                                             @Nullable
                                                                             Supplier<reactor.core.publisher.Mono<UserContext>> unauthenticatedSupplier)
        Many with user context flux.
        Type Parameters:
        R - the type parameter
        Parameters:
        function - the function
        groupsFn - the groups fn
        unauthenticatedSupplier - the unauthenticated supplier
        Returns:
        the flux
      • manyWithUserContext

        public static <R> reactor.core.publisher.Flux<R> manyWithUserContext​(@NotNull
                                                                             @NotNull Function<UserContext,​? extends org.reactivestreams.Publisher<R>> function,
                                                                             @Nullable
                                                                             Supplier<reactor.core.publisher.Mono<Set<String>>> groupsSupplier,
                                                                             @Nullable
                                                                             Supplier<reactor.core.publisher.Mono<UserContext>> unauthenticatedSupplier)
        Many with user context flux.
        Type Parameters:
        R - the type parameter
        Parameters:
        function - the function
        groupsSupplier - the groups supplier
        unauthenticatedSupplier - the unauthenticated supplier
        Returns:
        the flux