Auth Guards Feature/931 #932
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Guards are a quick and easy way to swap out the authentication logic down to the route level or during a specific request.
The way it works is we have a
Guardclass which is able to switch between different guards. By default, Masonite only has a web guard which gets the user from the cookie.You can imagine there are other ways to get users. For example the API package might get a user based on an incoming token or based on a token in the request header.
This can be used exactly like the auth class now but can also swap between guards
Closes #931