OAuth2资源服务器的成功身份验证是否有任何侦听器?我需要在成功认证或令牌验证期间在Sping Boot 资源服务器中创建/复制用户详细信息。有什么建议,关于如何在Sping Boot 中实现它?
yr9zkbsy1#
@Component AuthenticationSuccessEvent事件侦听器工作....
AuthenticationSuccessEvent
@Component public class AuthenticationEvent { Logger logger = LoggerFactory.getLogger(AuthenticationEvent.class); @EventListener public void onSuccess(AuthenticationSuccessEvent success) { System.out.println("S "+ success); } }
参考:https://docs.spring.io/spring-security/reference/servlet/authentication/events.html#servlet-events&示例:https://github.com/m-thirumal/oauth-resource-server/blob/main/src/main/java/in/thirumal/listener/AuthenticationEvent.java
1条答案
按热度按时间yr9zkbsy1#
@Component
AuthenticationSuccessEvent
事件侦听器工作....参考:https://docs.spring.io/spring-security/reference/servlet/authentication/events.html#servlet-events
&
示例:https://github.com/m-thirumal/oauth-resource-server/blob/main/src/main/java/in/thirumal/listener/AuthenticationEvent.java