【问题标题】:get userAuthentication object from spring security context从 Spring 安全上下文中获取 userAuthentication 对象
【发布时间】:2019-06-15 13:39:45
【问题描述】:

我已经调试了SecurityContextHolder.getContext().getAuthentication() 有一个 userAuthentication 对象,它也有我的自定义详细信息。没有 getter 可以访问 this。如何获取这些详细信息。

如何从 ?SecurityContextHolder.getContext().getAuthentication() 获取令牌增强的附加详细信息

【问题讨论】:

    标签: spring-boot spring-security oauth-2.0


    【解决方案1】:
    OAuth2Authentication principal =  (OAuth2Authentication) SecurityContextHolder.getContext().getAuthentication();
    Object object=principal.getUserAuthentication().getDetails();
    

    【讨论】:

      猜你喜欢
      • 2011-09-03
      • 2015-10-06
      • 2013-01-27
      • 2015-11-29
      • 2015-09-13
      • 2022-12-19
      • 2020-09-20
      • 1970-01-01
      • 2010-10-03
      相关资源
      最近更新 更多