Aaron Schulz has submitted this change and it was merged.

Change subject: Add MWOAuthUtils::newMWOAuthServer()
......................................................................


Add MWOAuthUtils::newMWOAuthServer()

to quickly get a new server with all the default configs

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

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



diff --git a/backend/MWOAuthUtils.php b/backend/MWOAuthUtils.php
index ef8e3d5..4b121d9 100644
--- a/backend/MWOAuthUtils.php
+++ b/backend/MWOAuthUtils.php
@@ -185,4 +185,18 @@
 
                return true;
        }
+
+       /**
+        * Quickly get a new server with all the default configurations
+        * @return MWOAuthServer with default configurations
+        */
+       public static function newMWOAuthServer() {
+               global $wgMemc;
+               $dbr = MWOAuthUtils::getCentralDB( DB_SLAVE );
+               $store = new MWOAuthDataStore( $wgMemc, $dbr );
+               $server = new MWOAuthServer( $store );
+               $server->add_signature_method( new 
OAuthSignatureMethod_HMAC_SHA1() );
+               $server->add_signature_method( new 
MWOAuthSignatureMethod_RSA_SHA1( $store ) );
+               return $server;
+       }
 }

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

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

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

Reply via email to