summaryrefslogtreecommitdiffstats
path: root/python/fatcat_web/auth.py
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2019-04-09 17:17:31 -0700
committerBryan Newbold <bnewbold@robocracy.org>2019-04-09 17:17:31 -0700
commit0840e5211309cd9e80ad7b2bbe82df3971423323 (patch)
tree57dd49d91e2a0bea622ed4c5ebcaf7116d472e4d /python/fatcat_web/auth.py
parentebedda562b528db3f14e47093b380ef41a303261 (diff)
downloadfatcat-0840e5211309cd9e80ad7b2bbe82df3971423323.tar.gz
fatcat-0840e5211309cd9e80ad7b2bbe82df3971423323.zip
crude mostly-working wikipedia (mediawiki) login
Diffstat (limited to 'python/fatcat_web/auth.py')
-rw-r--r--python/fatcat_web/auth.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/python/fatcat_web/auth.py b/python/fatcat_web/auth.py
index b815d816..44a03f5f 100644
--- a/python/fatcat_web/auth.py
+++ b/python/fatcat_web/auth.py
@@ -127,6 +127,17 @@ def handle_ia_xauth(email, password):
}
return handle_oauth(remote, None, oauth_info)
+def handle_wmoauth(username):
+ # pass off "as if" we did OAuth successfully
+ FakeOAuthRemote = namedtuple('FakeOAuthRemote', ['name', 'OAUTH_CONFIG'])
+ remote = FakeOAuthRemote(name='wikipedia', OAUTH_CONFIG={'api_base_url': "https://www.mediawiki.org/w"})
+ oauth_info = {
+ 'preferred_username': username,
+ 'iss': "https://www.mediawiki.org/w",
+ 'sub': username,
+ }
+ return handle_oauth(remote, None, oauth_info)
+
@login_manager.user_loader
def load_user(editor_id):
# looks for extra info in session, and updates the user object with that.