CSteipp has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/73522


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, 14 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/OAuth 
refs/changes/22/73522/1

diff --git a/backend/MWOAuthUtils.php b/backend/MWOAuthUtils.php
index bc35967..7d2eb76 100644
--- a/backend/MWOAuthUtils.php
+++ b/backend/MWOAuthUtils.php
@@ -73,6 +73,20 @@
        }
 
        /**
+        * 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 ) {
+               $request = RequestContext::getMain()->getRequest();
+               $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: newchange
Gerrit-Change-Id: I62cd6dda74faab63181e8b38e46da52ba2058256
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/OAuth
Gerrit-Branch: master
Gerrit-Owner: CSteipp <[email protected]>

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

Reply via email to