Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handle the last leg of oAuth #65

Open
maxgrossman opened this issue Jul 30, 2019 · 0 comments
Open

handle the last leg of oAuth #65

maxgrossman opened this issue Jul 30, 2019 · 0 comments
Assignees

Comments

@maxgrossman
Copy link
Contributor

maxgrossman commented Jul 30, 2019

#52 still has one more leg of work left.

I had not really thought about what we do when the callback URL is successful.
We cannot do what we do now (just return a JWT).

Since the request made to the callback endpoint is a popup window separate from the SPA app that really needs the JWT, we'll need to add "one last leg" to get the JWT to our front end SPA.

To do this, we need the callback URL to return a 302/307 http response with 2 characteristics

  1. the location header set to ${maprules.base}/authorized?user=${user.that.was.logging.in}
  2. an httponly session cookie that maps to one of the login sessions we keep track of in the sessionManager class.

To encrypt this cookie, maybe we just send it through the jwt sign function??

Then, when the front end loads its location to that new path /authorized it will try to make a req to something like /auth/token which will reconcile if http session cookie (which it sends) and the user in the query parameter to a current session in the SessionManager. If it successfully finds one, we reply to the JWT that the app can use for user-protected routes

This def feels convoluted, but the initial decision to use JWT (which has a convention of being sent in an auth header, not some httponly session cookie) leaves us here, needing a final step.

This also implies getting away from yar. I guess I never read docs correctly, but the yar object is handler request specific, it is not some global to server object that you can look up things with. I think if we encrypt session cookies the front end receives we are left at a similar place I was trying to get with yar - don't just make the all the session details readable without some sort of key.

@maxgrossman maxgrossman self-assigned this Jul 30, 2019
maxgrossman added a commit that referenced this issue Jul 31, 2019
maxgrossman added a commit that referenced this issue Jul 31, 2019
maxgrossman added a commit that referenced this issue Aug 1, 2019
maxgrossman added a commit that referenced this issue Aug 2, 2019
maxgrossman added a commit that referenced this issue Aug 6, 2019
maxgrossman added a commit that referenced this issue Aug 13, 2019
maxgrossman added a commit that referenced this issue Aug 30, 2019
maxgrossman added a commit that referenced this issue Aug 30, 2019
maxgrossman added a commit that referenced this issue Aug 30, 2019
maxgrossman added a commit that referenced this issue Aug 30, 2019
* working on updating cb url

ref #65

* add verify route and use jwt as httpOnly cookie

ref #65

* add needed cors headers for cross origin

ref #65

* add get user route to handle when session is valid but localstorage lacks user

ref #65

* add cors to route
ref #65

* add more cors configurations, make cookie include access to everythign at /
ref #65

* update tests so they put jwt in cookie header and respond redirect in callback route

ref #65

* reach 95% coverage and unveil good bug to fix (I think)!
ref #65

* simplify auth test and remove some lines of code to get coverage working

ref #65

* initial explore route

ref #65

* include preset name.
ref #65

* lint, update icon lookup test

ref #65

* remove console log

ref #65

* update test after re-building icon map

ref #65
maxgrossman added a commit that referenced this issue Aug 30, 2019
* beginning work on oAuth implementation...

ref #52

* working on adding db migrations....

ref #52

* add new / update existing migration scripts. clean package depenedencies...
ref #52

* remove stray console log....
ref #52

* first step to get callback endpoint working...

ref #52

* jwt key in config...

ref #52

* ...working on tdd for crud/jwt authentication

ref #52

* working on adding jwt auth schema to service for securing crud routes...

refs #52

* add jwt scheme/strategy test...

ref #52

* work through additional tests for securing routes with JWT

ref #52

* remove handlers/route files we now have in ${name.of.route}/index.js

ref #52

* update some docs in the config file

ref #52

* update fixture docs

ref #52

* some better development docs...

ref #52

* add back presetConfig that I whacked!!!

ref #52

* no need for multiple path params, move no-auth get configuration to config map

ref #52

* add login/callback test, use jwt expiration, add session route, configure circle to work with JWT authentication (#60)

* initial user agent implementation

ref #58

* work on login/callback tests...

ref #58

* adding additional test for login/callback

ref #58

* ...additional tests for callback

ref #58

Signed-off-by: Max Grossman <[email protected]>

* move callback route's session logic to pre method

refs #58 #57

* add session route and accompianing test

ref #58

* add db folder in job command

ref #58

* put fake env_vars right in circleci build_and_test script

ref #58

* has to be called build I guess!

ref #58

* maybe try the dependecy cache steps?

ref #58

* lint fixes

ref #58

* update babel/eslint dependency versions

ref #58

* make sure to pass jwt for mapcss resource tests

ref #58

* no need for request-debug

ref #58

* add logout (#62)

* initial user agent implementation

ref #58

* work on login/callback tests...

ref #58

* adding additional test for login/callback

ref #58

* ...additional tests for callback

ref #58

Signed-off-by: Max Grossman <[email protected]>

* move callback route's session logic to pre method

refs #58 #57

* add session route and accompianing test

ref #58

* add db folder in job command

ref #58

* put fake env_vars right in circleci build_and_test script

ref #58

* has to be called build I guess!

ref #58

* maybe try the dependecy cache steps?

ref #58

* lint fixes

ref #58

* update babel/eslint dependency versions

ref #58

* make sure to pass jwt for mapcss resource tests

ref #58

* no need for request-debug

ref #58

* add logout test...need to update other tests

#61

* make sure the seedData's session record has initial value for presetConfig/mapcss tests

ref #61

* run all tests and fix a bunch, move handlers over to routes...

ref #61

* get rid of handlers!!

ref #61

* use json like before...

ref #61

* move auth all to index

ref #61

* better enforce http response conventions throughout routes (#64)

* clean up end of lines and add back the .gitkeep

ref #61

* tdd for authentication error codes...

ref #63

* fix josmPresets!

ref #63

* update http response expectations for different routes & update circle config

ref #63

* add the line endings!!

ref #63

* clean up and add endlines

ref #52

* finish up oAuth cleanup (#66)

* working on updating cb url

ref #65

* add verify route and use jwt as httpOnly cookie

ref #65

* add needed cors headers for cross origin

ref #65

* add get user route to handle when session is valid but localstorage lacks user

ref #65

* add cors to route
ref #65

* add more cors configurations, make cookie include access to everythign at /
ref #65

* update tests so they put jwt in cookie header and respond redirect in callback route

ref #65

* reach 95% coverage and unveil good bug to fix (I think)!
ref #65

* simplify auth test and remove some lines of code to get coverage working

ref #65

* initial explore route

ref #65

* include preset name.
ref #65

* lint, update icon lookup test

ref #65

* remove console log

ref #65

* update test after re-building icon map

ref #65
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant