Skip to content

Commit

Permalink
Added $mustValidateSecret parameter to ClientRepositoryInterface:: ge…
Browse files Browse the repository at this point in the history
…tClientEntity(). Fixes #550
  • Loading branch information
alexbilbie committed Apr 18, 2016
1 parent 5b192b3 commit fb8f47e
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
3 changes: 2 additions & 1 deletion src/Grant/AbstractGrant.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,8 @@ protected function validateClient(ServerRequestInterface $request)
$client = $this->clientRepository->getClientEntity(
$clientId,
$this->getIdentifier(),
$clientSecret
$clientSecret,
true
);

if (!$client instanceof ClientEntityInterface) {
Expand Down
4 changes: 3 additions & 1 deletion src/Grant/AuthCodeGrant.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,9 @@ public function validateAuthorizationRequest(ServerRequestInterface $request)

$client = $this->clientRepository->getClientEntity(
$clientId,
$this->getIdentifier()
$this->getIdentifier(),
null,
false
);

if ($client instanceof ClientEntityInterface === false) {
Expand Down
4 changes: 3 additions & 1 deletion src/Grant/ImplicitGrant.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,9 @@ public function validateAuthorizationRequest(ServerRequestInterface $request)

$client = $this->clientRepository->getClientEntity(
$clientId,
$this->getIdentifier()
$this->getIdentifier(),
null,
false
);

if ($client instanceof ClientEntityInterface === false) {
Expand Down
10 changes: 6 additions & 4 deletions src/Repositories/ClientRepositoryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@ interface ClientRepositoryInterface extends RepositoryInterface
/**
* Get a client.
*
* @param string $clientIdentifier The client's identifier
* @param string $grantType The grant type used
* @param null|string $clientSecret The client's secret (if sent)
* @param string $clientIdentifier The client's identifier
* @param string $grantType The grant type used
* @param null|string $clientSecret The client's secret (if sent)
* @param bool $mustValidateSecret If true the client must attempt to validate the secret unless the client
* is confidential
*
* @return \League\OAuth2\Server\Entities\ClientEntityInterface
*/
public function getClientEntity($clientIdentifier, $grantType, $clientSecret = null);
public function getClientEntity($clientIdentifier, $grantType, $clientSecret = null, $mustValidateSecret = true);
}

0 comments on commit fb8f47e

Please sign in to comment.