Skip to content

Commit 2336c3c

Browse files
committed
Document the authorization header method
1 parent ae153c1 commit 2336c3c

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

lib/class-wp-json-authentication-oauth1.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,16 @@ public function parse_header( $header ) {
6060

6161
}
6262

63+
/**
64+
* Get the authorization header
65+
*
66+
* On certain systems and configurations, the Authorization header will be
67+
* stripped out by the server or PHP. Typically this is then used to
68+
* generate `PHP_AUTH_USER`/`PHP_AUTH_PASS` but not passed on. We use
69+
* `getallheaders` here to try and grab it out instead.
70+
*
71+
* @return string|null Authorization header if set, null otherwise
72+
*/
6373
public function get_authorization_header() {
6474
if ( ! empty( $_SERVER['HTTP_AUTHORIZATION'] ) ) {
6575
return wp_unslash( $_SERVER['HTTP_AUTHORIZATION'] );

0 commit comments

Comments
 (0)