oauth2-server/src
Ian Littman 27d5c5ed8d
Ensure unvalidated ClientEntity gets throw/emit if they return null
In many cases, we validate client info before pulling from client itself
from the repository, in which case it's safe to assume that you can grab
the client once validation passes. However on implicit/auth code grants
we don't have this guarantee due to non-confidential clients that just
reference the client ID. In those cases the client may supply a client
ID that doesn't exist, and we don't do a validation step before pulling
it from the repo.

The issue with that is that ClientRepository doesn't actually enforce
returning a ClientInterface via typehint, nor does it even suggest an
exception to throw if the client doesn't exist. So in most places we
do an instanceof check after the repository returns and throw/emit an
error event if the client doesn't exist.

This approach ends up being a bit error-prone; we missed one case where
we should've been doing this check: in the access token request on an
auth code grant. We don't do enough validation beforehand to assume that
the incoming request has an accurate client ID, so L96 could absolutely
be a method call on a non-object.

This commit centralizes the return-check-emit-throw logic so it's a
one-liner for wherever we need it, including the access token request
processor for auth code grants.
2019-05-11 14:35:59 -05:00
..
AuthorizationValidators Fix uncaught exception produced by unsigned token 2018-05-22 14:22:12 +02:00
CodeChallengeVerifiers Add code challenge verifiers 2018-09-17 12:48:32 +01:00
Entities Remove return types 2018-12-19 12:54:26 +00:00
Exception Merge master into version 8 branch 2018-06-24 01:10:02 +01:00
Grant Ensure unvalidated ClientEntity gets throw/emit if they return null 2019-05-11 14:35:59 -05:00
Middleware Updated PHPDoc 2016-07-09 02:01:53 +02:00
Repositories Client says if it is confidential instead of repository 2018-09-01 14:53:27 +01:00
RequestTypes Added null checks before calling set functions 2018-04-21 21:29:21 +01:00
ResponseTypes cleanup DateTime handline 2018-11-08 12:45:18 +01:00
AuthorizationServer.php cleanup DateTime handline 2018-11-08 12:45:18 +01:00
CryptKey.php Allow 640 as key file permisions 2018-06-21 17:02:01 +02:00
CryptTrait.php Add capital letter to start of class doc summary 2018-06-05 10:34:12 +01:00
RequestEvent.php Add new event types: access_token_issued and refresh_token_issued. 2018-02-23 17:48:51 +01:00
ResourceServer.php Static analysis with PHPStan 2018-02-11 22:20:17 +01:00