@@ -10,9 +10,9 @@ the configured user provider to return a user object for a given username.
1010Symfony then checks whether the password of this user is correct and generates
1111a security token so the user stays authenticated during the current session.
1212Out of the box, Symfony has an "in_memory" and an "entity" user provider.
13- In this entry we 'll see how you can create your own user provider, which
13+ In this entry you 'll see how you can create your own user provider, which
1414could be useful if your users are accessed via a custom database, a file,
15- or - as we show in this example - a web service.
15+ or - as shown in this example - a web service.
1616
1717Create a User Class
1818-------------------
@@ -21,7 +21,7 @@ First, regardless of *where* your user data is coming from, you'll need to
2121create a ``User `` class that represents that data. The ``User `` can look
2222however you want and contain any data. The only requirement is that the
2323class implements :class: `Symfony\\ Component\\ Security\\ Core\\ User\\ UserInterface `.
24- The methods in this interface should therefore be defined in the custom user
24+ The methods in this interface should therefore be defined in the custom user
2525class: ``getRoles() ``, ``getPassword() ``, ``getSalt() ``, ``getUsername() ``,
2626``eraseCredentials() ``, ``equals() ``.
2727
@@ -101,12 +101,12 @@ For more details on each of the methods, see :class:`Symfony\\Component\\Securit
101101Create a User Provider
102102----------------------
103103
104- Now that we have a ``User `` class, we 'll create a user provider, which will
104+ Now that you have a ``User `` class, you 'll create a user provider, which will
105105grab user information from some web service, create a ``WebserviceUser `` object,
106106and populate it with data.
107107
108- The user provider is just a plain PHP class that has to implement the
109- :class: `Symfony\\ Component\\ Security\\ Core\\ User\\ UserProviderInterface `,
108+ The user provider is just a plain PHP class that has to implement the
109+ :class: `Symfony\\ Component\\ Security\\ Core\\ User\\ UserProviderInterface `,
110110which requires three methods to be defined: ``loadUserByUsername($username) ``,
111111``refreshUser(UserInterface $user) ``, and ``supportsClass($class) ``. For
112112more details, see :class: `Symfony\\ Component\\ Security\\ Core\\ User\\ UserProviderInterface `.
@@ -158,7 +158,7 @@ Here's an example of how this might look::
158158Create a Service for the User Provider
159159--------------------------------------
160160
161- Now we make the user provider available as a service.
161+ Now you make the user provider available as a service:
162162
163163.. configuration-block ::
164164
@@ -167,29 +167,29 @@ Now we make the user provider available as a service.
167167 # src/Acme/WebserviceUserBundle/Resources/config/services.yml
168168 parameters :
169169 webservice_user_provider.class : Acme\WebserviceUserBundle\Security\User\WebserviceUserProvider
170-
170+
171171 services :
172172 webservice_user_provider :
173173 class : " %webservice_user_provider.class%"
174-
174+
175175 .. code-block :: xml
176176
177177 <!-- src/Acme/WebserviceUserBundle/Resources/config/services.xml -->
178178 <parameters >
179179 <parameter key =" webservice_user_provider.class" >Acme\WebserviceUserBundle\Security\User\WebserviceUserProvider</parameter >
180180 </parameters >
181-
181+
182182 <services >
183183 <service id =" webservice_user_provider" class =" %webservice_user_provider.class%" ></service >
184184 </services >
185-
185+
186186 .. code-block :: php
187-
187+
188188 // src/Acme/WebserviceUserBundle/Resources/config/services.php
189189 use Symfony\Component\DependencyInjection\Definition;
190-
190+
191191 $container->setParameter('webservice_user_provider.class', 'Acme\WebserviceUserBundle\Security\User\WebserviceUserProvider');
192-
192+
193193 $container->setDefinition('webservice_user_provider', new Definition('%webservice_user_provider.class%');
194194
195195 .. tip ::
@@ -207,7 +207,7 @@ Modify ``security.yml``
207207-----------------------
208208
209209In ``/app/config/security.yml `` everything comes together. Add the user provider
210- to the list of providers in the "security" section. Choose a name for the user provider
210+ to the list of providers in the "security" section. Choose a name for the user provider
211211(e.g. "webservice") and mention the id of the service you just defined.
212212
213213.. code-block :: yaml
@@ -218,8 +218,8 @@ to the list of providers in the "security" section. Choose a name for the user p
218218 id : webservice_user_provider
219219
220220 Symfony also needs to know how to encode passwords that are supplied by website
221- users, e.g. by filling in a login form. You can do this by adding a line to the
222- "encoders" section in ``/app/config/security.yml ``.
221+ users, e.g. by filling in a login form. You can do this by adding a line to the
222+ "encoders" section in ``/app/config/security.yml ``.
223223
224224.. code-block :: yaml
225225
@@ -241,21 +241,21 @@ options, the password may be encoded multiple times and encoded to base64.
241241 nothing, then the submitted password is simply encoded using the algorithm
242242 you specify in ``security.yml ``. If a salt *is * specified, then the following
243243 value is created and *then * hashed via the algorithm:
244-
244+
245245 ``$password.'{'.$salt.'}'; ``
246246
247247 If your external users have their passwords salted via a different method,
248248 then you'll need to do a bit more work so that Symfony properly encodes
249249 the password. That is beyond the scope of this entry, but would include
250250 sub-classing ``MessageDigestPasswordEncoder `` and overriding the ``mergePasswordAndSalt ``
251251 method.
252-
252+
253253 Additionally, the hash, by default, is encoded multiple times and encoded
254254 to base64. For specific details, see `MessageDigestPasswordEncoder `_.
255255 To prevent this, configure it in ``security.yml ``:
256-
256+
257257 .. code-block :: yaml
258-
258+
259259 security :
260260 encoders :
261261 Acme\WebserviceUserBundle\Security\User\WebserviceUser :
0 commit comments