-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[DX] Ability to authentication a User directly #13062
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
Conversation
Checks user preauth. Improve functional test.
b6d23f3
to
18c56b7
Compare
|
||
<!-- Login Manager --> | ||
<service id="security.login_manager" class="%security.login_manager.class%"> | ||
<argument type="service" id="security.context" /> |
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.
Can you use the security.authorization_checker
and security.token_storage
instead? I don't think features should contain deprecated code. From 2.6 on, class names are no longer in parameters for newly added services.
Ref #3137 |
throw new AuthenticationException("Unauthenticated token"); | ||
} | ||
|
||
$request = $this->requestStack->getMasterRequest(); |
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.
i would prefer making this service stateless and not inject the requestStack.
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.
Make this service stateless by passing request in loginUser method argument?
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.
yes, so the service doesnt dependend on the state of the application (requestStack)
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.
The whole security component currently depends on the Request(Stack). I don't think this will really matters for now, perhaps for future usage. But what if I want to login from a command? I'd have to fake a Request.
@@ -47,6 +47,8 @@ | |||
<parameter key="security.validator.user_password.class">Symfony\Component\Security\Core\Validator\Constraints\UserPasswordValidator</parameter> | |||
|
|||
<parameter key="security.expression_language.class">Symfony\Component\Security\Core\Authorization\ExpressionLanguage</parameter> | |||
|
|||
<parameter key="security.login_manager.class">Symfony\Component\Security\Http\Login\LoginManager</parameter> |
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.
don't use a parameter for the class
Simple usage example: