Aaron Schulz has submitted this change and it was merged.
Change subject: Prevent CentralAuth tokens if OAuth is used
......................................................................
Prevent CentralAuth tokens if OAuth is used
Prevent OAuth requests from asking for a centralauthtoken
Depends on I929967b707dc8f6f817cf35ff980b3ab42186126
Change-Id: Icd3c80e1c9f4f2404ac140b5c137d4142c479859
---
M api/MWOAuthAPI.setup.php
1 file changed, 14 insertions(+), 0 deletions(-)
Approvals:
Aaron Schulz: Verified; Looks good to me, approved
diff --git a/api/MWOAuthAPI.setup.php b/api/MWOAuthAPI.setup.php
index c8fb174..0af2377 100644
--- a/api/MWOAuthAPI.setup.php
+++ b/api/MWOAuthAPI.setup.php
@@ -17,6 +17,7 @@
$wgHooks['UserIsEveryoneAllowed'][] = __CLASS__ .
'::onUserIsEveryoneAllowed';
$wgHooks['ApiCheckCanExecute'][] = __CLASS__ .
'::onApiCheckCanExecute';
$wgHooks['RecentChange_save'][] = __CLASS__ .
'::onRecentChange_save';
+ $wgHooks['CentralAuthAbortCentralAuthToken'][] = __CLASS__ .
'::onCentralAuthAbortCentralAuthToken';
}
/**
@@ -246,4 +247,17 @@
}
return true;
}
+
+ /**
+ * Prevent CentralAuth from issuing centralauthtokens if we have
+ * OAuth headers in this request.
+ * @return boolean
+ */
+ public static function onCentralAuthAbortCentralAuthToken() {
+ $request = RequestContext::getMain()->getRequest();
+ if ( MWOAuthUtils::hasOAuthHeaders( $request ) ) {
+ return false;
+ }
+ return true;
+ }
}
--
To view, visit https://gerrit.wikimedia.org/r/79441
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Icd3c80e1c9f4f2404ac140b5c137d4142c479859
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]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits