Skip to content

Commit

Permalink
move scopes, icons, and auth uris
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh-XT committed Jun 14, 2024
1 parent 2008bd1 commit 4566dbb
Show file tree
Hide file tree
Showing 63 changed files with 222 additions and 911 deletions.
219 changes: 216 additions & 3 deletions OAuth2Providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from sso.aol import aol_sso
from sso.apple import apple_sso
from sso.autodesk import autodesk_sso
from sso.basecamp import basecamp_sso
from sso.battlenet import battlenet_sso
from sso.bitbucket import bitbucket_sso
from sso.bitly import bitly_sso
Expand Down Expand Up @@ -68,8 +67,6 @@ def get_sso_provider(provider: str, code, redirect_uri=None):
return apple_sso(code=code, redirect_uri=redirect_uri)
elif provider == "autodesk":
return autodesk_sso(code=code, redirect_uri=redirect_uri)
elif provider == "basecamp":
return basecamp_sso(code=code, redirect_uri=redirect_uri)
elif provider == "battlenet":
return battlenet_sso(code=code, redirect_uri=redirect_uri)
elif provider == "bitbucket":
Expand Down Expand Up @@ -180,3 +177,219 @@ def get_sso_provider(provider: str, code, redirect_uri=None):
return zendesk_sso(code=code, redirect_uri=redirect_uri)
else:
return None


def get_scopes(provider):
scope = {
"amazon": ["openid", "email", "profile"],
"aol": [
"https://api.aol.com/userinfo.profile",
"https://api.aol.com/userinfo.email",
"https://api.aol.com/mail.send",
],
"apple": ["name", "email"],
"autodesk": ["data:read", "data:write", "bucket:read", "bucket:create"],
"battlenet": ["openid", "email"],
"bitbucket": ["account", "email"],
"bitly": ["bitly:read", "bitly:write"],
"clearscore": ["user.info.read", "email.send"],
"cloud_foundry": ["cloud_controller.read", "openid", "email"],
"deutsche_telekom": ["t-online-profile", "t-online-email"],
"deviantart": ["user", "browse", "stash", "send_message"],
"discord": ["identify", "email"],
"dropbox": ["account_info.read", "files.metadata.read"],
"facebook": ["public_profile", "email", "pages_messaging"],
"fatsecret": ["profile.get"],
"fitbit": [
"activity",
"heartrate",
"location",
"nutrition",
"profile",
"settings",
"sleep",
"social",
"weight",
],
"formstack": ["formstack:read", "formstack:write"],
"foursquare": [],
"github": ["user:email", "read:user"],
"gitlab": ["read_user", "api", "email"],
"google": [
"https://www.googleapis.com/auth/gmail.send",
"https://www.googleapis.com/auth/userinfo.profile",
"https://www.googleapis.com/auth/userinfo.email",
],
"huddle": ["user_info", "send_email"],
"imgur": ["read", "write"],
"instagram": ["user_profile", "user_media"],
"intel_cloud_services": [
"https://api.intel.com/userinfo.read",
"https://api.intel.com/mail.send",
],
"jive": ["your_required_scopes_here"],
"keycloak": ["openid", "email", "profile"],
"linkedin": ["r_liteprofile", "r_emailaddress", "w_member_social"],
"microsoft": [
"https://graph.microsoft.com/User.Read https://graph.microsoft.com/Mail.Send",
"https://graph.microsoft.com/Calendars.ReadWrite.Shared",
],
"netiq": ["profile", "email", "openid", "user.info"],
"okta": ["openid", "profile", "email"],
"openam": ["profile", "email"],
"openstreetmap": ["read_prefs"],
"orcid": ["/authenticate", "/activities/update"],
"paypal": ["email openid"],
"ping_identity": ["profile", "email", "openid"],
"pixiv": ["pixiv.scope.profile.read"],
"reddit": ["identity", "submit", "read"],
"salesforce": ["refresh_token full email"],
"sina_weibo": ["email", "statuses_update"],
"spotify": ["user-read-email", "user-read-private", "playlist-read-private"],
"stack_exchange": ["read_inbox no_expiry private_info write_access"],
"strava": ["read", "activity:write"],
"stripe": ["read_write"],
"twitch": ["user:read:email"],
"viadeo": ["basic", "email"],
"vimeo": ["public", "private", "video_files"],
"vk": ["email"],
"wechat": ["snsapi_userinfo"],
"withings": ["user.info", "user.metrics", "user.activity"],
"wso2_identity": ["openid", "profile", "email", "wso2.send_email"],
"xero": ["openid", "profile", "email", "offline_access"],
"xing": [
"https://api.xing.com/v1/users/me",
"https://api.xing.com/v1/authorize",
],
"yahoo": ["profile", "email", "mail-w"],
"yammer": ["messages:email", "messages:post"],
"yandex": ["login:info login:email", "mail.send"],
"yelp": ["business"],
"zendesk": ["read", "write"],
}
return scope[provider] if provider in scope else None


