@@ -16,8 +16,14 @@ passed as a query string parameter or via an HTTP header.
1616The API Key Authenticator
1717-------------------------
1818
19+ .. versionadded :: 2.8
20+ The ``SimplePreAuthenticatorInterface `` interface was moved to the
21+ ``Symfony\Component\Security\Http\Authentication `` namespace in Symfony
22+ 2.8. Prior to 2.8, it was located in the
23+ ``Symfony\Component\Security\Core\Authentication `` namespace.
24+
1925Authenticating a user based on the Request information should be done via a
20- pre-authentication mechanism. The :class: `Symfony\\ Component\\ Security\\ Core \\ Authentication\\ SimplePreAuthenticatorInterface `
26+ pre-authentication mechanism. The :class: `Symfony\\ Component\\ Security\\ Http \\ Authentication\\ SimplePreAuthenticatorInterface `
2127allows you to implement such a scheme really easily.
2228
2329Your exact situation may differ, but in this example, a token is read
@@ -27,13 +33,13 @@ value and then a User object is created::
2733 // src/AppBundle/Security/ApiKeyAuthenticator.php
2834 namespace AppBundle\Security;
2935
30- use Symfony\Component\Security\Core\Authentication\SimplePreAuthenticatorInterface;
36+ use Symfony\Component\HttpFoundation\Request;
37+ use Symfony\Component\Security\Core\Authentication\Token\PreAuthenticatedToken;
3138 use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
3239 use Symfony\Component\Security\Core\Exception\AuthenticationException;
33- use Symfony\Component\Security\Core\Authentication\Token\PreAuthenticatedToken;
34- use Symfony\Component\HttpFoundation\Request;
35- use Symfony\Component\Security\Core\User\UserProviderInterface;
3640 use Symfony\Component\Security\Core\Exception\BadCredentialsException;
41+ use Symfony\Component\Security\Core\User\UserProviderInterface;
42+ use Symfony\Component\Security\Http\Authentication\SimplePreAuthenticatorInterface;
3743
3844 class ApiKeyAuthenticator implements SimplePreAuthenticatorInterface
3945 {
@@ -273,9 +279,9 @@ you can use to create an error ``Response``.
273279 // src/AppBundle/Security/ApiKeyAuthenticator.php
274280 namespace AppBundle\Security;
275281
276- use Symfony\Component\Security\Core\Authentication\SimplePreAuthenticatorInterface;
277282 use Symfony\Component\Security\Core\Exception\AuthenticationException;
278283 use Symfony\Component\Security\Http\Authentication\AuthenticationFailureHandlerInterface;
284+ use Symfony\Component\Security\Http\Authentication\SimplePreAuthenticatorInterface;
279285 use Symfony\Component\HttpFoundation\Response;
280286 use Symfony\Component\HttpFoundation\Request;
281287
@@ -506,8 +512,8 @@ for security reasons. To take advantage of the session, update ``ApiKeyAuthentic
506512to see if the stored token has a valid User object that can be used::
507513
508514 // src/AppBundle/Security/ApiKeyAuthenticator.php
509- // ...
510515
516+ // ...
511517 class ApiKeyAuthenticator implements SimplePreAuthenticatorInterface
512518 {
513519 // ...
0 commit comments