Skip to content

Commit

Permalink
Issue/django setup configuration mozilla django OIDC db (#136)
Browse files Browse the repository at this point in the history
* [maykinmedia/objects-api#480] Setup configuration mozilla django OIDC db

[maykinmedia/objects-api#480] Fix requirements

[maykinmedia/objects-api#480] Remove tests

* [maykinmedia/objects-api#480] Update django-setup-configuration

* [maykinmedia/objects-api#480] Update django.contrib.sites.Site configuration

* [maykinmedia/objects-api#480] Fix tests after new release

* [maykinmedia/objects-api#480] Fix tests

* [maykinmedia/objects-api#480] Delete old SiteConfigurationModel

* [maykinmedia/objects-api#480] Revert django-setup-configuration version
  • Loading branch information
danielmursa-dev authored Dec 17, 2024
1 parent 6fb512e commit 3181a5b
Show file tree
Hide file tree
Showing 13 changed files with 38 additions and 154 deletions.
2 changes: 1 addition & 1 deletion bin/setup_configuration.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# setup initial configuration using environment variables
# setup initial configuration using a yaml file
# Run this script from the root of the repository

set -e
Expand Down
16 changes: 15 additions & 1 deletion docker/setup_configuration/data.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,18 @@ sites_config_enable: true
sites_config:
items:
- domain: example.com
name: example
name: example

oidc_db_config_enable: true
oidc_db_config_admin_auth:
items:
- identifier: admin-oidc
oidc_rp_client_id: client-id
oidc_rp_client_secret: secret
endpoint_config:
oidc_op_authorization_endpoint: https://example.com/realms/test/protocol/openid-connect/auth
oidc_op_token_endpoint: https://example.com/realms/test/protocol/openid-connect/token
oidc_op_user_endpoint: https://example.com/realms/test/protocol/openid-connect/userinfo

# workaround for https://github.com/maykinmedia/django-setup-configuration/issues/27
userinfo_claims_source: id_token
1 change: 1 addition & 0 deletions requirements/base.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ furl
django-jsonsuit
sharing-configs
django-setup-configuration>=0.4.0
mozilla-django-oidc-db[django-setup-configuration]

# API libraries
drf-nested-routers
14 changes: 10 additions & 4 deletions requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,9 @@ drf-nested-routers==0.94.1
# -r requirements/base.in
# commonground-api-common
drf-spectacular[sidecar]==0.27.2
# via open-api-framework
# via
# drf-spectacular
# open-api-framework
drf-spectacular-sidecar==2024.7.1
# via drf-spectacular
drf-yasg==1.21.7
Expand Down Expand Up @@ -244,8 +246,10 @@ maykin-2fa==1.0.1
# via open-api-framework
mozilla-django-oidc==4.0.0
# via mozilla-django-oidc-db
mozilla-django-oidc-db==0.19.0
# via open-api-framework
mozilla-django-oidc-db[django-setup-configuration]==0.21.1
# via
# -r requirements/base.in
# open-api-framework
notifications-api-common==0.3.1
# via commonground-api-common
open-api-framework==0.9.0
Expand Down Expand Up @@ -273,7 +277,9 @@ pydantic==2.9.2
pydantic-core==2.23.4
# via pydantic
pydantic-settings[yaml]==2.6.1
# via django-setup-configuration
# via
# django-setup-configuration
# pydantic-settings
pyjwt==2.7.0
# via
# commonground-api-common
Expand Down
6 changes: 5 additions & 1 deletion requirements/ci.txt
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ django-solo==2.0.0
django-two-factor-auth[phonenumberslite,webauthn]==1.16.0
# via
# -r requirements/base.txt
# django-two-factor-auth
# maykin-2fa
django-webtest==1.9.10
# via -r requirements/test-tools.in
Expand Down Expand Up @@ -296,6 +297,7 @@ drf-nested-routers==0.94.1
drf-spectacular[sidecar]==0.27.2
# via
# -r requirements/base.txt
# drf-spectacular
# open-api-framework
drf-spectacular-sidecar==2024.7.1
# via
Expand Down Expand Up @@ -397,9 +399,10 @@ mozilla-django-oidc==4.0.0
# via
# -r requirements/base.txt
# mozilla-django-oidc-db
mozilla-django-oidc-db==0.19.0
mozilla-django-oidc-db[django-setup-configuration]==0.21.1
# via
# -r requirements/base.txt
# mozilla-django-oidc-db
# open-api-framework
multidict==6.0.5
# via yarl
Expand Down Expand Up @@ -463,6 +466,7 @@ pydantic-settings[yaml]==2.6.1
# via
# -r requirements/base.txt
# django-setup-configuration
# pydantic-settings
pyflakes==3.2.0
# via flake8
pyjwt==2.7.0
Expand Down
6 changes: 5 additions & 1 deletion requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ django-solo==2.0.0
django-two-factor-auth[phonenumberslite,webauthn]==1.16.0
# via
# -r requirements/base.txt
# django-two-factor-auth
# maykin-2fa
django-webtest==1.9.10
# via -r requirements/test-tools.in
Expand Down Expand Up @@ -311,6 +312,7 @@ drf-nested-routers==0.94.1
drf-spectacular[sidecar]==0.27.2
# via
# -r requirements/base.txt
# drf-spectacular
# open-api-framework
drf-spectacular-sidecar==2024.7.1
# via
Expand Down Expand Up @@ -415,9 +417,10 @@ mozilla-django-oidc==4.0.0
# via
# -r requirements/base.txt
# mozilla-django-oidc-db
mozilla-django-oidc-db==0.19.0
mozilla-django-oidc-db[django-setup-configuration]==0.21.1
# via
# -r requirements/base.txt
# mozilla-django-oidc-db
# open-api-framework
multidict==6.0.5
# via yarl
Expand Down Expand Up @@ -485,6 +488,7 @@ pydantic-settings[yaml]==2.6.1
# via
# -r requirements/base.txt
# django-setup-configuration
# pydantic-settings
pyflakes==3.0.1
# via flake8
pygments==2.15.1
Expand Down
2 changes: 1 addition & 1 deletion src/objecttypes/conf/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,6 @@
# Django setup configuration
#
SETUP_CONFIGURATION_STEPS = [
"objecttypes.setup_configuration.steps.sites.SitesConfigurationStep",
"objecttypes.setup_configuration.steps.token_auth.TokenAuthConfigurationStep",
"mozilla_django_oidc_db.setup_configuration.steps.AdminOIDCConfigurationStep",
]
17 changes: 0 additions & 17 deletions src/objecttypes/setup_configuration/models/sites.py

This file was deleted.

58 changes: 0 additions & 58 deletions src/objecttypes/setup_configuration/steps/sites.py

This file was deleted.

This file was deleted.

This file was deleted.

58 changes: 0 additions & 58 deletions src/objecttypes/setup_configuration/tests/test_sites_config.py

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,6 @@ def test_invalid_setup_identifier(self):
}
with self.assertRaises(ConfigurationRunFailed) as command_error:
execute_single_step(TokenAuthConfigurationStep, object_source=object_source)

self.assertTrue(
"Validation error(s) occured for invalid identifier"
in str(command_error.exception)
Expand Down

0 comments on commit 3181a5b

Please sign in to comment.