diff --git a/README.md b/README.md index 0b068a5..465eb51 100644 --- a/README.md +++ b/README.md @@ -128,7 +128,6 @@ And create the service definition, e.g.: - admin ``` @@ -136,7 +135,7 @@ or in `app/config/services.yml`: ```yml AppBundle\Security\AdminAuthenticator: - arguments: ["@router", "@ssp.guard.registry", "admin"] + arguments: ["@router", "@ssp.guard.registry"] ``` ### Step 6: Create a custom User Provider diff --git a/Security/Authenticator/SSPGuardAuthenticator.php b/Security/Authenticator/SSPGuardAuthenticator.php index a7dcb12..ed92767 100644 --- a/Security/Authenticator/SSPGuardAuthenticator.php +++ b/Security/Authenticator/SSPGuardAuthenticator.php @@ -35,10 +35,6 @@ abstract class SSPGuardAuthenticator extends AbstractGuardAuthenticator * @var SSPAuthSource */ protected $authSource = null; - /** - * @var - */ - protected $authSourceId; /** * SSPGuardAuthenticator constructor. @@ -46,11 +42,10 @@ abstract class SSPGuardAuthenticator extends AbstractGuardAuthenticator * @param Router $router * @param AuthSourceRegistry $authSourceRegistry */ - public function __construct(Router $router, AuthSourceRegistry $authSourceRegistry, $authSourceId) + public function __construct(Router $router, AuthSourceRegistry $authSourceRegistry) { $this->router = $router; $this->authSourceRegistry = $authSourceRegistry; - $this->authSourceId = $authSourceId; } /** @@ -59,8 +54,7 @@ public function __construct(Router $router, AuthSourceRegistry $authSourceRegist public function supports(Request $request) { $match = $this->router->match($request->getPathInfo()); - return 'ssp_guard_check' === $match['_route'] && - $this->authSourceId === $match['authSource']; + return 'ssp_guard_check' === $match['_route']; } /** @@ -68,7 +62,8 @@ public function supports(Request $request) */ public function getCredentials(Request $request) { - $this->authSource = $this->authSourceRegistry->getAuthSource($this->authSourceId); + $match = $this->router->match($request->getPathInfo()); + $this->authSource = $this->authSourceRegistry->getAuthSource($match['authSource']); return $this->authSource->getCredentials(); } @@ -112,4 +107,4 @@ public function supportsRememberMe() { return true; } -} \ No newline at end of file +}