Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fix wrong OIDC settings becasue of new changes in the main settings #73

Merged
merged 2 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 4 additions & 4 deletions .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ DEFAULT_LANGUAGE=en
# Geometric settings
DEFAULT_SRID=2056

# Registration disabled by default
REGISTRATION_ENABLED = False
# Registration enabled by default
REGISTRATION_ENABLED=True

# OIDC parameters
OIDC_ENABLED = False
OIDC_ENABLED=False
OIDC_OP_BASE_URL="please set oidc op base url"
ZITADEL_PROJECT="set_zitadel_project"
OIDC_RP_CLIENT_ID="set oidc rp client id"
OIDC_RP_CLIENT_SECRET="set oidc rp client secret"
OIDC_PRIVATE_KEYFILE="keyfile"
OIDC_PRIVATE_KEYFILE="keyfile"
6 changes: 3 additions & 3 deletions default_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,8 @@
}

FEATURE_FLAGS = {
"oidc": os.environ.get("OIDC_ENABLED", "False") == "False",
"registration": os.environ.get("REGISTRATION_ENABLED", "False") == "False",
"oidc": os.environ.get("OIDC_ENABLED", "False") == "True",
"registration": os.environ.get("REGISTRATION_ENABLED", "True") == "True",
}

AUTHENTICATION_BACKENDS = ("django.contrib.auth.backends.ModelBackend",)
Expand Down Expand Up @@ -313,7 +313,7 @@ def discover_endpoints(discovery_url: str) -> dict:


def check_oidc() -> bool:
if FEATURE_FLAGS['oidc']:
if not FEATURE_FLAGS['oidc']:
return False
missing = []
for x in ["OIDC_RP_CLIENT_ID", "ZITADEL_PROJECT", "OIDC_OP_BASE_URL", "OIDC_PRIVATE_KEYFILE"]:
Expand Down
2 changes: 1 addition & 1 deletion oidc.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
UserModel = get_user_model()

def status(request):
return {"OIDC_ENABLED": settings.OIDC_ENABLED}
return {"OIDC_ENABLED": settings.FEATURE_FLAGS["oidc"]}


def _updateUser(user, claims):
Expand Down
2 changes: 1 addition & 1 deletion urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,4 @@
router.register_additional_route_to_root(f'{ROOTURL}auth/register', 'auth_register')
urlpatterns += [
path(f'{ROOTURL}auth/register/', views.RegisterView.as_view(), name='auth_register'),
]
]
Loading