springboot webflux security 在filter中获取用户名
exchange.getSession(). subscribe(webSession -> { Object spring_security_context = webSession.getAttribute("SPRING_SECURITY_CONTEXT"); if (Optional.ofNullable(spring_security_context).isPresent()) { SecurityContextImpl securityContext = (SecurityContextImpl) spring_security_context; log.info("url:{} method:{} username:{}", exchange.getRequest().getPath(), exchange.getRequest().getMethod(), securityContext.getAuthentication().getName()); } });