aboutsummaryrefslogtreecommitdiff
path: root/lib/tokenstorage.php
diff options
context:
space:
mode:
authorChristian Weiske <cweiske@cweiske.de>2014-09-26 14:32:03 +0200
committerChristian Weiske <cweiske@cweiske.de>2014-09-26 14:32:03 +0200
commit9a1ac6227c65296a4751c3e601cc1eb47398a77e (patch)
treec162acd7338c62a9c939eadcf17710b16b64b81a /lib/tokenstorage.php
parent21e7415fe5a418ef6dd7f29d3749b11cc9adaa7d (diff)
downloadgrauphel-9a1ac6227c65296a4751c3e601cc1eb47398a77e.tar.gz
grauphel-9a1ac6227c65296a4751c3e601cc1eb47398a77e.zip
Send HTTP 401 on invalid token
Diffstat (limited to 'lib/tokenstorage.php')
-rw-r--r--lib/tokenstorage.php7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/tokenstorage.php b/lib/tokenstorage.php
index f8f0806..4b5f420 100644
--- a/lib/tokenstorage.php
+++ b/lib/tokenstorage.php
@@ -95,12 +95,15 @@ class TokenStorage
)->fetchRow();
if ($tokenRow === false) {
- throw new OAuthException('Unknown token: ' . $type . ' / ' . $tokenKey);
+ throw new OAuthException(
+ 'Unknown token: ' . $type . ' / ' . $tokenKey,
+ OAUTH_TOKEN_REJECTED
+ );
}
$token = $this->fromDb($tokenRow);
if ($token->tokenKey != $tokenKey) {
- throw new OAuthException('Invalid token');
+ throw new OAuthException('Invalid token', OAUTH_TOKEN_REJECTED);
}
return $token;