Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
590ed00
Merge pull request #376 from helxplatform/develop
joshua-seals Mar 12, 2025
7832f9d
Merge pull request #388 from helxplatform/develop
waTeim Aug 18, 2025
e79dfa3
Startup issue when configuring the color scheme. fix suggested by GR.
PhillipsOwen Nov 12, 2025
da3da2f
improving message comment
PhillipsOwen Nov 19, 2025
2fc11de
adding CILogon
PhillipsOwen Nov 19, 2025
305e12c
adding override to see what social accounts are returning for data.
PhillipsOwen Nov 20, 2025
c39fe62
tidying up, correcting spelling mistake.
PhillipsOwen Nov 20, 2025
72df14e
adding config items for dex auth
PhillipsOwen Dec 10, 2025
a02af71
add oidc dex config
frostyfan109 Dec 10, 2025
4a170d8
Merge branch 'issue_396' of https://github.com/helxplatform/appstore …
PhillipsOwen Dec 10, 2025
15d5124
fix providers endpoint, move openid_connect installation
frostyfan109 Dec 10, 2025
e6e9ea4
Merge branch 'issue_396' of https://github.com/helxplatform/appstore …
PhillipsOwen Dec 10, 2025
2b27805
update whitelist required URL
frostyfan109 Dec 10, 2025
00e9c29
Merge branch 'issue_396' of https://github.com/helxplatform/appstore …
PhillipsOwen Dec 11, 2025
fe652e0
Merge branch 'develop' of https://github.com/helxplatform/appstore in…
frostyfan109 Feb 6, 2026
6d7ad5d
restoring file to remove debug settings
PhillipsOwen Feb 9, 2026
ee55cc4
Merge branch 'issue_396' of https://github.com/helxplatform/appstore …
PhillipsOwen Feb 9, 2026
df085a7
commenting out as it could be useful later though
PhillipsOwen Feb 9, 2026
92bcd33
adding code to better support dex deployment
PhillipsOwen Feb 10, 2026
55b6ab2
changing the way oidc is handled. there is now a generic OIDC setting…
PhillipsOwen Feb 11, 2026
286aca2
adding SOCIALACCOUNT_EMAIL_AUTHENTICATION_AUTO_CONNECT = True
PhillipsOwen Feb 18, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 34 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,28 +75,31 @@ concerns are:

During development, environment variables can be set to control execution:

| Variable | Description |
| :------------------------------------- | :---------------------------------------------------------------- |
| BRAND=[braini, cat, heal, restartr, scidas, eduhelx] | Product context configuration for the appstore. |
| DJANGO_SETTINGS_MODULE=[appstore.settings.<brand>_settings] | Product settings module configuration for the appstore. |
| DEV_PHASE=[stub, local, dev, val, prod] | In stub, does not require a Tycho service. |
| ALLOW_DJANGO_LOGIN=[TRUE, FALSE] | When true, presents username and password authentication options. |
| SECRET_KEY | Key for securing the application. |
| OAUTH_PROVIDERS | Contains all the providers(google, github). |
| GOOGLE_CLIENT_ID | Contains the client_id of the provider. |
| GOOGLE_SECRET | Contains the secret key for provider. |
| GOOGLE_NAME | Sets the name for the provider. |
| GITHUB_CLIENT_ID | Contains the client_id of the provider. |
| GITHUB_SECRET | Contains the secret key of the provider. |
| GITHUB_NAME | Sets the name for the provider. |
| APPSTORE_DJANGO_USERNAME | Holds superuser username credentials. |
| APPSTORE_DJANGO_PASSWORD | Holds superuser password credentials. |
| TYCHO_URL | Contains the url of the running tycho host. |
| OAUTH_DB_DIR | Contains the path for the database directory. |
| OAUTH_DB_FILE | Contains the path for the database file. |
| APPSTORE_DEFAULT_FROM_EMAIL | Default email address for appstore. |
| APPSTORE_DEFAULT_SUPPORT_EMAIL | Default support email for appstore. |
| ACCOUNT_DEFAULT_HTTP_PROTOCOL | Allows to switch between http and https protocol. |
| Variable | Description |
|:-------------------------------------------------------------|:------------------------------------------------------------------|
| BRAND=[braini, cat, heal, restartr, scidas, eduhelx] | Product context configuration for the appstore. |
| DJANGO_SETTINGS_MODULE=[appstore.settings.<brand>_settings] | Product settings module configuration for the appstore. |
| DEV_PHASE=[stub, local, dev, val, prod] | In stub, does not require a Tycho service. |
| ALLOW_DJANGO_LOGIN=[TRUE, FALSE] | When true, presents username and password authentication options. |
| SECRET_KEY | Key for securing the application. |
| OAUTH_PROVIDERS | Contains all the providers(google, github, cilogon). |
| CILOGON_CLIENT_ID | Contains the client_id of the provider. |
| CILOGON_SECRET | Contains the secret key for provider. |
| CILOGON_NAME | Sets the name for the provider. |
| GOOGLE_CLIENT_ID | Contains the client_id of the provider. |
| GOOGLE_SECRET | Contains the secret key for provider. |
| GOOGLE_NAME | Sets the name for the provider. |
| GITHUB_CLIENT_ID | Contains the client_id of the provider. |
| GITHUB_SECRET | Contains the secret key of the provider. |
| GITHUB_NAME | Sets the name for the provider. |
| APPSTORE_DJANGO_USERNAME | Holds superuser username credentials. |
| APPSTORE_DJANGO_PASSWORD | Holds superuser password credentials. |
| TYCHO_URL | Contains the url of the running tycho host. |
| OAUTH_DB_DIR | Contains the path for the database directory. |
| OAUTH_DB_FILE | Contains the path for the database file. |
| APPSTORE_DEFAULT_FROM_EMAIL | Default email address for appstore. |
| APPSTORE_DEFAULT_SUPPORT_EMAIL | Default support email for appstore. |
| ACCOUNT_DEFAULT_HTTP_PROTOCOL | Allows to switch between http and https protocol. |

