angularjs-oauth / oauth-ng

AngularJS directive for the OAuth 2.0 Implicit Flow
http://angularjs-oauth.github.io/oauth-ng/
MIT License
363 stars 156 forks source link

Add Support for OpenID Connect Implicit Flow #108

Closed faraway closed 8 years ago

faraway commented 8 years ago

OpenID Connect is built on top of OAuth2, This PR is trying to implement the Implicit Flow(Per http://openid.net/specs/openid-connect-core-1_0.html#ImplicitFlowAuth)

Flow wise there's actually not much change. The major changes (as opposed to regular OAuth2) are:

  1. When sending auth request: scope is usually openid, and response_type is either id_token or id_token token. e.g.
GET /authorize?
    response_type=id_token%20token
    &client_id=s6BhdRkqt3
    &redirect_uri=https%3A%2F%2Fclient.example.org%2Fcb
    &scope=openid%20profile
    &state=af0ifjsldkj
    &nonce=n-0S6_WzA2Mj HTTP/1.1
  Host: server.example.com

2.When getting successful auth response: Besides the other values that OAuth2 would have, it will have one more id_token, which is a JWT format token. e.g.

HTTP/1.1 302 Found
  Location: https://client.example.org/cb#
    access_token=SlAV32hkKG
    &token_type=bearer
    &id_token=eyJ0 ... NiJ9.eyJ1c ... I6IjIifX0.DeWt4Qu ... ZXso
    &expires_in=3600
    &state=af0ifjsldkj

It definitely needs more documentation and automation test coverages(probably even more manual testings). @andreareginato @m00s I'm just trying to see if you guys would be interested in such a feature, and hoping to get some comments / suggestions at the same time.

m00s commented 8 years ago

@patrickyao1988 Awesome man, I'll take a look soon. In the meantime could you please squash your commits? I think having 2 or 3 total would be ok, just to keep a clear history log.

faraway commented 8 years ago

@m00s Thank you so much for reviewing. There're still a few things i want to improve, and i will also add more tests (ooops... sounds like TDD violation..). I will absolutely squash the commits when i'm done : )

m00s commented 8 years ago

@patrickyao1988 Awesome, the code looks good to me, when you're done let me know.

faraway commented 8 years ago

This PR is replaced by https://github.com/andreareginato/oauth-ng/pull/109 so that we will have a cleaner commit history. Closing...