项目作者: emilianito

项目描述 :
Single Sign On using oAuth2 & JWT
高级语言: Python
项目地址: git://github.com/emilianito/sso-oauth2.git
创建时间: 2020-02-10T00:34:34Z
项目社区:https://github.com/emilianito/sso-oauth2

开源协议:

下载


SSO - OAuth2

Single Sign On using oAuth2 & JWT
The project constist of 3 apps:

This application has a users database and a login form to validate them. It implements oAuth2 server service auth:

Code Flow

code flow

Ask for permissions using “code”

  1. http://127.0.0.1:8000/users/authorize/
  2. ?response_type=code
  3. &client_id=765
  4. &resource_id=432
  5. &redirect_uri=http://127.0.0.1:8000/app1/auth_landing_page
  6. &state=asdf1234
  7. &scope=all

Independent applications uses the Authorization Server to validate its users.
Once the user has validated with username and password, it will be redirected to:

  1. http://127.0.0.1:8000/app1/auth_landing_page
  2. ?code=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  3. &state=asdf1234

Get final token:

  1. /token
  2. ?client_id=765
  3. ?client_secret=xyz
  4. ?code=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Response

  1. HTTP/1.1 200 OK
  2. Content-Type: application/json
  3. {
  4. "access_token" : "asdasdfasdadfadf...",
  5. "token_type" : "Bearer",
  6. "expires_in" : 3600,
  7. "scope" : "all"
  8. }

Ask for permissions using “token”

  1. http://127.0.0.1:8000/users/authorize/
  2. ?response_type=token
  3. &client_id=765
  4. &resource_id=432
  5. &redirect_uri=http://127.0.0.1:8000/app1/auth_landing_page
  6. &state=asdf1234
  7. &scope=all

Redirect URI:

  1. http://127.0.0.1:8000/app1/auth_landing_page
  2. ?access_token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  3. &expire_in=3600
  4. &state=asdf1234