The provided .env.sample contains a starter that you can update and source for
development.
Expand Down Expand Up @@ -527,13 +530,17 @@ appstore:
EMAIL_HOST_PASSWORD: <secret>
DOCKSTORE_APPS_BRANCH: <appstore branch>
oauth:
OAUTH_PROVIDERS: "github,google"
OAUTH_PROVIDERS: "github,google,cilogon"
GITHUB_NAME: <github name>
GITHUB_CLIENT_ID: <github id>
GITHUB_SECRET: <github secret>
GOOGLE_NAME: <google name>
GOOGLE_CLIENT_ID: <google client id>
GOOGLE_SECRET: <google client secret>
GOOGLE_SECRET: <CILogon client secret>
CILOGON_NAME: <cilogon name>
CILOGON_CLIENT_ID: <CILogon client id>
CILOGON_SECRET: <CILogon client secret>

ACCOUNT_DEFAULT_HTTP_PROTOCOL: https
appstoreEntrypointArgs: "make start"
userStorage:
Expand All @@ -558,6 +565,9 @@ As part of user configuration, system administration will obtain the following
- GOOGLE_NAME
- GOOGLE_CLIENT_ID
- GOOGLE_SECRET
- CILOGON_NAME
- CILOGON_CLIENT_ID
- CILOGON_SECRET
- serverName
- IP
- nginxTLSSecret
Expand Down
7 changes: 4 additions & 3 deletions appstore/api/v1/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -873,11 +873,12 @@ def _get_social_providers(self, request, settings):
"allauth.account.auth_backends.AuthenticationBackend"
in settings.AUTHENTICATION_BACKENDS
):
for provider in socialaccount.providers.registry.get_class_list():
inst = provider(request, "allauth.socialaccount")
adapter = socialaccount.adapter.get_adapter(request)
providers = adapter.list_providers(request)
for provider in providers:
provider_data.append(
asdict(
LoginProvider(inst.name, inst.get_login_url(request))
LoginProvider(provider.name, provider.get_login_url(request))
)
)

Expand Down
8 changes: 7 additions & 1 deletion appstore/appstore/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ def clean_email(self, email):
)
return email


