Tag: OAuth

  • Django – OAuth Test Sample

    An OAuth sample code base on Django.

    Django Commands

    • pip3 install django djangorestframework django-oauth-toolkit
    • django-admin startproject oauth_test
    • cd oauth_test
    • python3 manage.py startapp test_app
    • python3 manage.py makemigrations
    • python3 manage.py migrate
    • python3 manage.py createsuperuser
    • python3 manage.py runserver
    • We can test by using Postman application.

    Setup OAuth in project’s admin management site

    • Default site url: http://127.0.0.1:8000/admin
    • Attention! The Client secret need save copy on create step! After creating, the Client secret field only shows the hashed client secret not original. (We need use the original client secret for auth)

    Project Structure

    Project Structure

    .\oauth_test\settings.py

    .\oauth_test\urls.py

    .\test_app\apps.py

    .\test_app\models.py

    .\test_app\serializers.py

    .\test_app\views.py

    .\test_app\urls.py

    Postman Test for get auth – Post

    Use the original Client secret.

    Postman Test for use auth – Get

  • Aras Innovator – 使用者檔案下載的資料流程圖(Innovator Server, OAuth Server & Vault Server)

    以下為個人理解的 Aras Innovator 檔案下載流程,所有 Server 之間的溝通都使用 OAuth 的公鑰加密: (如有錯誤麻煩來信指正)

    1. Client 對 Innovator Server 請求檔案下載
    2. Innovator Server 確認使用者授權後回傳 Token
    3. Client 對 Vault Server 請求檔案下載
    4. Vault Server 對 Innovator Server 確認Token (資料流透過 OAuthServer 公鑰加密)
    5. Innovator Server 對 OAuth Server 請求解密 Vault Server 傳來的資料 (資料流透過 OAuthServer 公鑰加密)
    6. OAuth Server 確認請求來源為設定的合法 Innovator Server,回傳其請求的資料 (資料流透過 InnovatorServer公鑰加密)
    7. Innovator Server 對 OAuth Server 請求加密要回傳給 Vault Server 的使用者授權確認的結果
      (資料流透過 OAuthServer 公鑰加密)
    8. OAuth Server 確認請求來源為設定的合法 Innovator Server,回傳用 VaultServer 公鑰加密的資料
      (資料流透過 InnovatorServer公鑰加密)
    9. Innovator Server 回傳 OAuth Server 加密後的資料給 Vault Server
    10. Vault Server 確認 Token 無誤後回應檔案串流給 Client