Spring Security:手动验证用户

Tar*_*eta 5 authentication oauth spring-mvc spring-security

我尝试通过oAuth在Spring Security应用程序中验证用户身份.我已收到令牌和用户的数据.

如何在没有密码和经典登录表单的情况下手动验证用户身份?谢谢.

vac*_*uum 20

像这样的东西:

Authentication authentication =  new UsernamePasswordAuthenticationToken(person, null, person.getAuthorities());
log.debug("Logging in with {}", authentication.getPrincipal());
SecurityContextHolder.getContext().setAuthentication(authentication);
Run Code Online (Sandbox Code Playgroud)

person您的UserDetailsBean对象在哪里.