def get_authorization_url(provider):
uris = {
"amazon": "https://<AWS_USER_POOL_ID>.auth.<AWS_REGION>.amazoncognito.com/oauth2/authorize",
"aol": "https://api.login.aol.com/oauth2/authorize",
"apple": "https://appleid.apple.com/auth/authorize",
"autodesk": "https://developer.api.autodesk.com/authentication/v1/authorize",
"battlenet": "https://oauth.battle.net/authorize",
"bitbucket": "https://bitbucket.org/site/oauth2/authorize",
"bitly": "https://bitly.com/oauth/authorize",
"clearscore": "https://auth.clearscore.com/oauth2/authorize",
"cloud_foundry": "https://login.system.example.com/oauth/authorize",
"deutsche_telekom": "https://www.telekom.com/ssoservice/authorize",
"deviantart": "https://www.deviantart.com/oauth2/authorize",
"discord": "https://discord.com/api/oauth2/authorize",
"dropbox": "https://www.dropbox.com/oauth2/authorize",
"facebook": "https://www.facebook.com/v10.0/dialog/oauth",
"fatsecret": "https://oauth.fatsecret.com/connect/authorize",
"fitbit": "https://www.fitbit.com/oauth2/authorize",
"formstack": "https://www.formstack.com/api/v2/oauth2/authorize",
"foursquare": "https://foursquare.com/oauth2/authenticate",
"github": "https://github.com/login/oauth/authorize",
"gitlab": "https://gitlab.com/oauth/authorize",
"google": "https://accounts.google.com/o/oauth2/auth",
"huddle": "https://login.huddle.com/oauth2/authorize",
"imgur": "https://api.imgur.com/oauth2/authorize",
"instagram": "https://api.instagram.com/oauth/authorize",
"intel_cloud_services": "https://auth.intel.com/oauth2/v2.0/authorize",
"jive": "https://example.jive.com/oauth2/authorize",
"keycloak": "https://your-keycloak-server/auth/realms/your-realm/protocol/openid-connect/auth",
"linkedin": "https://www.linkedin.com/oauth/v2/authorization",
"microsoft": "https://login.microsoftonline.com/common/oauth2/v2.0/authorize",
"netiq": "https://your-netiq-domain.com/oauth2/authorize",
"okta": "https://your-okta-domain/oauth2/v1/authorize",
"openam": "https://your-openam-base-url/oauth2/authorize",
"openstreetmap": "https://www.openstreetmap.org/oauth/authorize",
"orcid": "https://orcid.org/oauth/authorize",
"paypal": "https://www.paypal.com/signin/authorize",
"ping_identity": "https://auth.pingidentity.com/as/authorize.oauth2",
"pixiv": "https://oauth.secure.pixiv.net/auth/authorize",
"reddit": "https://www.reddit.com/api/v1/authorize",
"salesforce": "https://login.salesforce.com/services/oauth2/authorize",
"sina_weibo": "https://api.weibo.com/oauth2/authorize",
"spotify": "https://accounts.spotify.com/authorize",
"stack_exchange": "https://stackexchange.com/oauth",
"strava": "https://www.strava.com/oauth/authorize",
"stripe": "https://connect.stripe.com/oauth/authorize",
"twitch": "https://id.twitch.tv/oauth2/authorize",
"viadeo": "https://secure.viadeo.com/oauth-provider/authorize",
"vimeo": "https://api.vimeo.com/oauth/authorize",
"vk": "https://oauth.vk.com/authorize",
"wechat": "https://open.weixin.qq.com/connect/qrconnect",
"withings": "https://account.withings.com/oauth2_user/authorize2",
"wso2_identity": "https://<your-wso2-server>/oauth2/authorize",
"xero": "https://login.xero.com/identity/connect/authorize",
"xing": "https://api.xing.com/v1/authorize",
"yahoo": "https://api.login.yahoo.com/oauth2/request_auth",
"yammer": "https://www.yammer.com/oauth2/authorize",
"yandex": "https://oauth.yandex.com/authorize",
"yelp": "https://api.yelp.com/oauth2/authorize",
"zendesk": "https://<your-zendesk-subdomain>.zendesk.com/oauth/authorizations/new",
}
return uris[provider] if provider in uris else None


