laardee / serverless-authentication-boilerplate

Generic authentication boilerplate for Serverless framework
http://laardee.github.io/serverless-authentication-gh-pages
MIT License
569 stars 72 forks source link

useful sequence diagrams #40

Open jchris opened 7 years ago

jchris commented 7 years ago

Here are 3 sequence diagrams of how this works, that you can plug into https://www.websequencediagrams.com/ when you are making slides or whatever.

title Authentication
Browser->Sign In: Initial request
Sign In -> Facebook: Redirect
note over Facebook: Approve login
Facebook -> Callback: Redirect
Callback -> FaunaDB: Find or create user
FaunaDB -> Callback: Database secret for user
Callback -> Browser: Set authorization header
title Authorization
Browser -> Content Service: API Request
Content Service -> Authorizer: Authorization to Policy
Authorizer -> Content Service: Policy w/ FaunaDB Secret
Content Service <-> FaunaDB: Load application data
Content Service -> Browser: Render API response
title Refresh
Browser -> Content Service: API Request
Content Service -> Authorizer: Authorization to Policy
Authorizer -> Content Service: Access denied
Content Service -> Browser: Access denied
Browser -> Refresh: XHR Request with refresh token
Refresh -> FaunaDB: Find user for token
FaunaDB -> Refresh: Database secret for user
Refresh -> Browser: Set Authorization Header

Looks like this:

authentication

authorization

refresh