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

LexikJWTAuthentication bridge #563

Closed
polc opened this issue Jun 2, 2016 · 2 comments
Closed

LexikJWTAuthentication bridge #563

polc opened this issue Jun 2, 2016 · 2 comments

Comments

@polc
Copy link
Contributor

polc commented Jun 2, 2016

What about a LexikJWTAuthenticatio bridge to allow credentials to be sent as JSON object (FOSRestBundle support it).

See : lexik/LexikJWTAuthenticationBundle#123 (comment)

@dunglas
Copy link
Member

dunglas commented Jun 2, 2016

Why not, but IMO a converter from JSON to form encoded is a bad implementation. I would prefer a security listener dealing directly with the JSON object like https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Security/Http/Firewall/UsernamePasswordFormAuthenticationListener.php but parsing the JSON directly.

IMO such listener should be in the bundle from Lexik or in Symfony core, not in API Platform core (because it can be useful in other cases, like when using a pure SF app). What do you think @slashfan.

@dunglas
Copy link
Member

dunglas commented Jun 2, 2016

See symfony/symfony#18952. Tests and feedback are welcome!

Closing this one, please comment on the Symfony PR.

@dunglas dunglas closed this as completed Jun 2, 2016
fabpot added a commit to symfony/symfony that referenced this issue Dec 3, 2016
This PR was squashed before being merged into the 3.3-dev branch (closes #18952).

Discussion
----------

[Security] Add a JSON authentication listener

| Q | A |
| --- | --- |
| Branch? | master |
| Bug fix? | no |
| New feature? | yes |
| BC breaks? | no |
| Deprecations? | no |
| Tests pass? | yes |
| Fixed tickets | n/a |
| License | MIT |
| Doc PR | symfony/symfony-docs#7081 |

Add a new authentication listener allowing to login by sending a JSON document like:

 `{"_username": "dunglas", "_password": "foo"}`.

It is similar to the traditional form login (but take a JSON document as entry) and is convenient for APIs, especially used in combination with JWT.

See api-platform/core#563 and lexik/LexikJWTAuthenticationBundle#123 (comment) for previous discussions.
- [x] Add functional tests in security bundle

Commits
-------

02178bc [Security] Add a JSON authentication listener
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

No branches or pull requests

2 participants