Package org.springframework.security.core.context

# Class ReactiveSecurityContextHolder

java.lang.Object
org.springframework.security.core.context.ReactiveSecurityContextHolder

public final class ReactiveSecurityContextHolder extends Object
Allows getting and setting the Spring `SecurityContext` into a `Context`.

Since:
  5.0

## Method Summary

Modifier and Type
Method
Description
`static Function<reactor.util.context.Context,reactor.util.context.Context>`
`clearContext()`
Clears the `Mono<SecurityContext>` from Reactor `Context`
`static reactor.core.publisher.Mono<SecurityContext>`
`getContext()`
Gets the `Mono<SecurityContext>` from Reactor `Context`
`static reactor.util.context.Context`
`withAuthentication(Authentication authentication)`
A shortcut for `withSecurityContext(Mono)`
`static reactor.util.context.Context`
`withSecurityContext(reactor.core.publisher.Mono<? extends SecurityContext> securityContext)`
Creates a Reactor `Context` that contains the `Mono<SecurityContext>` that can be merged into another `Context`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Method Details

### getContext

public static reactor.core.publisher.Mono<SecurityContext> getContext()
Gets the `Mono<SecurityContext>` from Reactor `Context`

Returns:
  the `Mono<SecurityContext>`

### clearContext

public static Function<reactor.util.context.Context,reactor.util.context.Context> clearContext()
Clears the `Mono<SecurityContext>` from Reactor `Context`

Returns:
  Return a `Mono<Void>` which only replays complete and error signals from clearing the context.

### withSecurityContext

public static reactor.util.context.Context withSecurityContext(reactor.core.publisher.Mono<? extends SecurityContext> securityContext)
Creates a Reactor `Context` that contains the `Mono<SecurityContext>` that can be merged into another `Context`

Parameters:
  `securityContext` - the `Mono<SecurityContext>` to set in the returned Reactor `Context`
Returns:
  a Reactor `Context` that contains the `Mono<SecurityContext>`

### withAuthentication

public static reactor.util.context.Context withAuthentication(Authentication authentication)
A shortcut for `withSecurityContext(Mono)`

Parameters:
  `authentication` - the `Authentication` to be used
Returns:
  a Reactor `Context` that contains the `Mono<SecurityContext>`