In a reactive Spring Security application, ReactiveAuthenticationManager performs authentication asynchronously. AuthenticationWebFilter intercepts a request, delegates authentication to the manager, and receives the resulting Authentication object. section 17.2
A reactive authentication flow typically works as follows:
- AuthenticationWebFilter intercepts the HTTP request and delegates authentication to ReactiveAuthenticationManager. section 17.2
- ReactiveAuthenticationManager implements the authentication logic directly; reactive applications do not use authentication providers. section 17.2
- When credentials are involved, the manager uses ReactiveUserDetailsService to obtain user details and PasswordEncoder to verify the password. section 17.2
- After successful authentication, the filter stores the Authentication object in the SecurityContext. section 17.2
Reactive username-and-password application
Configure a ReactiveUserDetailsService with the user john, password 12345, and read authority, plus a PasswordEncoder. Calling /hello with curl -u john:12345 authenticates successfully and can produce “Hello john”. To create custom authentication behavior, implement ReactiveAuthenticationManager directly. section 17.2
Figure 17.5 An AuthenticationWebFilter intercepts the request and delegates the authentication responsibility to a ReactiveAuthenticationManager. If the authentication logic involves users and passwords, the ReactiveAuthenticationManager uses a ReactiveUserDetailsService to find the user details and a PasswordEncoder to verify the password.
Shows AuthenticationWebFilter delegating to ReactiveAuthenticationManager, which uses ReactiveUserDetailsService and PasswordEncoder for username-and-password authentication. section 17.2
