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

Add LICENSE file and update README.md with improved language/guides #36

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

Kvaksrud
Copy link

@Kvaksrud Kvaksrud commented Jan 29, 2021

I would like to suggest the added changes to README.md as well as inserting the LICENSE file for MIT to the project.

In short, this is what I have done:

  • Made instruction a bit more user friendly
    • More step-by-step and more explanation
  • Changed routes to be more intuitive (and updated them to Laravel 8 standards)
    • The module is for Azure Authentication. Having /azure as first segment og the uri makes sense.
  • Added names to routes
    • To easily reference routes in blades or controllers
  • Changed name of AzureApp middleware class to AzureAuthentication
    • AzureAuthentication makes more sense as a name since it is a middleware.
  • Replaced 'we' with you and that (general grammar)

I felt like this is some boring documenting tasks that nobody wants to do, but having implemented this awesome package in a lot of projects I keep wanting better documentation, so hopefully it falls within good taste :)

Patrick Kvaksrud and others added 4 commits January 29, 2021 13:31
Replaced 'we' with you and that.
Made instruction a bit more user friendly.
Changed routes to be more intuitive.
Added names to routes.
Changed name of AzureApp middleware class to AzureAuthentication.
Copy link
Contributor

@danieltjewett danieltjewett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Kvaksrud Thanks for contributing! We're glad you find this package awesome and useful.

I like most of the updates provided. If you could make the following updates, we can merge this in.

LICENSE Outdated Show resolved Hide resolved
README.md Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated
{
protected function handlecallback($request, Closure $next, $access_token, $refresh_token)
{
$user = Auth::user();
if($user === null) // If the application looses user data while user is authenticated with Laravel "catch" (i.e: User is deleted)
return response()->redirectToRoute('azure.login'); // Make sure the route name is correct if you changed it
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of things here;

  1. I'd suggest redirecting to the built in redirect method https://github.com/rootinc/laravel-azure-middleware/blob/master/src/Azure.php#L122
  2. We may also want to flush session()->get('_rootinc_azure_access_token'); and session()->get('_rootinc_azure_refresh_token');
  3. Though this is an example and might be getting to verbose?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This idea is also echoed in the Custom Redirect section as well.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how to do nr. 2. Could you help @danieltjewett?
3. Personally I like examples with a lot of content to help me build from. It helps me avoid mistakes other might have done before me, that I eventually will run into.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 and 3 kind of go together. If we add the proposed in the example, and somehow we get to a spot where user is null (because they were deleted from the DB), we should also add

session()-> forget(['_rootinc_azure_access_token', '_rootinc_azure_refresh_token']);

in the condition right before we redirect the user back to the login page. Otherwise, https://github.com/rootinc/laravel-azure-middleware/blob/master/src/Azure.php#L41 would be ignored, potentially reaching an infinite redirect situation. Adding all of this could be verbose though as (at least originally) the documentation was showing a simple example of how to update the user field. I do understand your point though. I'll let you decide 👍 If you think it is for the best to include it all for the documentation, go ahead and make the updates with forgetting the session keys and we can push it through.

README.md Outdated Show resolved Hide resolved
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

Successfully merging this pull request may close these issues.

2 participants