-
Notifications
You must be signed in to change notification settings - Fork 7
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
Employee signin and signup #25
Comments
We're using |
I wanted to bring up a few things here about the flow as it's spelled out, simply because I think it may be trying to get us to do too much that's already handled by Google's oauth system.
This sounds like it's more trouble than it's worth. Can we simply follow the regular oauth2 callback flow (GET /auth/google, redirect to google login, login, then GET /auth/google/callback)? Because that final step will allow us to generate and issue a valid JWT to pass to the client, and since it'll be encrypted using a known/private secret, and sent with every request, we won't have to check with Google again - if we can read it and it's valid, we gave it out so we know they're authenticated.
Why do we need to check if the user already exists? If Google authenticated them for our organization, we know they're valid and that they're part of Josh Software. You can control that organizational authentication measure via the google developer console. It's OK to check for soft deletion and fail authentication/refuse to issue a JWT if they've been soft deleted, but the other issues remain.
Shouldn't be necessary since we're limiting auth to the organization in Google's settings.
Minus the organization/domain part, this makes sense. If Google authenticates them under our organization, we can automatically assume they're allowed to use the system (soft-deletion withstanding).
Again, we don't need to do this because it'll fail authentication on Google's end if we follow the normal redirect-based oauth flow. The flow document seems to want us to build the logic of testing to see if the user is part of our organization, but Google's oauth settings for something like this allow Google to do that for you. So in other words, what I have working right now will authenticate anyone with a joshsoftware.com account, but no one else (even with another google account). I tested this locally and it does appear to work fine. What I have working right now makes use of https://github.com/markbates/goth to handle oauth2 authentication via Google accounts, and it works fine. As of today, we could start issuing JWTs right here in the code. But that's only if we can follow the normal flow that's set up here. Basically what I'm trying to do here is see if we can make some adjustments to this process so we can make use of a library instead of having to dig into the internals of oauth2 in order to implement this ourselves. |
@jahio - We had an internal discussion between @anilmaurya, @iamanujvrma, @sunil4sonawane and I. Summarizing our discussion below: We need to support the following:
Considering these, we felt the current approach is pretty straightforwad and meets our requirements.
We were unable to understand the complications you are facing and are happy to dicuss those OR what made you feel it's not the standard OAuth flow? The difference I see in our approach is that To answer your questions:
We are making these checks as we issue JWT token against users in our DB. i.e. we are not support JWT token provided by Google for internal API calls. |
Just a status update here: Sahil and I discussed this earlier in the week and he helped me get some clarity around what's what. I've got the |
In an effort to "document" things, here's the URL I use for initiating the Google oauth "dance" so we can eventually get a JWT back: |
Tasks:
Add users table migration
Implement /login endpoint as per the flow
Add user_blacklisted_tokens table
Add logout API (this should create an entry of user token in user_blacklisted_tokens)
Task to clean up user_black_listed token when the token in table expires expires
Implement a way to check for valid login/JWT on each request (something we can call in http handler functions)
Acceptance criteria:
Employee
roleThe text was updated successfully, but these errors were encountered: