Skip to content

Commit c73c32e

Browse files
committed
Thanks fabbot!
1 parent 6c180c7 commit c73c32e

File tree

10 files changed

+67
-57
lines changed

10 files changed

+67
-57
lines changed

src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/GuardAuthenticationFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
use Symfony\Component\DependencyInjection\Reference;
99

1010
/**
11-
* Configures the "guard" authentication provider key under a firewall
11+
* Configures the "guard" authentication provider key under a firewall.
1212
*
1313
* @author Ryan Weaver <weaverryan@gmail.com>
1414
*/

src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Security/Factory/GuardAuthenticationFactoryTest.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,13 @@ public function getValidConfigurationTests()
5959
array(
6060
'authenticators' => array('authenticator1', 'authenticator2'),
6161
'provider' => 'some_provider',
62-
'entry_point' => 'the_entry_point'
62+
'entry_point' => 'the_entry_point',
6363
),
6464
array(
6565
'authenticators' => array('authenticator1', 'authenticator2'),
6666
'provider' => 'some_provider',
67-
'entry_point' => 'the_entry_point'
68-
)
67+
'entry_point' => 'the_entry_point',
68+
),
6969
);
7070

7171
// testing xml config fix: authenticator -> authenticators
@@ -76,7 +76,7 @@ public function getValidConfigurationTests()
7676
array(
7777
'authenticators' => array('authenticator1', 'authenticator2'),
7878
'entry_point' => null,
79-
)
79+
),
8080
);
8181

8282
return $tests;
@@ -88,7 +88,7 @@ public function getInvalidConfigurationTests()
8888

8989
// testing not empty
9090
$tests[] = array(
91-
array('authenticators' => array())
91+
array('authenticators' => array()),
9292
);
9393

9494
return $tests;
@@ -108,7 +108,7 @@ public function testBasicCreate()
108108
$this->assertEquals(array(
109109
'index_0' => array(new Reference('authenticator123')),
110110
'index_1' => new Reference('my_user_provider'),
111-
'index_2' => 'my_firewall'
111+
'index_2' => 'my_firewall',
112112
), $providerDefinition->getArguments());
113113

114114
$listenerDefinition = $container->getDefinition('security.authentication.listener.guard.my_firewall');
@@ -153,7 +153,6 @@ public function testMultipleAuthenticatorsRequiresEntryPoint()
153153
$this->executeCreate($config, null);
154154
}
155155

156-
157156
public function testCreateWithEntryPoint()
158157
{
159158
// any existing default entry point is used

src/Symfony/Component/Security/Guard/AbstractGuardAuthenticator.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,19 @@
66
use Symfony\Component\Security\Guard\Token\PostAuthenticationGuardToken;
77

88
/**
9-
* An optional base class that creates a PostAuthenticationGuardToken for you
9+
* An optional base class that creates a PostAuthenticationGuardToken for you.
1010
*
1111
* @author Ryan Weaver <weaverryan@gmail.com>
1212
*/
1313
abstract class AbstractGuardAuthenticator implements GuardAuthenticatorInterface
1414
{
1515
/**
1616
* Shortcut to create a PostAuthenticationGuardToken for you, if you don't really
17-
* care about which authenticated token you're using
17+
* care about which authenticated token you're using.
1818
*
1919
* @param UserInterface $user
20-
* @param string $providerKey
20+
* @param string $providerKey
21+
*
2122
* @return PostAuthenticationGuardToken
2223
*/
2324
public function createAuthenticatedToken(UserInterface $user, $providerKey)

src/Symfony/Component/Security/Guard/Firewall/GuardAuthenticationListener.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
use Symfony\Component\Security\Http\RememberMe\RememberMeServicesInterface;
1717

1818
/**
19-
* Authentication listener for the "guard" system
19+
* Authentication listener for the "guard" system.
2020
*
2121
* @author Ryan Weaver <weaverryan@gmail.com>
2222
*/
@@ -30,11 +30,11 @@ class GuardAuthenticationListener implements ListenerInterface
3030
private $rememberMeServices;
3131

3232
/**
33-
* @param GuardAuthenticatorHandler $guardHandler The Guard handler
34-
* @param AuthenticationManagerInterface $authenticationManager An AuthenticationManagerInterface instance
35-
* @param string $providerKey The provider (i.e. firewall) key
36-
* @param GuardAuthenticatorInterface[] $guardAuthenticators The authenticators, with keys that match what's passed to GuardAuthenticationProvider
37-
* @param LoggerInterface $logger A LoggerInterface instance
33+
* @param GuardAuthenticatorHandler $guardHandler The Guard handler
34+
* @param AuthenticationManagerInterface $authenticationManager An AuthenticationManagerInterface instance
35+
* @param string $providerKey The provider (i.e. firewall) key
36+
* @param GuardAuthenticatorInterface[] $guardAuthenticators The authenticators, with keys that match what's passed to GuardAuthenticationProvider
37+
* @param LoggerInterface $logger A LoggerInterface instance
3838
*/
3939
public function __construct(GuardAuthenticatorHandler $guardHandler, AuthenticationManagerInterface $authenticationManager, $providerKey, $guardAuthenticators, LoggerInterface $logger = null)
4040
{
@@ -50,7 +50,7 @@ public function __construct(GuardAuthenticatorHandler $guardHandler, Authenticat
5050
}
5151

5252
/**
53-
* Iterates over each authenticator to see if each wants to authenticate the request
53+
* Iterates over each authenticator to see if each wants to authenticate the request.
5454
*
5555
* @param GetResponseEvent $event
5656
*/
@@ -147,12 +147,12 @@ public function setRememberMeServices(RememberMeServicesInterface $rememberMeSer
147147

148148
/**
149149
* Checks to see if remember me is supported in the authenticator and
150-
* on the firewall. If it is, the RememberMeServicesInterface is notified
150+
* on the firewall. If it is, the RememberMeServicesInterface is notified.
151151
*
152152
* @param GuardAuthenticatorInterface $guardAuthenticator
153-
* @param Request $request
154-
* @param TokenInterface $token
155-
* @param Response $response
153+
* @param Request $request
154+
* @param TokenInterface $token
155+
* @param Response $response
156156
*/
157157
private function triggerRememberMe(GuardAuthenticatorInterface $guardAuthenticator, Request $request, TokenInterface $token, Response $response = null)
158158
{

src/Symfony/Component/Security/Guard/GuardAuthenticatorHandler.php

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
use Symfony\Component\Security\Http\SecurityEvents;
1414

1515
/**
16-
* A utility class that does much of the *work* during the guard authentication process
16+
* A utility class that does much of the *work* during the guard authentication process.
1717
*
1818
* By having the logic here instead of the listener, more of the process
1919
* can be called directly (e.g. for manual authentication) or overridden.
@@ -33,10 +33,10 @@ public function __construct(TokenStorageInterface $tokenStorage, EventDispatcher
3333
}
3434

3535
/**
36-
* Authenticates the given token in the system
36+
* Authenticates the given token in the system.
3737
*
3838
* @param TokenInterface $token
39-
* @param Request $request
39+
* @param Request $request
4040
*/
4141
public function authenticateWithToken(TokenInterface $token, Request $request)
4242
{
@@ -49,12 +49,13 @@ public function authenticateWithToken(TokenInterface $token, Request $request)
4949
}
5050

5151
/**
52-
* Returns the "on success" response for the given GuardAuthenticator
52+
* Returns the "on success" response for the given GuardAuthenticator.
5353
*
54-
* @param TokenInterface $token
55-
* @param Request $request
54+
* @param TokenInterface $token
55+
* @param Request $request
5656
* @param GuardAuthenticatorInterface $guardAuthenticator
57-
* @param string $providerKey The provider (i.e. firewall) key
57+
* @param string $providerKey The provider (i.e. firewall) key
58+
*
5859
* @return null|Response
5960
*/
6061
public function handleAuthenticationSuccess(TokenInterface $token, Request $request, GuardAuthenticatorInterface $guardAuthenticator, $providerKey)
@@ -75,12 +76,13 @@ public function handleAuthenticationSuccess(TokenInterface $token, Request $requ
7576

7677
/**
7778
* Convenience method for authenticating the user and returning the
78-
* Response *if any* for success
79+
* Response *if any* for success.
7980
*
80-
* @param UserInterface $user
81-
* @param Request $request
81+
* @param UserInterface $user
82+
* @param Request $request
8283
* @param GuardAuthenticatorInterface $authenticator
83-
* @param string $providerKey The provider (i.e. firewall) key
84+
* @param string $providerKey The provider (i.e. firewall) key
85+
*
8486
* @return Response|null
8587
*/
8688
public function authenticateUserAndHandleSuccess(UserInterface $user, Request $request, GuardAuthenticatorInterface $authenticator, $providerKey)
@@ -96,11 +98,12 @@ public function authenticateUserAndHandleSuccess(UserInterface $user, Request $r
9698

9799
/**
98100
* Handles an authentication failure and returns the Response for the
99-
* GuardAuthenticator
101+
* GuardAuthenticator.
100102
*
101-
* @param AuthenticationException $authenticationException
102-
* @param Request $request
103+
* @param AuthenticationException $authenticationException
104+
* @param Request $request
103105
* @param GuardAuthenticatorInterface $guardAuthenticator
106+
*
104107
* @return null|Response
105108
*/
106109
public function handleAuthenticationFailure(AuthenticationException $authenticationException, Request $request, GuardAuthenticatorInterface $guardAuthenticator)

src/Symfony/Component/Security/Guard/GuardAuthenticatorInterface.php

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
use Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface;
1313

1414
/**
15-
* The interface for all "guard" authenticators
15+
* The interface for all "guard" authenticators.
1616
*
1717
* The methods on this interface are called throughout the guard authentication
1818
* process to give you the power to control most parts of the process from
@@ -41,48 +41,54 @@ interface GuardAuthenticatorInterface extends AuthenticationEntryPointInterface
4141
* return array('api_key' => $request->headers->get('X-API-TOKEN'));
4242
*
4343
* @param Request $request
44+
*
4445
* @return mixed|null
4546
*/
4647
public function getCredentialsFromRequest(Request $request);
4748

4849
/**
4950
* Return a UserInterface object based on the credentials OR throw
50-
* an AuthenticationException
51+
* an AuthenticationException.
5152
*
5253
* The *credentials* are the return value from getCredentialsFromRequest()
5354
*
54-
* @param mixed $credentials
55+
* @param mixed $credentials
5556
* @param UserProviderInterface $userProvider
57+
*
5658
* @throws AuthenticationException
59+
*
5760
* @return UserInterface
5861
*/
5962
public function authenticate($credentials, UserProviderInterface $userProvider);
6063

6164
/**
62-
* Create an authenticated token for the given user
65+
* Create an authenticated token for the given user.
6366
*
6467
* If you don't care about which token class is used or don't really
6568
* understand what a "token" is, you can skip this method by extending
6669
* the AbstractGuardAuthenticator class from your authenticator.
6770
*
6871
* @see AbstractGuardAuthenticator
72+
*
6973
* @param UserInterface $user
70-
* @param string $providerKey The provider (i.e. firewall) key
74+
* @param string $providerKey The provider (i.e. firewall) key
75+
*
7176
* @return GuardTokenInterface
7277
*/
7378
public function createAuthenticatedToken(UserInterface $user, $providerKey);
7479

7580
/**
76-
* Called when authentication executed, but failed (e.g. wrong username password)
81+
* Called when authentication executed, but failed (e.g. wrong username password).
7782
*
7883
* This should return the Response sent back to the user, like a
7984
* RedirectResponse to the login page or a 403 response.
8085
*
8186
* If you return null, the request will continue, but the user will
8287
* not be authenticated. This is probably not what you want to do.
8388
*
84-
* @param Request $request
89+
* @param Request $request
8590
* @param AuthenticationException $exception
91+
*
8692
* @return Response|null
8793
*/
8894
public function onAuthenticationFailure(Request $request, AuthenticationException $exception);
@@ -96,9 +102,10 @@ public function onAuthenticationFailure(Request $request, AuthenticationExceptio
96102
* If you return null, the current request will continue, and the user
97103
* will be authenticated. This makes sense, for example, with an API.
98104
*
99-
* @param Request $request
105+
* @param Request $request
100106
* @param TokenInterface $token
101-
* @param string $providerKey The provider (i.e. firewall) key
107+
* @param string $providerKey The provider (i.e. firewall) key
108+
*
102109
* @return Response|null
103110
*/
104111
public function onAuthenticationSuccess(Request $request, TokenInterface $token, $providerKey);

src/Symfony/Component/Security/Guard/Provider/GuardAuthenticationProvider.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
use Symfony\Component\Security\Core\Authentication\Provider\AuthenticationProviderInterface;
66
use Symfony\Component\Security\Core\Authentication\Token\AnonymousToken;
7-
use Symfony\Component\Security\Core\Exception\AuthenticationException;
87
use Symfony\Component\Security\Guard\GuardAuthenticatorInterface;
98
use Symfony\Component\Security\Guard\Token\GuardTokenInterface;
109
use Symfony\Component\Security\Guard\Token\PreAuthenticationGuardToken;
@@ -15,7 +14,7 @@
1514

1615
/**
1716
* Responsible for accepting the PreAuthenticationGuardToken and calling
18-
* the correct authenticator to retrieve the authenticated token
17+
* the correct authenticator to retrieve the authenticated token.
1918
*
2019
* @author Ryan Weaver <weaverryan@gmail.com>
2120
*/
@@ -30,10 +29,10 @@ class GuardAuthenticationProvider implements AuthenticationProviderInterface
3029
private $userChecker;
3130

3231
/**
33-
* @param GuardAuthenticatorInterface[] $guardAuthenticators The authenticators, with keys that match what's passed to GuardAuthenticationListener
34-
* @param UserProviderInterface $userProvider The user provider
35-
* @param string $providerKey The provider (i.e. firewall) key
36-
* @param UserCheckerInterface $userChecker
32+
* @param GuardAuthenticatorInterface[] $guardAuthenticators The authenticators, with keys that match what's passed to GuardAuthenticationListener
33+
* @param UserProviderInterface $userProvider The user provider
34+
* @param string $providerKey The provider (i.e. firewall) key
35+
* @param UserCheckerInterface $userChecker
3736
*/
3837
public function __construct(array $guardAuthenticators, UserProviderInterface $userProvider, $providerKey, UserCheckerInterface $userChecker)
3938
{
@@ -44,9 +43,10 @@ public function __construct(array $guardAuthenticators, UserProviderInterface $u
4443
}
4544

4645
/**
47-
* Finds the correct authenticator for the token and calls it
46+
* Finds the correct authenticator for the token and calls it.
4847
*
4948
* @param GuardTokenInterface $token
49+
*
5050
* @return TokenInterface
5151
*/
5252
public function authenticate(TokenInterface $token)
@@ -66,7 +66,7 @@ public function authenticate(TokenInterface $token)
6666
*/
6767

6868
// this should never happen - but technically, the token is
69-
// authenticated... so it could jsut be returned
69+
// authenticated... so it could just be returned
7070
if ($token->isAuthenticated()) {
7171
return $token;
7272
}
@@ -106,7 +106,7 @@ private function authenticateViaGuard(GuardAuthenticatorInterface $guardAuthenti
106106
}
107107

108108
// check the AdvancedUserInterface methods!
109-
$this->userChecker->checkPreAuth($user);;
109+
$this->userChecker->checkPreAuth($user);
110110
$this->userChecker->checkPostAuth($user);
111111

112112
// turn the UserInterface into a TokenInterface

src/Symfony/Component/Security/Guard/Token/GuardTokenInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace Symfony\Component\Security\Guard\Token;
44

55
/**
6-
* An empty interface that both guard tokens implement
6+
* An empty interface that both guard tokens implement.
77
*
88
* This interface is used by the GuardAuthenticationProvider to know
99
* that a token belongs to its system.

src/Symfony/Component/Security/Guard/Token/PreAuthenticationGuardToken.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use Symfony\Component\Security\Core\Authentication\Token\AbstractToken;
66

77
/**
8-
* The token used by the guard auth system before authentication
8+
* The token used by the guard auth system before authentication.
99
*
1010
* The GuardAuthenticationListener creates this, which is then consumed
1111
* immediately by the GuardAuthenticationProvider. If authentication is

src/Symfony/Component/Security/Http/EntryPoint/AuthenticationEntryPointInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
interface AuthenticationEntryPointInterface
2525
{
2626
/**
27-
* Returns a response that directs the user to authenticate
27+
* Returns a response that directs the user to authenticate.
2828
*
2929
* This is called when an anonymous request accesses a resource that
3030
* requires authentication. The job of this method is to return some

0 commit comments

Comments
 (0)