Aaron Schulz has submitted this change and it was merged.

Change subject: Add util function to detect Authorization header
......................................................................


Add util function to detect Authorization header

Static utility function to detect if an Authorization header was passed
in with the request.

Change-Id: I62cd6dda74faab63181e8b38e46da52ba2058256
---
M backend/MWOAuthUtils.php
1 file changed, 13 insertions(+), 0 deletions(-)

Approvals:
  Aaron Schulz: Verified; Looks good to me, approved



diff --git a/backend/MWOAuthUtils.php b/backend/MWOAuthUtils.php
index bc35967..9d7cd79 100644
--- a/backend/MWOAuthUtils.php
+++ b/backend/MWOAuthUtils.php
@@ -73,6 +73,19 @@
        }
 
        /**
+        * Test this request for an OAuth Authorization header
+        * @param WebRequest $request the MediaWiki request
+        * @return Boolean (true if a header was found)
+        */
+       public static function hasOAuthHeaders( WebRequest $request ) {
+               $header = $request->getHeader( 'Authorization' );
+               if ( $header !== false && substr( $header, 0, 6 ) == 'OAuth ' ) 
{
+                       return true;
+               }
+               return false;
+       }
+
+       /**
         * Make a cache key for the given arguments, that (hopefully) won't 
clash with
         * anything else in your cache
         */

-- 
To view, visit https://gerrit.wikimedia.org/r/73522
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I62cd6dda74faab63181e8b38e46da52ba2058256
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/OAuth
Gerrit-Branch: master
Gerrit-Owner: CSteipp <[email protected]>
Gerrit-Reviewer: Aaron Schulz <[email protected]>
Gerrit-Reviewer: Anomie <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to