Skip to content

Commit

Permalink
Steam authentication method (wip)
Browse files Browse the repository at this point in the history
  • Loading branch information
qa-user authored and qa-user committed Oct 6, 2020
1 parent cde33cb commit abca3fd
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/admin/deployment.rst
Expand Up @@ -71,6 +71,7 @@ you create:
Set to 'github' if you want to use 'GitHub' (corresponding GITHUB_* settings must be set).
Set to 'gitlab' if you want to use 'GitLab' (corresponding GITLAB_* settings must be set if required).
Set to 'google' if you want to use 'Google' (corresponding GOOGLE_* settings must be set).
Set to 'steam' if you want to use 'Steam' (corresponding STEAM_* settings must be set).

``CELERY_ALWAYS_EAGER``
Controls whether asynchronous tasks (mainly used during sync) are sent to
Expand Down
16 changes: 16 additions & 0 deletions pontoon/base/management/commands/update_auth_providers.py
Expand Up @@ -13,12 +13,14 @@
from allauth.socialaccount.providers.github.provider import GitHubProvider
from allauth.socialaccount.providers.gitlab.provider import GitLabProvider
from allauth.socialaccount.providers.google.provider import GoogleProvider
from allauth.socialaccount.providers.steam.provider import SteamProvider


FXA_PROVIDER_ID = FirefoxAccountsProvider.id
GITHUB_PROVIDER_ID = GitHubProvider.id
GITLAB_PROVIDER_ID = GitLabProvider.id
GOOGLE_PROVIDER_ID = GoogleProvider.id
STEAM_PROVIDER_ID = SteamProvider.id


class Command(BaseCommand):
Expand Down Expand Up @@ -102,3 +104,17 @@ def handle(self, *args, **options):
)

self.update_provider(google_data)

# Check if STEAM_* settings are configured
if (
settings.STEAM_CLIENT_ID is not None
and settings.STEAM_SECRET_KEY is not None
):
steam_data = dict(
name="Steam",
provider=STEAM_PROVIDER_ID,
client_id=settings.STEAM_CLIENT_ID,
secret=settings.STEAM_SECRET_KEY,
)

self.update_provider(steam_data)
9 changes: 7 additions & 2 deletions pontoon/settings/base.py
Expand Up @@ -166,6 +166,7 @@ def path(*args):
"allauth.socialaccount.providers.github",
"allauth.socialaccount.providers.google",
"allauth.socialaccount.providers.gitlab",
"allauth.socialaccount.providers.steam",
"notifications",
"graphene_django",
"webpack_loader",
Expand Down Expand Up @@ -786,8 +787,8 @@ def _allowed_hosts():
SOCIALACCOUNT_ENABLED = True
SOCIALACCOUNT_ADAPTER = "pontoon.base.adapter.PontoonSocialAdapter"

# Supported values: 'django', 'fxa', 'github', 'gitlab', 'google'
AUTHENTICATION_METHOD = os.environ.get("AUTHENTICATION_METHOD", "django")
# Supported values: 'django', 'fxa', 'github', 'gitlab', 'google', 'steam'
AUTHENTICATION_METHOD = os.environ.get("AUTHENTICATION_METHOD", "steam")


def account_username(user):
Expand Down Expand Up @@ -820,6 +821,10 @@ def account_username(user):
GOOGLE_CLIENT_ID = os.environ.get("GOOGLE_CLIENT_ID")
GOOGLE_SECRET_KEY = os.environ.get("GOOGLE_SECRET_KEY")

# Steam
STEAM_CLIENT_ID = os.environ.get("STEAM_CLIENT_ID")
STEAM_SECRET_KEY = os.environ.get("STEAM_SECRET_KEY")

# All settings related to the AllAuth
SOCIALACCOUNT_PROVIDERS = {
"fxa": {
Expand Down

0 comments on commit abca3fd

Please sign in to comment.