-
Notifications
You must be signed in to change notification settings - Fork 136
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
Implement auth0 guard #166
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Tamrael - Really appreciate the well-thought-out PR here! A few questions for you:
- Is this primary or only for API authentication or does this handle login as well? I believe it's just the former.
- Should this replace our current guidance (web application login or API protection) on implementing this module or should it exist alongside?
- Is this compatible with Laravel 5.7? Judging by the documentation, it looks like it is but just want to make sure.
@joshcanhelp let me try and address your questions to the best of my knowledge
|
@Tamrael - Thanks again! Let me get this running locally and if everything looks good, we'll get this in. |
@joshcanhelp just had the time to check. the bearerToken function is part of the "InteractsWithInput" trait and is available since 5.4 so everything about this guard is 5.4 and above. if you need anything else I'd be glad to help. |
@Tamrael - Apologies for the delay here. I appreciate all your explanation here and can see that this would be useful to add. I pulled the branch down and followed the documentation you added. Everything came together as expected but when I hit the route, I get a redirect to the Auth0 login page. If I understand how this works, it's looking for a JWT in the headers with Am I misunderstanding how this should be used? I followed your setup instructions with the following in Route::middleware('auth:auth0')->get('/auth0-guard', function (Request $request) {
return $request->user();
}); |
@joshcanhelp sorry didn't think to mention that. the request to the api must expect json as a return or be ajax (not pjax) and accept any content type. the handling for the unauthenticated message is completely done by laravel. |
@Tamrael - Thank you for the suggestion, that worked as expected. I'm sorry to keep coming back with questions/changes but I think we should get this in. The next version, however, is a major so this should be merged into that branch. When I switch the branch here to the dev branch Thank you once again for sticking with this! I'm glad we'll be able to get this in. |
# Conflicts: # composer.json # src/Auth0/Login/LoginServiceProvider.php # tests/Auth0ServiceTest.php
@joshcanhelp i rebased this onto 7.0. tests ran in laravel 5, 6 and 7. can't tests this further atm but I'm pretty sure this works. I removed the tests/bootstrap.php because it's not needed when setting the ini in the phpunit.xml, hope you don't mind. |
@Tamrael - We appreciate your work on this! Thanks for the great communication as well! |
Changes
References
Implementation through closure request guard
Implemented to fix testing problems mentioned in #161
Testing
Checklist