class LoginRedirectAdapter(DefaultAccountAdapter, DefaultSocialAccountAdapter):
"""
For regular form login redirect the user to the correct
Expand Down Expand Up @@ -60,6 +59,13 @@ def get_logout_redirect_url(self, request):
return url

class SocialAccountAdapter(DefaultSocialAccountAdapter):

# debug commenting out for now.
# def populate_user(self, request, sociallogin, data):
# user = super().populate_user(request, sociallogin, data)
# print('sociallogin.account.extra_data:', sociallogin.account.extra_data)
# return user

def on_authentication_error(self, request, provider, error=None, exception=None, extra_context=None):
provider_id = provider.id if provider else "unknown"
error_code = error.name if error else "unknown"
Expand Down
57 changes: 46 additions & 11 deletions appstore/appstore/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@
DEV_PHASE = os.environ.get("DEV_PHASE", "local")
TYCHO_MODE = os.environ.get("TYCHO_MODE", "null" if DEV_PHASE == "stub" else "live")

# Needs to be JSON-encoded since expressions can contain basically any character that would be used as a delimiter.
# Needs to be JSON-encoded since expressions can contain basically any character that would be used as a delimiter.
AUTO_WHITELIST_PATTERNS = json.loads(os.environ.get("AUTO_WHITELIST_PATTERNS", "[]"))

# Variables used for an external Tycho app registry.
# ToDo: Consider setting the default value of TYCHO_APP_REGISTRY_REPO to
# ToDo: Consider setting the default value of TYCHO_APP_REGISTRY_REPO to
# "https://github.com/helxplatform/helx-apps/raw" and remove any other similar
# variable. Maybe don't set and raise a fatal error if not set (still remove
# other similar variables).
Expand Down Expand Up @@ -91,7 +91,7 @@
"corsheaders",
"crispy_forms",
"rest_framework",
"drf_spectacular",
"drf_spectacular"
]

## Setting to allow for a seamless login that was breaking at django-allauth 0.47.
Expand All @@ -107,11 +107,52 @@
"tycho",
]

ACCOUNT_EMAIL_REQUIRED = True

SOCIALACCOUNT_ADAPTER = "appstore.adapter.SocialAccountAdapter"
SOCIALACCOUNT_QUERY_EMAIL = ACCOUNT_EMAIL_REQUIRED
SOCIALACCOUNT_STORE_TOKENS = True
SOCIALACCOUNT_EMAIL_AUTHENTICATION_AUTO_CONNECT = True

SOCIALACCOUNT_PROVIDERS = {
"google": {"SCOPE": ["profile", "email"], "AUTH_PARAMS": {"access_type": "offline"}},
}

OAUTH_PROVIDERS = os.environ.get("OAUTH_PROVIDERS", "").split(",")

# Notes: there are currently 3 types of SSO providers that can be specified:
# github,google,cilogon
for PROVIDER in OAUTH_PROVIDERS:
if PROVIDER != '':
THIRD_PARTY_APPS.append(f"allauth.socialaccount.providers.{PROVIDER}")

# get the OIDC name if exists
OIDC_NAME = os.environ.get("OIDC_NAME", "")

# add in the OIDC params
if OIDC_NAME != "":
# add the oidc provider to the django config
THIRD_PARTY_APPS.append(f"allauth.socialaccount.providers.openid_connect")

# get the rest of the OIDC parameters
OIDC_CLIENT_ID = os.environ.get("OIDC_CLIENT_ID","")
OIDC_SECRET = os.environ.get("OIDC_SECRET","")
OIDC_SERVER_URL = os.environ.get("OIDC_SERVER_URL","")

SOCIALACCOUNT_PROVIDERS.update(
{
"openid_connect": {
"APPS": [
{
"provider_id": OIDC_NAME,
"name": OIDC_NAME,
"client_id": OIDC_CLIENT_ID,
"secret": OIDC_SECRET,
"settings": { "server_url": OIDC_SERVER_URL }
}]
}
})

INSTALLED_APPS = DJANGO_APPS + THIRD_PARTY_APPS + LOCAL_APPS

WSGI_APPLICATION = "appstore.wsgi.application"
Expand Down Expand Up @@ -146,25 +187,19 @@

ACCOUNT_ADAPTER = "appstore.adapter.LoginRedirectAdapter"
ACCOUNT_DEFAULT_HTTP_PROTOCOL = os.environ.get("ACCOUNT_DEFAULT_HTTP_PROTOCOL", "http")
ACCOUNT_EMAIL_REQUIRED = True
ACCOUNT_EMAIL_CONFIRMATION_EXPIRE_DAYS = 1
ACCOUNT_EMAIL_VERIFICATION = "none"
ACCOUNT_RATE_LIMITS= {'login_failed':10}
#deprecated ACCOUNT_LOGIN_ATTEMPTS_TIMEOUT = 86400 # 1 day in seconds
ACCOUNT_LOGOUT_REDIRECT_URL = "/helx"
LOGIN_REDIRECT_URL = "/helx/workspaces/login/success"
LOGIN_URL = "/accounts/login"
LOGIN_WHITELIST_URL = "/login_whitelist/"
LOGIN_WHITELIST_URL = "/helx/workspaces/login?whitelist_required=true"
OIDC_SESSION_MANAGEMENT_ENABLE = True
SAML_URL = "/accounts/saml"
SAML_ACS_URL = "/saml2_auth/acs/"
#SAML_ACS_URL = "/sso/acs/"
SOCIALACCOUNT_ADAPATER = "appstore.adapter.SocialAccountAdapter"
SOCIALACCOUNT_QUERY_EMAIL = ACCOUNT_EMAIL_REQUIRED
SOCIALACCOUNT_STORE_TOKENS = True
SOCIALACCOUNT_PROVIDERS = {
"google": {"SCOPE": ["profile", "email"], "AUTH_PARAMS": {"access_type": "offline"}}
}

SECURE_CROSS_ORIGIN_OPENER_POLICY = None

TEMPLATES = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ def handle(self, *args, **kwargs):

if not Group.objects.filter(name='whitelisted'):
Group.objects.create(name='whitelisted')
print("Successfully added social applications GitHub and Google and whitelisted to the Group!")
print("Successfully added social applications and whitelisted them into the Group!")
2 changes: 1 addition & 1 deletion appstore/product/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ class ProductSettings:
brand: str = "CommonsShare"
title: str = "CommonsShare"
logo_url: str = "/static/images/commonsshare/logo-lg.png"
color_scheme: ProductColorScheme = ProductColorScheme()
color_scheme: ProductColorScheme = field(default_factory=lambda: ProductColorScheme())
capabilities: List[str] = field(default_factory=lambda: ['app', 'search'])

Loading