项目作者: BookOfGreg

项目描述 :
Doorkeeper + Devise + JWT
高级语言: Ruby
项目地址: git://github.com/BookOfGreg/Doorkeeper-JWT-test.git
创建时间: 2018-05-23T23:16:44Z
项目社区:https://github.com/BookOfGreg/Doorkeeper-JWT-test

开源协议:

下载


Doorkeeper-JWT-Test

What?

This is an example repo combining Rails API with the Doorkeeper admin UI, making use of Devise for login pages, admin auth, and password flows. The Doorkeeper tokens issued are JWTs with a payload + header that looks like this:

  1. [{"iss": "account_service",
  2. "iat": 1527438897,
  3. "exp": 1527440097,
  4. "jti": "add3ef92-a512-429b-a834-3a3523866cdd",
  5. "sub": "account_service|1",
  6. "expires_at": "2018-05-27T16:54:57Z",
  7. "user": {"id": 1, "email": "local@example.com"}},
  8. {"typ": "JWT", "alg": "HS512"}]

Why?

Firstly I wanted to understand what was needed for SSO/OAuth2/JWT combo to work in the modern age, secondly everything else had some shortcomings either in usability or flexibility.

https://github.com/doorkeeper-gem/doorkeeper-devise-client

  • Using old versions, no JWT

https://github.com/digivizer/warden-jwt

  • Uses password flow strategy

https://github.com/waiting-for-dev/warden-jwt_auth

  • Is good but limits the JWT decode options

https://github.com/mbleigh/omniauth-jwt

  • Expects HTTP based on redirects for flow

https://github.com/betterup/devise-doorkeeper

  • No JWT support

How?

I cobbled together examples from all the above + the JWT spec + Auth0 articles.
This is not a complete application and you shouldn’t just drop it into your production env! YMMV, this is for reference only.