16
16

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

PlantUML Example for The OAuth

16
Last updated at Posted at 2019-02-01

å®Ÿē”Øēš„ćŖć‚µćƒ³ćƒ—ćƒ«ćØć—ć¦ OAuth ć®ć„ćć¤ć‹ć®å›³ć‚’ UML ć§č”Øē¾ć—ć¾ć™ć€‚
OAuth は RFC 6749 ć®åŸŗęŗ–ć§ć™ćŒ GitHub 恮 Web Application Flow ć‚’å‚č€ƒć«ć—ć¦ć„ć¾ć™ć€‚

Component

å½¹å‰²ć”ćØć®ć‚³ćƒ³ćƒćƒ¼ćƒćƒ³ćƒˆćŒć€ćć‚Œćžć‚Œć®ćƒŽćƒ¼ćƒ‰ć«é…ē½®ć•ć‚Œć¦ć„ć¾ć™ć€‚

actor "User"

node "Application" {
  [Client]
}

node "API" {
  [Resource]
}

node "Authentication" {
  [AuthN]
}

node "Authorization" {
  [AuthZ]
}


[User].[Client]
[User]..[AuthN]
[User]..[AuthZ]

[AuthN]..[AuthZ]

[Client]..[AuthN]
[Client]..[AuthZ]
[Client].[Resource]

Sequence

ćƒŽćƒ¼ćƒˆć‚„ćƒ‡ć‚£ćƒć‚¤ćƒ€ć‚’å·„å¤«ć™ć‚‹ćØć‚·ćƒ¼ć‚±ćƒ³ć‚¹ćŒč§£ć‚Šć‚„ć™ććŖć‚Šć¾ć™ć€‚

actor User

== Initial ==

User -> Client : Request Client Sign In
note right : GET /user/sign_in

activate Client
Client -> Client : Access Token?

== Authentication ==

Client -> AuthN : Redirect
note right : GET /oauth/authorize
deactivate Client

activate AuthN
AuthN -> AuthN : Current User?
AuthN -> AuthN : Redirect
note right : GET /user/sign_in
User <- AuthN : Response AuthN Sign In
deactivate AuthN

User -> AuthN : Request AuthN Sign In (ID, Pass)

activate AuthN
note right : POST /user/sign_in
AuthN -> AuthN : Redirect
note right : GET /oauth/authorize

== Authorization ==

AuthN -> AuthZ : Redirect
note right : GET /oauth/authorize
deactivate AuthN

activate AuthZ
User <- AuthZ : Response AuthZ Application
deactivate AuthZ

User -> AuthZ : Request AuthZ Application (Allow)
note right : POST /oauth/authorize

activate AuthZ
AuthZ -> AuthZ : Generate Code

Client <- AuthZ : Redirect
note right : GET /callback
deactivate AuthZ

activate Client
Client -> AuthZ : Request Access Token
note right : POST /oauth/access_token

activate AuthZ
AuthZ -> AuthZ : Authorization Code?
AuthZ -> AuthZ : Generate Token

Client <-- AuthZ : Response Access Token
deactivate AuthZ

Client -> Client : Redirect
note right : GET /user/sign_in

Client -> Client : Access Token?

== Resource ==

Client -> Resource : Request User (Access Token)
note right : GET /api/user

activate Resource
Client <-- Resource : Response User
deactivate Resource

== Final ==

Client -> Client : Redirect
note right : GET /

User <- Client : Response Client Sign In
deactivate Client

å®Ÿéš›ć® OAuth 恮 Flow ćØåˆć£ć¦ć„ć‚‹ć‹ćÆ GitHub ć‚’ć‚µć‚¤ćƒ³ć‚¢ć‚¦ćƒˆć—ćŸēŠ¶ę…‹ć§ć€ć•ć‚‰ć« Qiita ćŖć©ć®ć‚µćƒ¼ćƒ“ć‚¹ć‚‚ć‚µć‚¤ćƒ³ć‚¢ć‚¦ćƒˆć—ćŸēŠ¶ę…‹ć‹ć‚‰ć‚µć‚¤ćƒ³ć‚¤ćƒ³ć‚’ćƒŖć‚Æć‚Øć‚¹ćƒˆć—ć¦ē¢ŗčŖć—ć¦ćć ć•ć„ć€‚ļ¼ˆć™ć§ć« Authorized ć•ć‚ŒćŸć‚µćƒ¼ćƒ“ć‚¹ćÆć“ć”ć‚‰ć§ Revoke ć™ć‚‹åæ…č¦ćŒć‚ć‚Šć¾ć™ć€‚ļ¼‰

16
16
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
16
16

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?