Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,15 +128,14 @@ And create the service definition, e.g.:
<service id="app.admin.authenticator" class="AppBundle\Security\AdminAuthenticator">
<argument type="service" id="router"/>
<argument type="service" id="ssp.guard.registry"/>
<argument>admin</argument> <!-- this is the authsource id -->
</service>
```

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
Expand Down
15 changes: 5 additions & 10 deletions Security/Authenticator/SSPGuardAuthenticator.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,22 +35,17 @@ abstract class SSPGuardAuthenticator extends AbstractGuardAuthenticator
* @var SSPAuthSource
*/
protected $authSource = null;
/**
* @var
*/
protected $authSourceId;

/**
* SSPGuardAuthenticator constructor.
*
* @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;
}

/**
Expand All @@ -59,16 +54,16 @@ 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'];
}

/**
* {@inheritdoc}
*/
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();
}
Expand Down Expand Up @@ -112,4 +107,4 @@ public function supportsRememberMe()
{
return true;
}
}
}