Skip to content

Commit

Permalink
feature: added env OIDC_ORGS_SLUG_REGEX to set regex of organisation-…
Browse files Browse the repository at this point in the history
…slug to be displayed on the login-page
  • Loading branch information
mavriq committed Apr 11, 2022
1 parent d6f1793 commit 970f1e2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions oidc/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,5 @@
config_issuer = getattr(settings, "OIDC_ISSUER", None)
if config_issuer:
ISSUER = config_issuer

ORGS_SLUG_REGEX = getattr(settings, "OIDC_ORGS_SLUG_REGEX", ".*")
2 changes: 2 additions & 0 deletions oidc/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from bs4 import BeautifulSoup, Tag
from logging import debug, info, error
from sentry.models import Organization, AuthProvider
from .constants import ORGS_SLUG_REGEX


class PatchLoginPage:
Expand Down Expand Up @@ -41,6 +42,7 @@ def process_response(
_auth_container.append(_auth_provider_column)
#
_orgs = Organization.objects.filter(
slug__regex=ORGS_SLUG_REGEX,
id__in=(AuthProvider.objects.filter(provider='oidc')
.values('organization_id')))
for org in _orgs:
Expand Down

0 comments on commit 970f1e2

Please sign in to comment.