How do /oauth/authorize and /oauth/token interact in Spring OAuth?

烈酒焚心 提交于 2019-12-04 10:42:02

问题


I am doing an in-depth study of Spring OAuth, and I found some conflicting information. Can someone please clarify?

Specifically, this tutorial states that the /oauth/token endpoint handles the username and password before granting a refresh token to the client app. By contrast, the Spring OAuth Developer Guide mentions the /oauth/authorize and /oauth/token endpoints, but yet does not get specific about how they work.

Does the /oauth/authorize do 100% of the username/password/nOtherFactors check and then signal the /oauth/token endpoint to send a refresh token to the client, so that the client then sends the refresh token to the /oauth/token endpoint?

Or is all of it handled by the /oauth/token endpoint?

Is the relationship between /oauth/authorize and /oauth/token different for different grant types? How?


回答1:


Per the OAuth 2.0 specification the authorize and token endpoints have different purposes.

Authorization endpoint is where the resource owner (user) logs in and grants authorization to the client (ex: web application running in the browser or an app running on a mobile device). This is typically used in scenarios where the resource owner's user agent (ex: browser) is redirected to the identity server (authorization server) for authentication. The resource owner's user agent will have direct access to the access token.

Token endpoint is where the client (ex: Server side API or mobile app) calls to exchange the Authorization Code, Client Id and Client Secret for an access token. In this scenario, the user agent is provided with an Authorization code only, no direct access to the access token. The client is a trusted party with access to client Id and Client secret from the authorization server (That is why I mentioned Server side API as the client).

Please read this article that has even better explanation.



来源:https://stackoverflow.com/questions/36944986/how-do-oauth-authorize-and-oauth-token-interact-in-spring-oauth

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!