Skip to content

Commit

Permalink
add support for c3hub oauth login
Browse files Browse the repository at this point in the history
  • Loading branch information
Kunsi committed Dec 24, 2024
1 parent 81aa8ce commit 24fb048
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
15 changes: 15 additions & 0 deletions util/sso/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from conf import CONFIG
from util.sso.c3hub import get_c3hub_userid, get_c3hub_username
from util.sso.c3voc import (
check_c3voc_allowed_login,
check_c3voc_is_admin,
Expand All @@ -15,6 +16,20 @@
)

SSO_CONFIG = {
"c3hub": {
"display_name": "38C3 Hub",
"authorize_url": "https://events.ccc.de/congress/2024/hub/sso/authorize",
"token_url": "https://events.ccc.de/congress/2024/hub/sso/token",
"scopes": [],
"userinfo_url": "https://api.events.ccc.de/congress/2024/me",
"functions": {
"is_admin": lambda json: False,
"login_allowed": lambda json: True,
"no_limit": lambda json: False,
"userid": get_c3hub_userid,
"username": get_c3hub_username,
},
},
"c3voc": {
"display_name": "C3VOC",
"authorize_url": "https://sso.c3voc.de/application/o/authorize/",
Expand Down
6 changes: 6 additions & 0 deletions util/sso/c3hub.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
def get_c3hub_userid(userinfo_json):
return "c3hub:{}".format(userinfo_json["username"])


def get_c3hub_username(userinfo_json):
return "{} (38C3)".format(userinfo_json["username"])

0 comments on commit 24fb048

Please sign in to comment.