-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Description
At the behest of Ryan Weaver I am opening an issue about the Security documentation. I originally misopened this in symfony/symfony#2320. @jalliot mentioned there being an existing issue on this subject, but I did not find any currently open.
I have been trying to get my Symfony2 application secured, and I am hitting some major pain points when trying to use only SF2 documentation (http://symfony.com/doc/current/book/security.html):
- Implementing the Symfony\Component\Security\Core\User\UserInterface needs more detail, specifically:
- A basic example.
- Developers with a weak understanding of inheritance will not understand that the property $username is not actually the only thing that needs to be defined (and in fact does not need to be defined at all given the interface).
- Symfony\Component\Security\Core\User\UserInterface::equals() needs some focus here. This is an issue for security, but we do not offer any advice except that a user "The equality comparison should neither be done by referential equality
nor by comparing identities (i.e. getId() === getId()).". This is in the interface itself, not even in the book. - equals(), eraseCredentials(), getUsername(), getSalt(), getPassword(), getRoles() should all at least be mentioned, and used in the basic example.
- It seems this may be in progress as I see http://symfony.com/doc/current/cookbook/security/entity_provider.html exists, but currently contains nothing.
- Custom Role class is mentioned, but never shown. I actually am not sure why I would ever need the Role class myself, but if there is a need for this maybe a recipe showing an example?
From my perspective creating a http_basic login is VERY easy to do, when your users are stored in your YML. However I think it also is applicable to the smallest portion of developers. I assume most applications are going to use custom login forms. I also assume most applications will also use a datastore (DB, nosql, kerberos, etc) to store users, and not the configuration files.
I can say as a relatively new SF2 developer, I am finding this portion of my development to be the hardest portion so far. If I only had access to the book documentation my code would never be able to use a database for user storage.
EDIT: added missing formatting for readability.