OAuth 용어 정리
Resource Owner (사용자)
Authorization Server (인증서버
Resource Server (REST API)
OAuth 2.0 grant flow
Authorization code grant flow
가장 많이 권장되고, 사용자와 앱을 둘다 인증함. 앱 인증을 위해서 call back URL(앱의)를 등록해서 call back을 통해서 앱을 인증함
Implicit grant flow
자바스크립트 애플리케이션에서 많이 사용됨. 스크립트 단에서는 credential 등이 노출 될 수 있으니, 주로 Read only 용도로 많이 사용함. accessToken이 노출될것을 전제로 함.
모바일 애플리케이션도 많이 사용하는걸로 나오네??
Used in public clients
It's is a redirection-based flow (similar to the one in the authorization code grant)
The access token is received as a parameter of the redirection endpoint upon successful completion of the request, similar to the authorization code parameter in the authorization request response in the authorization code grant
① The first step is initiation of the flow. The client redirects the User agent to the Authorization server by using the authorization endpoint, the client identifier, and the redirection endpoint that will be used for the response.
② The Authorization server authenticates the Resource owner and requests his decision whether to authorize or deny the request.
③ If the Resource owner authorizes the request (which is assumed), he is redirected back with response information, using the supplied redirection endpoint that was provided with the initial request. The response information is contained in the URL fragment that contains the access token and other parameters (we'll see the difference between a regular URL parameter and one found in a URL fragment in the detailed overview).
④ Now that the User agent (the browser) is redirected back, the access token included in the response is passed to the Client application.
Client Server Application Case
Mobile App Case
(웹이 아니기 때문에, Redirect 처리를 어떻게 해야 할지 고민해야 함.
Samsung Account와 같이 전용 APK를 넣는 방식이나, 웹 페이지 Scrapping 방식등이 있음)
Resource owner password credential grant flow
직접 ID,PASSWORD를 보내는 방식으로, 1’st level 파트너나 자사 시스템에 많이 사용.
기존의 HTTP BASIC이나 HTTP Digest 인증 방식을 migration하기가 용이함
① The resource owner (for example, the user) supplies the Client application with his username and password.
② The client application makes a request to the Authorization server, including the user's credentials and also his own identifier and secret.
③ The Authorization server authenticates the client based on his identifier and secret, checks whether it is authorized for making this request, and checks the resource owner credentials and other parameters supplied. If all checks pass successfully, the Authorization server returns an access token in response.
Client credential grant flow
Userless 상태에서 많이 사용됨. (API 키와 유사한 방식)