First off, I am new to Symfony, so I don't know the exact functionality of bundles like FOSUserBundle
etc., as well as the terminology.
I am looking for a way to use the Symfony security component in a way that enables me to decouple a user's login credentials (say, a login name and a password, maybe the roles) from the actual user meta data (like first name, last name, groups, birth date, etc.).
The idea is that a user can login with different sets of login name/password and still be recognized as the same user (in the end that means, getting the same User
object).
To me, this comes especially handy in combination with multiple authentication providers. For example, if I wanted to enable my users to login via an OAuth2 service as an alternative to logging in with their locally-hosted login name/password-combination (like StackExchange does, for instance), how would I do that?
I have read multiple pages of documentation of Symfony, e.g.:
- https://symfony.com/doc/current/security.html
- https://symfony.com/doc/current/security/entity_provider.html#create-your-user-entity
This latter one even says at 1) Create your User Entity
, that a password
is a field of User
.
User
andUserCredentials
, with 1-to-many relation. UseUser
to keep your metadata, andUserCredentials
for authentication. – Alex BlexController::getUser()
would return an instance ofUserCredentials
then, likely leading to confusion since the function name isgetUser
. – paolo