diff options
-rw-r--r-- | application/api/ApiMiddleware.php | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/application/api/ApiMiddleware.php b/application/api/ApiMiddleware.php index f4a71f7c..7f1e7fca 100644 --- a/application/api/ApiMiddleware.php +++ b/application/api/ApiMiddleware.php | |||
@@ -102,16 +102,16 @@ class ApiMiddleware | |||
102 | if (! $request->hasHeader('Authorization') && !isset($this->container->environment['REDIRECT_HTTP_AUTHORIZATION'])) { | 102 | if (! $request->hasHeader('Authorization') && !isset($this->container->environment['REDIRECT_HTTP_AUTHORIZATION'])) { |
103 | throw new ApiAuthorizationException('JWT token not provided'); | 103 | throw new ApiAuthorizationException('JWT token not provided'); |
104 | } | 104 | } |
105 | 105 | ||
106 | if (empty($this->conf->get('api.secret'))) { | 106 | if (empty($this->conf->get('api.secret'))) { |
107 | throw new ApiAuthorizationException('Token secret must be set in Shaarli\'s administration'); | 107 | throw new ApiAuthorizationException('Token secret must be set in Shaarli\'s administration'); |
108 | } | 108 | } |
109 | 109 | ||
110 | if (isset($this->container->environment['REDIRECT_HTTP_AUTHORIZATION'])) { | 110 | if (isset($this->container->environment['REDIRECT_HTTP_AUTHORIZATION'])) { |
111 | $authorization = $this->container->environment['REDIRECT_HTTP_AUTHORIZATION']; | 111 | $authorization = $this->container->environment['REDIRECT_HTTP_AUTHORIZATION']; |
112 | } else { | 112 | } else { |
113 | $authorization = $request->getHeaderLine('Authorization'); | 113 | $authorization = $request->getHeaderLine('Authorization'); |
114 | } | 114 | } |
115 | 115 | ||
116 | if (! preg_match('/^Bearer (.*)/i', $authorization, $matches)) { | 116 | if (! preg_match('/^Bearer (.*)/i', $authorization, $matches)) { |
117 | throw new ApiAuthorizationException('Invalid JWT header'); | 117 | throw new ApiAuthorizationException('Invalid JWT header'); |