From bf7f4d1dec1ec92b334214062ad3056c1d03dbee Mon Sep 17 00:00:00 2001 From: caniko Date: Fri, 5 Jul 2024 15:53:12 +0200 Subject: [PATCH] feat(integration): cilogon Integration of CILogon, which is an academic OIDC service for the US research and education community. --- httpx_oauth/clients/cilogon.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 httpx_oauth/clients/cilogon.py diff --git a/httpx_oauth/clients/cilogon.py b/httpx_oauth/clients/cilogon.py new file mode 100644 index 0000000..0d7430f --- /dev/null +++ b/httpx_oauth/clients/cilogon.py @@ -0,0 +1,31 @@ +from typing import List, Optional, Final + +from httpx_oauth.clients.openid import OpenID + + +BASE_SCOPES: Final = ["openid", "email"] +AVAILABLE_SCOPES: Final = ["openid", "email", "profile", "org.cilogon.userinfo"] + +CILOGON_DOMAIN: Final = "cilogon.org" + + +class CILogonOAuth2(OpenID): + """ + Academic OIDC service for the US research and education community. + + See https://www.cilogon.org/oidc for more information. + """ + def __init__( + self, + client_id: str, + client_secret: str, + scopes: Optional[List[str]] = BASE_SCOPES, + name: str = "CILogon", + ): + super().__init__( + client_id, + client_secret, + f"https://{CILOGON_DOMAIN}/.well-known/openid-configuration", + name=name, + base_scopes=scopes, + )