-
-
Notifications
You must be signed in to change notification settings - Fork 90
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
Usage of scopes in sessions and auth, adding CurrentRequest #1080
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ci skip] [skip ci]
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## feature/scopes #1080 +/- ##
====================================================
+ Coverage 89.60% 89.77% +0.16%
- Complexity 6354 6381 +27
====================================================
Files 830 836 +6
Lines 17956 18085 +129
====================================================
+ Hits 16089 16235 +146
+ Misses 1867 1850 -17 ☔ View full report in Codecov by Sentry. |
msmakouz
changed the title
Using HTTP scopes
Usage of scopes in sessions and auth, addition of CurrentRequest
Feb 20, 2024
msmakouz
changed the title
Usage of scopes in sessions and auth, addition of CurrentRequest
Usage of scopes in sessions and auth, adding of CurrentRequest
Feb 20, 2024
msmakouz
changed the title
Usage of scopes in sessions and auth, adding of CurrentRequest
Usage of scopes in sessions and auth, adding CurrentRequest
Feb 20, 2024
roxblnfk
force-pushed
the
feature/http-scopes
branch
2 times, most recently
from
March 11, 2024 13:25
f401a54
to
9a77110
Compare
roxblnfk
force-pushed
the
feature/http-scopes
branch
from
March 12, 2024 11:58
d103aea
to
90b366c
Compare
roxblnfk
reviewed
Mar 12, 2024
roxblnfk
force-pushed
the
feature/http-scopes
branch
from
March 12, 2024 18:45
d13171b
to
6d5422f
Compare
roxblnfk
approved these changes
Mar 13, 2024
roxblnfk
force-pushed
the
feature/http-scopes
branch
from
March 13, 2024 15:20
ad8ab07
to
db49785
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Refactored
AuthMiddleware
andSessionMiddleware
The
Spiral\Auth\Middleware\AuthMiddleware
andSpiral\Session\Middleware\SessionMiddleware
have been refactored. Now, instead of starting a scope and defining bindings in it, they add data to the request attributes.CurrentRequest
Added
Spiral\Http\CurrentRequest
, which will be available in the container in the http scope and is intended for obtaining the current instance ofPsr\Http\Message\ServerRequestInterface
. In this scope, ServerRequestInterface can be changed using middleware. UsingSpiral\Http\CurrentRequest
, you can obtain the current request object. For example, in the next middleware, after the previous middleware has added some data to the attributes. In the http.request scope,Psr\Http\Message\ServerRequestInterface
will be available as before.Added exceptions
Spiral\Auth\Exception\InvalidAuthContext
- when a user tries to useSpiral\Auth\AuthContextInterface
, but the request attribute lacks the necessary data, the exception message advises configuringSpiral\Auth\Middleware\AuthMiddleware
.Spiral\Session\Exception\InvalidSessionContext
- when a user tries to useSpiral\Session\SessionInterface
, but the request attribute lacks the necessary data, the exception message advises configuringSpiral\Session\Middleware\SessionMiddleware
.Scope limited via attribute
Spiral\Cookies\CookieQueue
- http.requestSpiral\Cookies\CookieManager
- http.requestSpiral\Filter\InputScope
- http.requestSpiral\Http\Request\InputManager
- http.requestSpiral\Session\Session
- httpSpiral\Session\SessionFactory
- httpScope limitation check is disabled by default. It will be enabled in version 4.0.
Marked as deprecated
Spiral\Auth\AuthScope
- in favor of usingSpiral\Auth\AuthContextInterface
directly.Spiral\Auth\TokenStorageScope
- in favor of usingSpiral\Auth\TokenStorageInterface
directly.Spiral\Session\SessionScope
- in favor of usingSpiral\Session\SessionInterface
directly.Spiral\SessionSectionScope
- in favor of using method getSection fromSpiral\Session\SessionInterface
instead.