File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -61,6 +61,7 @@ public function init()
61
61
->addHeader ("Content-type " , "application/json " );
62
62
}
63
63
64
+
64
65
public function index ()
65
66
{
66
67
return $ this ->httpError (400 , 'Bad Request ' );
@@ -234,10 +235,10 @@ public function getAuthorizationHeader(): string
234
235
{
235
236
$ header = '' ;
236
237
237
- if (isset ( $ _SERVER [ 'Authorization ' ] )) {
238
- $ header = trim ($ _SERVER [ " Authorization " ] );
239
- } elseif (isset ( $ _SERVER [ 'HTTP_AUTHORIZATION ' ] )) {
240
- $ header = trim ($ _SERVER [ " HTTP_AUTHORIZATION " ] );
238
+ if ($ auth = $ this -> getRequest ()-> getHeader ( 'Authorization ' )) {
239
+ $ header = trim ($ auth );
240
+ } elseif ($ auth = $ this -> getRequest ()-> getHeader ( 'HTTP_AUTHORIZATION ' )) {
241
+ $ header = trim ($ auth );
241
242
} elseif (function_exists ('apache_request_headers ' )) {
242
243
$ requestHeaders = apache_request_headers ();
243
244
$ requestHeaders = array_combine (array_map ('ucwords ' , array_keys ($ requestHeaders )), array_values ($ requestHeaders ));
@@ -250,6 +251,11 @@ public function getAuthorizationHeader(): string
250
251
return $ header ;
251
252
}
252
253
254
+ /**
255
+ * Returns the bearer token value from the Authorization Header
256
+ *
257
+ * @return string
258
+ */
253
259
public function getBearerToken (): string
254
260
{
255
261
$ headers = $ this ->getAuthorizationHeader ();
You can’t perform that action at this time.
0 commit comments