def get_icon(provider):
icons = {
"amazon": "https://upload.wikimedia.org/wikipedia/commons/a/a9/Amazon_logo.svg",
"aol": "https://upload.wikimedia.org/wikipedia/commons/5/51/AOL.svg",
"apple": "https://upload.wikimedia.org/wikipedia/commons/f/fa/Apple_logo_black.svg",
"autodesk": "https://upload.wikimedia.org/wikipedia/commons/d/d7/Autodesk_logo_2019.svg",
"battlenet": "https://upload.wikimedia.org/wikipedia/en/1/1b/Battle.net_Icon.svg",
"bitbucket": "https://upload.wikimedia.org/wikipedia/commons/0/0e/Bitbucket-blue-logomark-only.svg",
"bitly": "https://upload.wikimedia.org/wikipedia/commons/5/56/Bitly_logo.svg",
"clearscore": "https://upload.wikimedia.org/wikipedia/en/5/57/ClearScore_logo.png",
"cloud_foundry": "https://upload.wikimedia.org/wikipedia/commons/thumb/7/75/Cloud_Foundry_Logo.svg/512px-Cloud_Foundry_Logo.svg.png",
"deutsche_telekom": "https://upload.wikimedia.org/wikipedia/commons/d/d2/Logo_telekom_2013.svg",
"deviantart": "https://upload.wikimedia.org/wikipedia/commons/b/b5/DeviantArt_Logo.svg",
"discord": "https://upload.wikimedia.org/wikipedia/commons/9/98/Discord_logo.svg",
"dropbox": "https://upload.wikimedia.org/wikipedia/commons/7/7e/Dropbox_Icon.svg",
"facebook": "https://upload.wikimedia.org/wikipedia/commons/5/51/Facebook_f_logo_%282019%29.svg",
"fatsecret": "https://upload.wikimedia.org/wikipedia/en/2/20/FatSecret.png",
"fitbit": "https://upload.wikimedia.org/wikipedia/commons/6/60/Fitbit_logo_2016.svg",
"formstack": "https://upload.wikimedia.org/wikipedia/en/0/09/Formstack_logo.png",
"foursquare": "https://upload.wikimedia.org/wikipedia/en/1/12/Foursquare_logo.svg",
"github": "https://upload.wikimedia.org/wikipedia/commons/9/91/Octicons-mark-github.svg",
"gitlab": "https://upload.wikimedia.org/wikipedia/commons/1/18/GitLab_Logo.svg",
"google": "https://upload.wikimedia.org/wikipedia/commons/2/2d/Google-favicon-2015.png",
"imgur": "https://upload.wikimedia.org/wikipedia/en/a/a9/Imgur_logo.svg",
"instagram": "https://upload.wikimedia.org/wikipedia/commons/a/a5/Instagram_icon.png",
"intel_cloud_services": "https://corporate-intelcom.azureedge.net/assets/Intel-Logo.svg",
"jive": "https://upload.wikimedia.org/wikipedia/en/8/8a/Jive_logo.png",
"keycloak": "https://www.keycloak.org/resources/images/keycloak_logo_400x.png",
"linkedin": "https://upload.wikimedia.org/wikipedia/commons/c/ca/LinkedIn_logo_initials.png",
"microsoft": "https://upload.wikimedia.org/wikipedia/commons/4/44/Microsoft_logo.svg",
"netiq": "https://upload.wikimedia.org/wikipedia/commons/3/30/NetIQ_logo.svg",
"okta": "https://upload.wikimedia.org/wikipedia/commons/5/50/Okta_Logo_Brandmark_Blue_RGB.png",
"openam": "https://avatars.githubusercontent.com/u/383598?v=4",
"openstreetmap": "https://upload.wikimedia.org/wikipedia/commons/6/66/OpenStreetMap-Logo.svg",
"orcid": "https://upload.wikimedia.org/wikipedia/commons/0/06/ORCID_iD.svg",
"paypal": "https://upload.wikimedia.org/wikipedia/commons/b/b5/PayPal.svg",
"ping_identity": "https://upload.wikimedia.org/wikipedia/en/e/e2/Ping_Identity_logo.jpg",
"pixiv": "https://upload.wikimedia.org/wikipedia/commons/c/ce/Pixiv_comic_icon.svg",
"reddit": "https://upload.wikimedia.org/wikipedia/en/8/82/Reddit_logo_and_wordmark.svg",
"salesforce": "https://upload.wikimedia.org/wikipedia/en/b/b5/Salesforce_logo_transparent.png",
"spotify": "https://upload.wikimedia.org/wikipedia/commons/1/19/Spotify_logo_without_text.svg",
"stack_exchange": "https://upload.wikimedia.org/wikipedia/commons/2/28/Stack_Exchange_logo.svg",
"strava": "https://upload.wikimedia.org/wikipedia/en/0/0d/Strava_Logo.svg",
"stripe": "https://upload.wikimedia.org/wikipedia/commons/3/3b/Stripe_Logo%2C_revised_2016.png",
"twitch": "https://upload.wikimedia.org/wikipedia/commons/7/7e/Twitch_logo_2019.svg",
"vimeo": "https://upload.wikimedia.org/wikipedia/commons/9/92/Vimeo_Logo.svg",
"vk": "https://upload.wikimedia.org/wikipedia/commons/2/21/VK.com-logo.svg",
"wechat": "https://upload.wikimedia.org/wikipedia/commons/9/9e/WeChat_Logo.svg",
"withings": "https://upload.wikimedia.org/wikipedia/en/a/a7/Withings_logo.svg",
"wso2_identity": "https://upload.wikimedia.org/wikipedia/commons/e/ee/WSO2_Logo.svg",
"xero": "https://images.squarespace-cdn.com/content/v1/600485aca07c94041769dbd3/1619704174874-KU8VVDKIHKB9YIS11836/XeroLogo.png",
"xing": "https://upload.wikimedia.org/wikipedia/commons/1/17/Xing_Logo.svg",
"yahoo": "https://s.yimg.com/rz/l/yahoo_en-US_f_p_bestfit_4x.png",
"yammer": "https://upload.wikimedia.org/wikipedia/commons/1/11/Yammer_logo.svg",
"yandex": "https://upload.wikimedia.org/wikipedia/commons/0/0f/Yandex_Logo_2016.svg",
"yelp": "https://upload.wikimedia.org/wikipedia/commons/a/ad/Yelp_logo.svg",
"zendesk": "https://upload.wikimedia.org/wikipedia/commons/9/91/Zendesk_logo.svg",
}
return icons[provider] if provider in icons else None
Loading

0 comments on commit 4566dbb

Please sign in to comment.