You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ponymail.apache.org by hu...@apache.org on 2020/09/08 08:37:35 UTC
[incubator-ponymail-foal] branch master updated (18bad85 -> 47171c1)
This is an automated email from the ASF dual-hosted git repository.
humbedooh pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git.
from 18bad85 type test endpoints as well
new dae0033 Thought of a thing we do not have yet
new dc1680d Remove OpenSearch element
new 0cee3a7 Add GitHub OAuth plugin
new 6cfc275 add note about workflow
new 07c3f63 plug in github support
new 5de30b2 add fetching github data from yaml to config
new 615f60a harmonize, fix comment
new 87d70b7 Switch to using token headers (non-deprecated), lint
new 4ba34b4 we can has github oauth
new 47171c1 Sample github config
The 10 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
server/README.md | 3 ++-
server/endpoints/oauth.py | 8 +++++++-
server/plugins/configuration.py | 4 ++++
server/plugins/oauthGithub.py | 37 +++++++++++++++++++++++++++++++++++++
webui/js/config.js | 7 +++++++
webui/list.html | 3 +--
6 files changed, 58 insertions(+), 4 deletions(-)
create mode 100644 server/plugins/oauthGithub.py
[incubator-ponymail-foal] 09/10: we can has github oauth
Posted by hu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
humbedooh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git
commit 4ba34b47e3bb79619dd6f6a60c9bcfa5891d22aa
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Tue Sep 8 10:35:55 2020 +0200
we can has github oauth
---
server/README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/server/README.md b/server/README.md
index 31f7bb0..92aa7ba 100644
--- a/server/README.md
+++ b/server/README.md
@@ -11,7 +11,7 @@ This is the (as of yet incomplete) backend server for the Foal UI.
- Searching with keywords, quotes, +/- inclusion/exclusion
- Rudimentary AAA (logged in with an authoritative OAuth gives read access to everyting)
- Persistent user sessions across restarts of the server
-- OAuth logins (Google + Generic for now)
+- OAuth logins (Google, Github + Generic for now)
### What doesn't work
[incubator-ponymail-foal] 10/10: Sample github config
Posted by hu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
humbedooh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git
commit 47171c110844dbfa78fa4f5e6b7817f055c7e9f5
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Tue Sep 8 10:36:58 2020 +0200
Sample github config
---
webui/js/config.js | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/webui/js/config.js b/webui/js/config.js
index 2e6ceb9..21a0699 100644
--- a/webui/js/config.js
+++ b/webui/js/config.js
@@ -33,6 +33,13 @@ var pm_config = {
fullname_key: 'name',
email_key: 'email',
client_id: '41983040784-s1gl269f0p537r22h8eai2pdr1a94pfg.apps.googleusercontent.com'
+ },
+ github: {
+ name: "GitHub OAuth",
+ oauth_portal: "https://github.com/login/oauth/authorize",
+ client_id: "your-client-id-here",
+ scope: "user:email",
+ construct: true
}
},
indexMode: 'table', // front page view mode:
[incubator-ponymail-foal] 02/10: Remove OpenSearch element
Posted by hu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
humbedooh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git
commit dc1680dafea77b149d3e22155b8f9160c5dc181a
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Tue Sep 8 10:01:41 2020 +0200
Remove OpenSearch element
---
webui/list.html | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/webui/list.html b/webui/list.html
index d8e5d49..a3b77a9 100644
--- a/webui/list.html
+++ b/webui/list.html
@@ -73,8 +73,7 @@ the License. -->
<button type="submit" title="Search!" value="Search!" class="btn btn-primary"><span class="glyphicon glyphicon-search"> </span></button>
<div id="q-dropdown" onclick="toggleView('advanced_search');"><span class="glyphicon glyphicon-chevron-down" title="Search settings..."> </span></div>
</div>
-
- <a href="javascript:void(0);" onclick="addSearchEngine();"><img src="images/opensearch.png" style="width: 16px; margin-top: 8px;" id="opensearch" title="Add these MLs as a search engine in your browser"/></a>
+
</form>
<form id="project_select_form">
<select style="float: left; margin-top: 12px; display: none;" id="project_select" onchange='switch_project(this.value);'></select>
[incubator-ponymail-foal] 01/10: Thought of a thing we do not have
yet
Posted by hu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
humbedooh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git
commit dae0033e864621543bd9f05023dc3455878188f1
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Tue Sep 8 09:57:01 2020 +0200
Thought of a thing we do not have yet
---
server/README.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/server/README.md b/server/README.md
index dd44944..31f7bb0 100644
--- a/server/README.md
+++ b/server/README.md
@@ -18,6 +18,7 @@ This is the (as of yet incomplete) backend server for the Foal UI.
- Composing replies
- Preferences
- Notifications/favorites
+- Mbox downloads
While rudimentary AAA works, the backend should not yet be used for private
[incubator-ponymail-foal] 08/10: Switch to using token headers
(non-deprecated), lint
Posted by hu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
humbedooh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git
commit 87d70b72c025defd8ecc81c477f707ee7b9a526a
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Tue Sep 8 10:31:42 2020 +0200
Switch to using token headers (non-deprecated), lint
---
server/plugins/oauthGithub.py | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/server/plugins/oauthGithub.py b/server/plugins/oauthGithub.py
index a1698d4..3cdd348 100644
--- a/server/plugins/oauthGithub.py
+++ b/server/plugins/oauthGithub.py
@@ -14,15 +14,23 @@ import plugins.server
import typing
-async def process(formdata, session, server: plugins.server.BaseServer) -> typing.Optional[dict]:
- formdata['client_id'] = server.config.oauth.github_client_id
- formdata['client_secret'] = server.config.oauth.github_client_secret
+async def process(
+ formdata, session, server: plugins.server.BaseServer
+) -> typing.Optional[dict]:
+ formdata["client_id"] = server.config.oauth.github_client_id
+ formdata["client_secret"] = server.config.oauth.github_client_secret
- rv = await server.runners.run(requests.post, 'https://github.com/login/oauth/access_token', data=formdata)
- m = re.search(r"(access_token=[a-f0-9]+)", rv.text)
+ rv = await server.runners.run(
+ requests.post, "https://github.com/login/oauth/access_token", data=formdata
+ )
+ m = re.search(r"access_token=([a-f0-9]+)", rv.text)
if m:
- rv = await server.runners.run(requests.get, "https://api.github.com/user?%s" % m.group(1))
+ rv = await server.runners.run(
+ requests.get,
+ "https://api.github.com/user",
+ headers={"authorization": "token %s" % m.group(1)},
+ )
js = rv.json()
js["oauth_domain"] = "github.com"
return js
[incubator-ponymail-foal] 04/10: add note about workflow
Posted by hu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
humbedooh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git
commit 6cfc27581450768755101eb3514bd7bd65363fa1
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Tue Sep 8 10:27:41 2020 +0200
add note about workflow
---
server/plugins/oauthGithub.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/server/plugins/oauthGithub.py b/server/plugins/oauthGithub.py
index f1265d4..a1698d4 100644
--- a/server/plugins/oauthGithub.py
+++ b/server/plugins/oauthGithub.py
@@ -1,5 +1,6 @@
"""
Github OAuth plugin.
+ This follows the workflow described at: https://developer.github.com/apps/building-oauth-apps/authorizing-oauth-apps
To make this work, please set up an application at https://github.com/settings/applications/
copy the client ID and secret to your ponymail.yaml's oauth configuration, as such:
oauth:
[incubator-ponymail-foal] 05/10: plug in github support
Posted by hu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
humbedooh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git
commit 07c3f63ee178127900ef37a3f473ea6db2eb1ee3
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Tue Sep 8 10:27:54 2020 +0200
plug in github support
---
server/endpoints/oauth.py | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/server/endpoints/oauth.py b/server/endpoints/oauth.py
index cccc711..3fd2068 100644
--- a/server/endpoints/oauth.py
+++ b/server/endpoints/oauth.py
@@ -21,6 +21,7 @@ import plugins.server
import plugins.session
import plugins.oauthGeneric
import plugins.oauthGoogle
+import plugins.oauthGithub
import typing
import aiohttp.web
import hashlib
@@ -43,6 +44,11 @@ async def process(
if oauth_token and oauth_token.startswith("https://www.googleapis.com/") and id_token:
rv = await plugins.oauthGoogle.process(indata, session, server)
+ # GitHub OAuth - currently fetches email address only
+ if indata.get('key', '') == 'github' and code:
+ rv = await plugins.oauthGithub.process(indata, session, server)
+
+
# Generic OAuth handler, only one we support for now. Works with ASF OAuth.
elif state and code and oauth_token:
rv = await plugins.oauthGeneric.process(indata, session, server)
[incubator-ponymail-foal] 06/10: add fetching github data from yaml
to config
Posted by hu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
humbedooh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git
commit 5de30b20bfe23aeba417df5b5427f7823ff106db
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Tue Sep 8 10:28:39 2020 +0200
add fetching github data from yaml to config
---
server/plugins/configuration.py | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/server/plugins/configuration.py b/server/plugins/configuration.py
index 24bda0b..458165e 100644
--- a/server/plugins/configuration.py
+++ b/server/plugins/configuration.py
@@ -17,10 +17,14 @@ class TaskConfig:
class OAuthConfig:
authoritative_domains: list
google_client_id: str
+ github_client_id: str
+ github_client_secret: str
def __init__(self, subyaml: dict):
self.authoritative_domains = subyaml.get('authoritative_domains', [])
self.google_client_id = subyaml.get('google_client_id', '')
+ self.github_client_id = subyaml.get('github_client_id', '')
+ self.github_client_secret = subyaml.get('github_client_secret', '')
class DBConfig:
[incubator-ponymail-foal] 03/10: Add GitHub OAuth plugin
Posted by hu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
humbedooh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git
commit 0cee3a70238867bd7da38925320875c2205721cb
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Tue Sep 8 10:27:07 2020 +0200
Add GitHub OAuth plugin
---
server/plugins/oauthGithub.py | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/server/plugins/oauthGithub.py b/server/plugins/oauthGithub.py
new file mode 100644
index 0000000..f1265d4
--- /dev/null
+++ b/server/plugins/oauthGithub.py
@@ -0,0 +1,28 @@
+"""
+ Github OAuth plugin.
+ To make this work, please set up an application at https://github.com/settings/applications/
+ copy the client ID and secret to your ponymail.yaml's oauth configuration, as such:
+ oauth:
+ github_client_id: abcdef123456
+ github_client_secret: bcfdgefa572564576
+"""
+
+import re
+import requests
+import plugins.server
+import typing
+
+
+async def process(formdata, session, server: plugins.server.BaseServer) -> typing.Optional[dict]:
+ formdata['client_id'] = server.config.oauth.github_client_id
+ formdata['client_secret'] = server.config.oauth.github_client_secret
+
+ rv = await server.runners.run(requests.post, 'https://github.com/login/oauth/access_token', data=formdata)
+ m = re.search(r"(access_token=[a-f0-9]+)", rv.text)
+
+ if m:
+ rv = await server.runners.run(requests.get, "https://api.github.com/user?%s" % m.group(1))
+ js = rv.json()
+ js["oauth_domain"] = "github.com"
+ return js
+ return None
[incubator-ponymail-foal] 07/10: harmonize, fix comment
Posted by hu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
humbedooh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git
commit 615f60a7380111f7951a70bc0cca28c9a847a0d2
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Tue Sep 8 10:28:56 2020 +0200
harmonize, fix comment
---
server/endpoints/oauth.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/server/endpoints/oauth.py b/server/endpoints/oauth.py
index 3fd2068..929e2c9 100644
--- a/server/endpoints/oauth.py
+++ b/server/endpoints/oauth.py
@@ -41,10 +41,10 @@ async def process(
rv: typing.Optional[dict] = None
# Google OAuth - currently fetches email address only
- if oauth_token and oauth_token.startswith("https://www.googleapis.com/") and id_token:
+ if indata.get('key', '') == 'google' and id_token:
rv = await plugins.oauthGoogle.process(indata, session, server)
- # GitHub OAuth - currently fetches email address only
+ # GitHub OAuth - Fetches name and email
if indata.get('key', '') == 'github' and code:
rv = await plugins.oauthGithub.process(indata, session, server)