如何使用Spring WebFlux获取“身份验证”对象?

Jue*_*ann 3 spring-security spring-webflux

使用SpringMVC和Spring Security,我可以实现一个像这样的Controller(在Java中):

@RestController
@RequestMapping("/auth")
class AuthController {
    private final AuthService authService;

    AuthController(AuthService authService) {
        this.authService = authService;
    }

    @GetMapping("/roles")
    Collection<String> findRoles(Authentication authentication) {
        final Object principal = authentication.getPrincipal();
        ...;
    }
}
Run Code Online (Sandbox Code Playgroud)

但是,在使用Spring WebFlux和Spring Security(包括反应性部件)时,我基本上如何org.springframework.security.core.Authentication处理程序类(或服务类)中注入对象?