diff --git a/AuthRemoteuser.body.php b/AuthRemoteuser.body.php new file mode 100644 index 0000000000000000000000000000000000000000..1c639776445ff6e31f839d0629f00f7c6578cb68 --- /dev/null +++ b/AuthRemoteuser.body.php @@ -0,0 +1,220 @@ +<?php +/** + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * http://www.gnu.org/copyleft/gpl.html + * + * @file + */ + +use MediaWiki\Session\SessionInfo; +use MediaWiki\Session\UserInfo; + +/** + * Session provider for apache/authz authenticated users. + * + * Class AuthRemoteuser + */ +class AuthRemoteuser extends MediaWiki\Session\ImmutableSessionProviderWithCookie { + + /** + * @param array $params Keys include: + * - priority: (required) Set the priority + * - sessionCookieName: Session cookie name. Default is '_AuthRemoteuserSession'. + * - sessionCookieOptions: Options to pass to WebResponse::setCookie(). + */ + public function __construct(array $params = []) { + if (!isset($params['sessionCookieName'])) { + $params['sessionCookieName'] = '_AuthRemoteuserSession'; + } + parent::__construct( $params ); + + if ( !isset( $params['priority'] ) ) { + throw new \InvalidArgumentException(__METHOD__ . ': priority must be specified'); + } + if ($params['priority'] < SessionInfo::MIN_PRIORITY || + $params['priority'] > SessionInfo::MAX_PRIORITY + ) { + throw new \InvalidArgumentException(__METHOD__ . ': Invalid priority'); + } + + $this->priority = $params['priority']; + } + + /** + * @inheritDoc + */ + public function provideSessionInfo(WebRequest $request) + { + // Have a session ID? + $id = $this->getSessionIdFromCookie($request); + if (null === $id) { + $username = $this->getRemoteUsername(); + $sessionInfo = $this->newSessionForRequest($username, $request); + + return $sessionInfo; + } + + $sessionInfo = new SessionInfo($this->priority, [ + 'provider' => $this, + 'id' => $id, + 'persisted' => true + ]); + + return $sessionInfo; + } + + /** + * @inheritDoc + */ + public function newSessionInfo($id = null) + { + return null; + } + + /** + * @param $username + * @param WebRequest $request + * @return SessionInfo + */ + protected function newSessionForRequest($username, WebRequest $request) + { + $id = $this->getSessionIdFromCookie($request); + + $user = User::newFromName($username, 'usable'); + if (!$user) { + throw new \InvalidArgumentException('Invalid user name'); + } + + $this->initUser($user, $username); + + $info = new SessionInfo(SessionInfo::MAX_PRIORITY, [ + 'provider' => $this, + 'id' => $id, + 'userInfo' => UserInfo::newFromUser($user, true), + 'persisted' => false + ]); + $session = $this->getManager()->getSessionFromInfo($info, $request); + $session->persist(); + + return $info; + } + + /** + * When creating a user account, optionally fill in + * preferences and such. For instance, you might pull the + * email address or real name from the external user database. + * + * @param $user User object. + * @param $autocreate bool + */ + protected function initUser(&$user, $username) + { + if (Hooks::run("AuthRemoteUserInitUser", + array($user, true)) + ) { + $this->setRealName($user); + + $this->setEmail($user, $username); + + $user->mEmailAuthenticated = wfTimestampNow(); + $user->setToken(); + + $this->setNotifications($user); + } + + $user->saveSettings(); + } + + /** + * Sets the real name of the user. + * + * @param User + */ + protected function setRealName(User $user) + { + global $wgAuthRemoteuserName; + + if ($wgAuthRemoteuserName) { + $user->setRealName($wgAuthRemoteuserName); + } else { + $user->setRealName(''); + } + } + + /** + * Return the username to be used. Empty string if none. + * + * @return string + */ + protected function getRemoteUsername() + { + global $wgAuthRemoteuserDomain; + + if (isset($_SERVER['REMOTE_USER'])) { + $username = $_SERVER['REMOTE_USER']; + + if ($wgAuthRemoteuserDomain) { + $username = str_replace("$wgAuthRemoteuserDomain\\", + "", $username); + $username = str_replace("@$wgAuthRemoteuserDomain", + "", $username); + } + } else { + $username = ""; + } + + return $username; + } + + /** + * Sets the email address of the user. + * + * @param User + * @param String username + */ + protected function setEmail(User $user, $username) + { + global $wgAuthRemoteuserMail, $wgAuthRemoteuserMailDomain; + + if ($wgAuthRemoteuserMail) { + $user->setEmail($wgAuthRemoteuserMail); + } elseif ($wgAuthRemoteuserMailDomain) { + $user->setEmail($username . '@' . + $wgAuthRemoteuserMailDomain); + } else { + $user->setEmail($username . "@example.com"); + } + } + + /** + * Set up notifications for the user. + * + * @param User + */ + protected function setNotifications(User $user) + { + global $wgAuthRemoteuserNotify; + + // turn on e-mail notifications + if ($wgAuthRemoteuserNotify) { + $user->setOption('enotifwatchlistpages', 1); + $user->setOption('enotifusertalkpages', 1); + $user->setOption('enotifminoredits', 1); + $user->setOption('enotifrevealaddr', 1); + } + } + + +} \ No newline at end of file diff --git a/AuthRemoteuser.php b/AuthRemoteuser.php new file mode 100644 index 0000000000000000000000000000000000000000..16245ba8eedb6f6698b2ab2dc82cfd18caabcdaf --- /dev/null +++ b/AuthRemoteuser.php @@ -0,0 +1,11 @@ +<?php + +$wgAuthRemoteuserName = isset( $_SERVER["AUTHENTICATE_CN"] ) + ? $_SERVER["AUTHENTICATE_CN"] + : ''; + +/* User's Mail */ +$wgAuthRemoteuserMail = isset( $_SERVER["AUTHENTICATE_MAIL"] ) + ? $_SERVER["AUTHENTICATE_MAIL"] + : ''; + diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 8dada3edaf50dbc082c9a125058f25def75e625a..0000000000000000000000000000000000000000 --- a/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright {yyyy} {name of copyright owner} - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000000000000000000000000000000000000..94932a973dba383afd47e4683107f05bd0d87b84 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,223 @@ +# GNU GENERAL PUBLIC LICENSE # +## TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION ## + +- *0\.* This License applies to any program or other work which contains + a notice placed by the copyright holder saying it may be distributed + under the terms of this General Public License. The "Program", below, + refers to any such program or work, and a "work based on the Program" + means either the Program or any derivative work under copyright law: + that is to say, a work containing the Program or a portion of it, + either verbatim or with modifications and/or translated into another + language. (Hereinafter, translation is included without limitation in + the term "modification".) Each licensee is addressed as "you". + + Activities other than copying, distribution and modification are not + covered by this License; they are outside its scope. The act of + running the Program is not restricted, and the output from the Program + is covered only if its contents constitute a work based on the + Program (independent of having been made by running the Program). + Whether that is true depends on what the Program does. + +- 1\. You may copy and distribute verbatim copies of the Program's + source code as you receive it, in any medium, provided that you + conspicuously and appropriately publish on each copy an appropriate + copyright notice and disclaimer of warranty; keep intact all the + notices that refer to this License and to the absence of any warranty; + and give any other recipients of the Program a copy of this License + along with the Program. + + You may charge a fee for the physical act of transferring a copy, and + you may at your option offer warranty protection in exchange for a fee. + +- 2\. You may modify your copy or copies of the Program or any portion + of it, thus forming a work based on the Program, and copy and + distribute such modifications or work under the terms of Section 1 + above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + + These requirements apply to the modified work as a whole. If + identifiable sections of that work are not derived from the Program, + and can be reasonably considered independent and separate works in + themselves, then this License, and its terms, do not apply to those + sections when you distribute them as separate works. But when you + distribute the same sections as part of a whole which is a work based + on the Program, the distribution of the whole must be on the terms of + this License, whose permissions for other licensees extend to the + entire whole, and thus to each and every part regardless of who wrote it. + + Thus, it is not the intent of this section to claim rights or contest + your rights to work written entirely by you; rather, the intent is to + exercise the right to control the distribution of derivative or + collective works based on the Program. + + In addition, mere aggregation of another work not based on the Program + with the Program (or with a work based on the Program) on a volume of + a storage or distribution medium does not bring the other work under + the scope of this License. + +- 3\. You may copy and distribute the Program (or a work based on it, + under Section 2) in object code or executable form under the terms of + Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + + The source code for a work means the preferred form of the work for + making modifications to it. For an executable work, complete source + code means all the source code for all modules it contains, plus any + associated interface definition files, plus the scripts used to + control compilation and installation of the executable. However, as a + special exception, the source code distributed need not include + anything that is normally distributed (in either source or binary + form) with the major components (compiler, kernel, and so on) of the + operating system on which the executable runs, unless that component + itself accompanies the executable. + + If distribution of executable or object code is made by offering + access to copy from a designated place, then offering equivalent + access to copy the source code from the same place counts as + distribution of the source code, even though third parties are not + compelled to copy the source along with the object code. + +- 4\. You may not copy, modify, sublicense, or distribute the Program + except as expressly provided under this License. Any attempt + otherwise to copy, modify, sublicense or distribute the Program is + void, and will automatically terminate your rights under this License. + However, parties who have received copies, or rights, from you under + this License will not have their licenses terminated so long as such + parties remain in full compliance. + +- 5\. You are not required to accept this License, since you have not + signed it. However, nothing else grants you permission to modify or + distribute the Program or its derivative works. These actions are + prohibited by law if you do not accept this License. Therefore, by + modifying or distributing the Program (or any work based on the + Program), you indicate your acceptance of this License to do so, and + all its terms and conditions for copying, distributing or modifying + the Program or works based on it. + +- 6\. Each time you redistribute the Program (or any work based on the + Program), the recipient automatically receives a license from the + original licensor to copy, distribute or modify the Program subject to + these terms and conditions. You may not impose any further + restrictions on the recipients' exercise of the rights granted herein. + You are not responsible for enforcing compliance by third parties to + this License. + +- 7\. If, as a consequence of a court judgment or allegation of patent + infringement or for any other reason (not limited to patent issues), + conditions are imposed on you (whether by court order, agreement or + otherwise) that contradict the conditions of this License, they do not + excuse you from the conditions of this License. If you cannot + distribute so as to satisfy simultaneously your obligations under this + License and any other pertinent obligations, then as a consequence you + may not distribute the Program at all. For example, if a patent + license would not permit royalty-free redistribution of the Program by + all those who receive copies directly or indirectly through you, then + the only way you could satisfy both it and this License would be to + refrain entirely from distribution of the Program. + + If any portion of this section is held invalid or unenforceable under + any particular circumstance, the balance of the section is intended to + apply and the section as a whole is intended to apply in other + circumstances. + + It is not the purpose of this section to induce you to infringe any + patents or other property right claims or to contest validity of any + such claims; this section has the sole purpose of protecting the + integrity of the free software distribution system, which is + implemented by public license practices. Many people have made + generous contributions to the wide range of software distributed + through that system in reliance on consistent application of that + system; it is up to the author/donor to decide if he or she is willing + to distribute software through any other system and a licensee cannot + impose that choice. + + This section is intended to make thoroughly clear what is believed to + be a consequence of the rest of this License. + +- 8\. If the distribution and/or use of the Program is restricted in + certain countries either by patents or by copyrighted interfaces, the + original copyright holder who places the Program under this License + may add an explicit geographical distribution limitation excluding + those countries, so that distribution is permitted only in or among + countries not thus excluded. In such case, this License incorporates + the limitation as if written in the body of this License. + +- 9\. The Free Software Foundation may publish revised and/or new versions + of the General Public License from time to time. Such new versions will + be similar in spirit to the present version, but may differ in detail to + address new problems or concerns. + + Each version is given a distinguishing version number. If the Program + specifies a version number of this License which applies to it and "any + later version", you have the option of following the terms and conditions + either of that version or of any later version published by the Free + Software Foundation. If the Program does not specify a version number of + this License, you may choose any version ever published by the Free Software + Foundation. + +- 10\. If you wish to incorporate parts of the Program into other free + programs whose distribution conditions are different, write to the author + to ask for permission. For software which is copyrighted by the Free + Software Foundation, write to the Free Software Foundation; we sometimes + make exceptions for this. Our decision will be guided by the two goals + of preserving the free status of all derivatives of our free software and + of promoting the sharing and reuse of software generally. + + +## NO WARRANTY + +- 11\. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY + FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN + OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES + PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED + OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS + TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE + PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, + REPAIR OR CORRECTION. + +- 12\. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING + WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR + REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, + INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING + OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED + TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY + YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER + PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE + POSSIBILITY OF SUCH DAMAGES. + +## END OF TERMS AND CONDITIONS ## diff --git a/README.md b/README.md index 200f48ae62743b2ca7e782ac7195fdc8e3518ea6..8ff640f34120f1f87876339d2eba128f64ac5bd4 100644 --- a/README.md +++ b/README.md @@ -1 +1,65 @@ -# mediawiki-extensions-sessionprovider-remoteuser \ No newline at end of file +# AuthRemoteuser: A MediaWiki Extension + +The Auth_remoteuser extension allows integration with the web server's built-in +authentication system via the REMOTE_USER environment variable. This variable +is set through HTTP-Auth, LDAP, CAS, PAM, and other authentication systems. +Using the the value of the REMOTE_USER environment variable, this extension +automagically performs a login for this user. The value of this environment +variable also serves as the MediaWiki username. If an account with that name does +not exist yet, one is created. + +## Installation +First, add this to your `LocalSettings.php`: + + #################################################### + # Extension: AuthRemoteuser + wfLoadExtension( 'AuthRemoteuser' ); + $wgAuthRemoteuserMailDomain = 'example.com'; + + # Settings: AuthRemoteuser + $wgGroupPermissions['*']['createaccount'] = false; + $wgGroupPermissions['*']['read'] = false; + $wgGroupPermissions['*']['edit'] = false; + #################################################### + +Instead of `example.com`, you might want to use the domain of your organization. +It will be appended to the username and should form a valid email address. If +i.e. your username to login (==`REMOTE_USER`) is `jdoe`, the email of the user +will be `jdoe@example.com`. + +## Implementation +The constructor of AuthRemoteuser registers a hook to do the automatic login. +Storing the AuthRemoteuser object in $wgAuth tells MediaWiki that instead of the +MediaWiki AuthPlugin, use us for authentication. This way the plugin can handle +the login attempts. + +# Original version + +The original version of this fork can be found on the [MediaWiki extension site] +(http://www.mediawiki.org/wiki/Extension:AuthRemoteuser). + +# License (GPLv2) + + Use web server authentication (REMOTE_USER) in MediaWiki. + Copyright 2006 Otheus Shelling + Copyright 2007 Rusty Burchfield + Copyright 2009 James Kinsman + Copyright 2010 Daniel Thomas + Copyright 2010 Ian Ward Comfort + Copyright 2014 Mark A. Hershberger + Copyright 2015 Jonas Gröger + Copyright 2016 Andreas Fink + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. diff --git a/extension.json b/extension.json new file mode 100644 index 0000000000000000000000000000000000000000..051176e23e2f57857a723c781ccb663cf241afb9 --- /dev/null +++ b/extension.json @@ -0,0 +1,31 @@ +{ + "name": "AuthRemoteuser", + "namemsg": "authremoteuser-extensionname", + "version": "1.3.0", + "author": ["Otheus Shelling", "Rusty Burchfield", "James Kinsman", "Daniel Thomas", "Ian Ward Comfort", "[[mw:User:MarkAHershberger|Mark A. Hershberger]]", "Jonas Gröger", "Andreas Fink"], + "url": "https://www.mediawiki.org/wiki/Extension:AuthRemoteuser", + "descriptionmsg": "authremoteuser-desc", + "type": "authentication", + "license-name": "GPL-2.0+", + "MessagesDirs": { + "AuthRemoteuser": [ + "i18n" + ] + }, + "AutoloadClasses": { + "AuthRemoteuser": "AuthRemoteuser.body.php" + }, + "SessionProviders": { + "AuthRemoteuser": { + "class": "AuthRemoteuser", + "args": [{"priority": 80}] + } + }, + "config": { + "_prefix": "", + "wgAuthRemoteuserDomain": "", + "wgAuthRemoteuserMailDomain": "example.wiki", + "wgAuthRemoteuserNotify": false + }, + "manifest_version": 1 +} \ No newline at end of file diff --git a/i18n/ast.json b/i18n/ast.json new file mode 100644 index 0000000000000000000000000000000000000000..a7257deb25382ee0936be7a56c8e04b3d637bd98 --- /dev/null +++ b/i18n/ast.json @@ -0,0 +1,8 @@ +{ + "@metadata": { + "authors": [ + "Xuacu" + ] + }, + "authremoteuser-desc": "Anicia sesión pa los usuarios automáticamente usando la variable d'entornu <code>REMOTE_USER</code>" +} diff --git a/i18n/ce.json b/i18n/ce.json new file mode 100644 index 0000000000000000000000000000000000000000..c58803ea2009214d725ac60a9b1c0b38158153e2 --- /dev/null +++ b/i18n/ce.json @@ -0,0 +1,8 @@ +{ + "@metadata": { + "authors": [ + "Умар" + ] + }, + "authremoteuser-desc": "Декъашхой автоматически язбо <code>REMOTE_USER</code> гӀоьнца" +} diff --git a/i18n/de.json b/i18n/de.json new file mode 100644 index 0000000000000000000000000000000000000000..3006db055d62f424eb143aed41de6196f707f760 --- /dev/null +++ b/i18n/de.json @@ -0,0 +1,8 @@ +{ + "@metadata": { + "authors": [ + "Metalhead64" + ] + }, + "authremoteuser-desc": "Ermöglicht die automatische Anmeldung von Benutzern mithilfe der <code>REMOTE_USER</code>-Umgebungsvariable" +} diff --git a/i18n/en-gb.json b/i18n/en-gb.json new file mode 100644 index 0000000000000000000000000000000000000000..ece657610c6f8af949c76e63e8be8a6e0b6c008b --- /dev/null +++ b/i18n/en-gb.json @@ -0,0 +1,8 @@ +{ + "@metadata": { + "authors": [ + "Chase me ladies, I'm the Cavalry" + ] + }, + "authremoteuser-desc": "Automatically logs users in by using the <code>REMOTE_USER</code> environment variable" +} diff --git a/i18n/en.json b/i18n/en.json new file mode 100644 index 0000000000000000000000000000000000000000..e955be8be7ec33e67c934f67a5608d4e99423acd --- /dev/null +++ b/i18n/en.json @@ -0,0 +1,8 @@ +{ + "@metadata": { + "authors": [ + "Otheus Shelling" + ] + }, + "authremoteuser-desc": "Automatically logs-in users using the <code>REMOTE_USER</code> environment variable" +} diff --git a/i18n/es.json b/i18n/es.json new file mode 100644 index 0000000000000000000000000000000000000000..522c9608d8988f20353ad3f093de62f133208647 --- /dev/null +++ b/i18n/es.json @@ -0,0 +1,9 @@ +{ + "@metadata": { + "authors": [ + "Fitoschido", + "Macofe" + ] + }, + "authremoteuser-desc": "Autentica usuarios automáticamente con la variable de entorno <code>REMOTE_USER</code>" +} diff --git a/i18n/fa.json b/i18n/fa.json new file mode 100644 index 0000000000000000000000000000000000000000..853f91f2eb528b28a162f50c904d88f4609f0c5f --- /dev/null +++ b/i18n/fa.json @@ -0,0 +1,8 @@ +{ + "@metadata": { + "authors": [ + "Alirezaaa" + ] + }, + "authremoteuser-desc": "به طور خودکار کاربرانی را که از متغیر محیطی <code>REMOTE_USER</code> استفاده میکنند ثبت میکند" +} diff --git a/i18n/fr.json b/i18n/fr.json new file mode 100644 index 0000000000000000000000000000000000000000..54a2c925313c60953d1b933c1175148891f26c5e --- /dev/null +++ b/i18n/fr.json @@ -0,0 +1,9 @@ +{ + "@metadata": { + "authors": [ + "Gomoko", + "Linedwell" + ] + }, + "authremoteuser-desc": "Connecte automatiquement les utilisateurs en utilisant la variable d’environnement <code>REMOTE_USER</code>" +} diff --git a/i18n/gl.json b/i18n/gl.json new file mode 100644 index 0000000000000000000000000000000000000000..7a79d985c2542f7dd3c66aeca271ad6f38bb177b --- /dev/null +++ b/i18n/gl.json @@ -0,0 +1,9 @@ +{ + "@metadata": { + "authors": [ + "Elisardojm", + "Toliño" + ] + }, + "authremoteuser-desc": "Inicia automaticamente a sesión dos usuarios que utilizan a variable de contorno <code>REMOTE_USER</code>" +} diff --git a/i18n/he.json b/i18n/he.json new file mode 100644 index 0000000000000000000000000000000000000000..628983fbb70567837f1eb2651af7f2dd5bcee389 --- /dev/null +++ b/i18n/he.json @@ -0,0 +1,10 @@ +{ + "@metadata": { + "authors": [ + "Ronel1", + "Amire80", + "Guycn2" + ] + }, + "authremoteuser-desc": "באופן אוטומטי יומני משתמשים באמצעות <code> </ code> משתנה סביבת REMOTE_USER" +} diff --git a/i18n/hsb.json b/i18n/hsb.json new file mode 100644 index 0000000000000000000000000000000000000000..586c622a42353c44976e0ec3bd09d86c29bef85b --- /dev/null +++ b/i18n/hsb.json @@ -0,0 +1,8 @@ +{ + "@metadata": { + "authors": [ + "Michawiki" + ] + }, + "authremoteuser-desc": "Zmóžnja awtomatiske přizjewjenje wužiwarjow z pomocu wokolinoweje wariable <code>REMOTE_USER</code>" +} diff --git a/i18n/ia.json b/i18n/ia.json new file mode 100644 index 0000000000000000000000000000000000000000..da7d569b172c0731a7a996f475223779842a9ec2 --- /dev/null +++ b/i18n/ia.json @@ -0,0 +1,8 @@ +{ + "@metadata": { + "authors": [ + "McDutchie" + ] + }, + "authremoteuser-desc": "Aperi automaticamente le session pro usatores con le variabile de ambiente <code>REMOTE_USER</code>" +} diff --git a/i18n/id.json b/i18n/id.json new file mode 100644 index 0000000000000000000000000000000000000000..060e12c83af637a2513fd7b55570a3f8c5549bb9 --- /dev/null +++ b/i18n/id.json @@ -0,0 +1,8 @@ +{ + "@metadata": { + "authors": [ + "Arifin.wijaya" + ] + }, + "authremoteuser-desc": "Secara otomatis masuk log pengguna menggunakan variabel lingkungan <code>REMOTE_USER</code>" +} diff --git a/i18n/it.json b/i18n/it.json new file mode 100644 index 0000000000000000000000000000000000000000..841a341ef78093e8b2047321295335012c36bb86 --- /dev/null +++ b/i18n/it.json @@ -0,0 +1,8 @@ +{ + "@metadata": { + "authors": [ + "Beta16" + ] + }, + "authremoteuser-desc": "Registra automaticamente gli utenti utilizzando la variabile di ambiente <code>REMOTE_USER</code>" +} diff --git a/i18n/ja.json b/i18n/ja.json new file mode 100644 index 0000000000000000000000000000000000000000..fdeb7e253623693605a8f03765c7cffd16f2921c --- /dev/null +++ b/i18n/ja.json @@ -0,0 +1,8 @@ +{ + "@metadata": { + "authors": [ + "Shirayuki" + ] + }, + "authremoteuser-desc": "<code>REMOTE_USER</code> 環境変数を使用して利用者を自動的にログインさせる" +} diff --git a/i18n/ko.json b/i18n/ko.json new file mode 100644 index 0000000000000000000000000000000000000000..6084716f58351b73e2585c656c110cb6a4d52c0a --- /dev/null +++ b/i18n/ko.json @@ -0,0 +1,8 @@ +{ + "@metadata": { + "authors": [ + "IRTC1015" + ] + }, + "authremoteuser-desc": "<code>REMOTE_USER</code> 환경 변수를 사용하여 사용자를 자동으로 로그인하게 합니다" +} diff --git a/i18n/ksh.json b/i18n/ksh.json new file mode 100644 index 0000000000000000000000000000000000000000..54a79dc03a099e9dc9afb618595f9a73e14879c8 --- /dev/null +++ b/i18n/ksh.json @@ -0,0 +1,8 @@ +{ + "@metadata": { + "authors": [ + "Purodha" + ] + }, + "authremoteuser-desc": "Määd et automattesche Enlogge vun Metmaachere müjjelesch övver et Säze vun <code lang=\"en\" xml:lang=\"en\">REMOTE_USER</code> en de Ömjävvongsparrameetere." +} diff --git a/i18n/mk.json b/i18n/mk.json new file mode 100644 index 0000000000000000000000000000000000000000..0e0e1b05f0f9cf24a9eeb97df292da15a78c6c3d --- /dev/null +++ b/i18n/mk.json @@ -0,0 +1,8 @@ +{ + "@metadata": { + "authors": [ + "Bjankuloski06" + ] + }, + "authremoteuser-desc": "Автоматски заведува корисници со околинската променлива <code>REMOTE_USER</code>" +} diff --git a/i18n/nb.json b/i18n/nb.json new file mode 100644 index 0000000000000000000000000000000000000000..4473a4223b9c0ec6f8edd23d577a45b1595a69a9 --- /dev/null +++ b/i18n/nb.json @@ -0,0 +1,8 @@ +{ + "@metadata": { + "authors": [ + "Chameleon222" + ] + }, + "authremoteuser-desc": "Logg inn brukere som bruker miljøvariabelen <code>REMOTE_USER</code> automatisk" +} diff --git a/i18n/nl.json b/i18n/nl.json new file mode 100644 index 0000000000000000000000000000000000000000..07771c25ed7e1c7e2c7363d47e57469a86ddd2fc --- /dev/null +++ b/i18n/nl.json @@ -0,0 +1,11 @@ +{ + "@metadata": { + "authors": [ + "Esketti", + "McDutchie", + "JaapDeKleine", + "Siebrand" + ] + }, + "authremoteuser-desc": "Logt gebruikers automatisch in met behulp van de omgevingsvariabele <code>REMOTE_USER</code>" +} diff --git a/i18n/oc.json b/i18n/oc.json new file mode 100644 index 0000000000000000000000000000000000000000..3271c67187c2c25e0909866c43831da2156f55ab --- /dev/null +++ b/i18n/oc.json @@ -0,0 +1,8 @@ +{ + "@metadata": { + "authors": [ + "Cedric31" + ] + }, + "authremoteuser-desc": "Connècta automaticament los utilizaires en utilizant la variabla d’environament <code>REMOTE_USER</code>" +} diff --git a/i18n/pt.json b/i18n/pt.json new file mode 100644 index 0000000000000000000000000000000000000000..5396d9c7f96dd248f7849ffc81c1ce2b5d120914 --- /dev/null +++ b/i18n/pt.json @@ -0,0 +1,9 @@ +{ + "@metadata": { + "authors": [ + "Fúlvio", + "Vitorvicentevalente" + ] + }, + "authremoteuser-desc": "Regista automaticamente utilizadores que utilizam a variável de ambiente <code>REMOTE_USER</code>" +} diff --git a/i18n/qqq.json b/i18n/qqq.json new file mode 100644 index 0000000000000000000000000000000000000000..0ef2d1e0ebadb2fcce1021c22e18ec54df44de83 --- /dev/null +++ b/i18n/qqq.json @@ -0,0 +1,8 @@ +{ + "@metadata": { + "authors": [ + "Raimond Spekking" + ] + }, + "authremoteuser-desc": "{{desc|name=AuthRemoteuser|url=https://gitlab.noris.net/cda-ad/experiment-auth-remoteuser}}" +} diff --git a/i18n/roa-tara.json b/i18n/roa-tara.json new file mode 100644 index 0000000000000000000000000000000000000000..f5b8e333b140414cbc935a877d386dcecc1d434c --- /dev/null +++ b/i18n/roa-tara.json @@ -0,0 +1,8 @@ +{ + "@metadata": { + "authors": [ + "Joetaras" + ] + }, + "authremoteuser-desc": "Automaticamende face trasè le utinde ausanne 'a variabbile d'ambiende <code>REMOTE_USER</code>" +} diff --git a/i18n/ru.json b/i18n/ru.json new file mode 100644 index 0000000000000000000000000000000000000000..dbef89f8f278f9054e309eee5e254ea4e4512c1e --- /dev/null +++ b/i18n/ru.json @@ -0,0 +1,9 @@ +{ + "@metadata": { + "authors": [ + "Okras", + "Alexandr Efremov" + ] + }, + "authremoteuser-desc": "Автоматически выполняет вход в систему пользователей, с использованием переменной среды <code>REMOTE_USER</code>" +} diff --git a/i18n/sv.json b/i18n/sv.json new file mode 100644 index 0000000000000000000000000000000000000000..d762e1e30b5e4b081a3440fa02379e66e94b49c4 --- /dev/null +++ b/i18n/sv.json @@ -0,0 +1,9 @@ +{ + "@metadata": { + "authors": [ + "Jopparn", + "Lokal Profil" + ] + }, + "authremoteuser-desc": "Loggar automatiskt in användare genom att använda <code>REMOTE_USER</code> miljövariabeln" +} diff --git a/i18n/uk.json b/i18n/uk.json new file mode 100644 index 0000000000000000000000000000000000000000..2779abb0eaa0f6369bfe8b33a5668a4e2f01fa7d --- /dev/null +++ b/i18n/uk.json @@ -0,0 +1,9 @@ +{ + "@metadata": { + "authors": [ + "Ата", + "Andriykopanytsia" + ] + }, + "authremoteuser-desc": "Автоматично виконує вхід в систему користувачів, з використанням змінної середовища <code>REMOTE_USER</code>" +} diff --git a/i18n/zh-hans.json b/i18n/zh-hans.json new file mode 100644 index 0000000000000000000000000000000000000000..4759223453d4f5f755a61dd777d335858530a50e --- /dev/null +++ b/i18n/zh-hans.json @@ -0,0 +1,8 @@ +{ + "@metadata": { + "authors": [ + "Liuxinyu970226" + ] + }, + "authremoteuser-desc": "自动记载使用<code>REMOTE_USER</code>环境变量的用户" +} diff --git a/i18n/zh-hant.json b/i18n/zh-hant.json new file mode 100644 index 0000000000000000000000000000000000000000..ffd31b98c244ca227c75899be8abdefd5225f623 --- /dev/null +++ b/i18n/zh-hant.json @@ -0,0 +1,9 @@ +{ + "@metadata": { + "authors": [ + "Liuxinyu970226", + "Cwlin0416" + ] + }, + "authremoteuser-desc": "使用 <code>REMOTE_USER</code> 環境變數自動登入使用者" +}