当前位置: 代码迷 >> 综合 >> 浅谈spring security oauth2对oauth2.0的授权方式的实现
  详细解决方案

浅谈spring security oauth2对oauth2.0的授权方式的实现

热度:84   发布时间:2024-03-07 14:37:35.0

框架中统一的授权入口是:"/oauth/token"

该接口在 org.springframework.security.oauth2.provider.endpoint.TokenEndpoint 这个类中。

 @RequestMapping(value = {"/oauth/token"},method = {RequestMethod.POST})public ResponseEntity<OAuth2AccessToken> postAccessToken(Principal principal, @RequestParam Map<String, String> parameters) throws HttpRequestMethodNotSupportedException {if (!(principal instanceof Authentication)) {throw new InsufficientAuthenticationException("There is no client authentication. Try adding an appropriate authentication filter.");} else {String clientId = this.getClientId(principal);ClientDetails authenticatedClient = this.getClientDetailsService().loadClientByClientId(clientId);TokenRequest tokenRequest = this.getOAuth2RequestFactory().createTokenRequest(parameters, a
  相关解决方案