-
Notifications
You must be signed in to change notification settings - Fork 0
[#343] Add setupconfig support #345
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
Changes from all commits
4b79bd7
2c38a76
5c65fe2
adaa9ea
fc05298
03818a7
8d3367c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| # | ||
| # ** Django setup configuration fixture ** | ||
| # | ||
| # Can be used FOR DEVELOPMENT to configure the application with the docker services provided | ||
| # in the folder /backend/docker-services. | ||
|
|
||
| oidc_db_config_enable: true | ||
| oidc_db_config_admin_auth: | ||
| providers: | ||
| - identifier: admin-oidc-provider | ||
| oidc_use_nonce: true | ||
| oidc_nonce_size: 32 | ||
| oidc_state_size: 32 | ||
| endpoint_config: | ||
| oidc_op_discovery_endpoint: "http://localhost:28080/realms/openbeheer-dev/" | ||
| items: | ||
| - identifier: admin-oidc | ||
| enabled: true | ||
| oidc_rp_client_id: openbeheer-dev | ||
| oidc_rp_client_secret: oCwSJtZVdHW6BzCFIxKnIg16nLL0x4zK | ||
| oidc_rp_scopes_list: | ||
| - openid | ||
| - profile | ||
| oidc_rp_sign_algo: RS256 | ||
| oidc_provider_identifier: admin-oidc-provider | ||
| userinfo_claims_source: id_token | ||
| options: | ||
| user_settings: | ||
| claim_mappings: | ||
| username: | ||
| - sub | ||
| first_name: | ||
| - given_name | ||
| last_name: | ||
| - family_name | ||
| email: | ||
| username_case_sensitive: true | ||
| groups_settings: | ||
| claim_mapping: | ||
| - roles | ||
| sync: true | ||
| sync_pattern: '*' | ||
| default_groups: [] | ||
| make_users_staff: true | ||
| superuser_group_names: | ||
| - Superuser | ||
|
|
||
| zgw_consumers_config_enable: true | ||
| zgw_consumers: | ||
| services: | ||
| - identifier: objecttypen-service | ||
| label: Objecttypen API | ||
| api_root: http://localhost:8004/api/v2/ | ||
| api_type: orc | ||
| auth_type: api_key | ||
| header_key: Authorization | ||
| header_value: Token 18b2b74ef994314b84021d47b9422e82b685d82f | ||
| - identifier: catalogi-service | ||
| label: Open Zaak - Catalogi API | ||
| api_root: http://localhost:8003/catalogi/api/v1/ | ||
| api_type: ztc | ||
| auth_type: zgw | ||
| client_id: test-vcr | ||
| secret: test-vcr | ||
| - identifier: selectielijst-service | ||
| label: Open Zaak (public) - Selectielijst API | ||
| api_root: https://selectielijst.openzaak.nl/api/v1/ | ||
| api_type: orc | ||
| auth_type: no_auth | ||
|
|
||
| api_configuration_enabled: true | ||
| api_configuration: | ||
| selectielijst_service_identifier: selectielijst-service | ||
| objecttypen_service_identifier: objecttypen-service |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| from django_setup_configuration import ConfigurationModel | ||
| from django_setup_configuration.fields import DjangoModelRef | ||
|
|
||
| from ..models import APIConfig | ||
|
|
||
|
|
||
| class APIConfigConfigurationModel(ConfigurationModel): | ||
| selectielijst_service_identifier: str = DjangoModelRef( | ||
| APIConfig, "selectielijst_api_service" | ||
| ) | ||
| objecttypen_service_identifier: str = DjangoModelRef( | ||
| APIConfig, "objecttypen_api_service" | ||
| ) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| from django_setup_configuration import BaseConfigurationStep | ||
| from django_setup_configuration.exceptions import ConfigurationRunFailed | ||
| from zgw_consumers.models import Service | ||
|
|
||
| from ..models import APIConfig | ||
| from .models import APIConfigConfigurationModel | ||
|
|
||
|
|
||
| class APIConfigConfigurationStep(BaseConfigurationStep[APIConfigConfigurationModel]): | ||
| """Configure API settings""" | ||
|
|
||
| config_model = APIConfigConfigurationModel | ||
| enable_setting = "api_configuration_enabled" | ||
| namespace = "api_configuration" | ||
| verbose_name = "API Configuration" | ||
|
|
||
| def execute(self, model: APIConfigConfigurationModel) -> None: | ||
| config = APIConfig.get_solo() | ||
|
|
||
| try: | ||
| config.selectielijst_api_service = Service.objects.get( | ||
| slug=model.selectielijst_service_identifier | ||
| ) | ||
| except Service.DoesNotExist as exc: | ||
| raise ConfigurationRunFailed( | ||
| f"Could not find an existing `selectielijst` service with identifier `{model.selectielijst_service_identifier}`." | ||
| " Make sure it is already configured, manually or by first running the configuration step of `zgw_consumers`." | ||
| ) from exc | ||
|
|
||
| try: | ||
| config.objecttypen_api_service = Service.objects.get( | ||
| slug=model.objecttypen_service_identifier | ||
| ) | ||
| except Service.DoesNotExist as exc: | ||
| raise ConfigurationRunFailed( | ||
| f"Could not find an existing `objecttypen` service with identifier `{model.objecttypen_service_identifier}`." | ||
| " Make sure it is already configured, manually or by first running the configuration step of `zgw_consumers`." | ||
| ) from exc | ||
|
|
||
| config.save( | ||
| update_fields=["selectielijst_api_service", "objecttypen_api_service"] | ||
| ) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| oidc_db_config_enable: true | ||
| oidc_db_config_admin_auth: | ||
| providers: | ||
| - identifier: admin-oidc-provider | ||
| oidc_use_nonce: true | ||
| oidc_nonce_size: 32 | ||
| oidc_state_size: 32 | ||
| endpoint_config: | ||
| oidc_op_authorization_endpoint: http://localhost:28080/realms/openbeheer-dev/openid-connect/auth | ||
| oidc_op_token_endpoint: http://localhost:28080/realms/openbeheer-dev/protocol/openid-connect/token | ||
| oidc_op_user_endpoint: http://localhost:28080/realms/openbeheer-dev/protocol/openid-connect/userinfo | ||
| oidc_op_logout_endpoint: http://localhost:28080/realms/openbeheer-dev/protocol/openid-connect/logout | ||
| oidc_op_jwks_endpoint: http://localhost:28080/realms/openbeheer-dev/protocol/openid-connect/certs | ||
| items: | ||
| - identifier: admin-oidc | ||
| enabled: true | ||
| oidc_rp_client_id: openbeheer-dev | ||
| oidc_rp_client_secret: oCwSJtZVdHW6BzCFIxKnIg16nLL0x4zK | ||
| oidc_rp_scopes_list: | ||
| - openid | ||
| - profile | ||
| oidc_rp_sign_algo: RS256 | ||
| oidc_provider_identifier: admin-oidc-provider | ||
| userinfo_claims_source: id_token | ||
| options: | ||
| user_settings: | ||
| claim_mappings: | ||
| username: | ||
| - sub | ||
| first_name: | ||
| - given_name | ||
| last_name: | ||
| - family_name | ||
| email: | ||
| username_case_sensitive: true | ||
| groups_settings: | ||
| claim_mapping: | ||
| - roles | ||
| sync: true | ||
| sync_pattern: '*' | ||
| default_groups: [] | ||
| make_users_staff: true | ||
| superuser_group_names: | ||
| - Superuser | ||
|
|
||
| zgw_consumers_config_enable: true | ||
| zgw_consumers: | ||
| services: | ||
| - identifier: objecttypen-service | ||
| label: Objecttypen API | ||
| api_root: http://localhost:8004/api/v2/ | ||
| api_type: orc | ||
| auth_type: api_key | ||
| header_key: Authorization | ||
| header_value: Token 18b2b74ef994314b84021d47b9422e82b685d82f | ||
| - identifier: catalogi-service | ||
| label: Open Zaak - Catalogi API | ||
| api_root: http://localhost:8003/catalogi/api/v1/ | ||
| api_type: ztc | ||
| auth_type: zgw | ||
| client_id: test-vcr | ||
| secret: test-vcr | ||
| - identifier: selectielijst-service | ||
| label: Open Zaak (public) - Selectielijst API | ||
| api_root: https://selectielijst.openzaak.nl/api/v1/ | ||
| api_type: orc | ||
| auth_type: no_auth | ||
|
|
||
| api_configuration_enabled: true | ||
| api_configuration: | ||
| selectielijst_service_identifier: selectielijst-service | ||
| objecttypen_service_identifier: objecttypen-service |
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These cipher suites come from upstream?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Mhmm I don't know about this, I need to look into it 🤔 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| interactions: | ||
| - request: | ||
| body: null | ||
| headers: | ||
| Accept: | ||
| - '*/*' | ||
| Accept-Encoding: | ||
| - gzip, deflate | ||
| Connection: | ||
| - keep-alive | ||
| method: GET | ||
| uri: http://localhost:28080/realms/openbeheer-dev/.well-known/openid-configuration | ||
| response: | ||
| body: | ||
| string: '{"issuer":"http://localhost:28080/realms/openbeheer-dev","authorization_endpoint":"http://localhost:28080/realms/openbeheer-dev/protocol/openid-connect/auth","token_endpoint":"http://localhost:28080/realms/openbeheer-dev/protocol/openid-connect/token","introspection_endpoint":"http://localhost:28080/realms/openbeheer-dev/protocol/openid-connect/token/introspect","userinfo_endpoint":"http://localhost:28080/realms/openbeheer-dev/protocol/openid-connect/userinfo","end_session_endpoint":"http://localhost:28080/realms/openbeheer-dev/protocol/openid-connect/logout","frontchannel_logout_session_supported":true,"frontchannel_logout_supported":true,"jwks_uri":"http://localhost:28080/realms/openbeheer-dev/protocol/openid-connect/certs","check_session_iframe":"http://localhost:28080/realms/openbeheer-dev/protocol/openid-connect/login-status-iframe.html","grant_types_supported":["authorization_code","client_credentials","implicit","password","refresh_token","urn:ietf:params:oauth:grant-type:device_code","urn:ietf:params:oauth:grant-type:token-exchange","urn:ietf:params:oauth:grant-type:uma-ticket","urn:openid:params:grant-type:ciba"],"acr_values_supported":["0","1"],"response_types_supported":["code","none","id_token","token","id_token | ||
| token","code id_token","code token","code id_token token"],"subject_types_supported":["public","pairwise"],"prompt_values_supported":["none","login","consent"],"id_token_signing_alg_values_supported":["PS384","RS384","EdDSA","ES384","HS256","HS512","ES256","RS256","HS384","ES512","PS256","PS512","RS512"],"id_token_encryption_alg_values_supported":["ECDH-ES+A256KW","ECDH-ES+A192KW","ECDH-ES+A128KW","RSA-OAEP","RSA-OAEP-256","RSA1_5","ECDH-ES"],"id_token_encryption_enc_values_supported":["A256GCM","A192GCM","A128GCM","A128CBC-HS256","A192CBC-HS384","A256CBC-HS512"],"userinfo_signing_alg_values_supported":["PS384","RS384","EdDSA","ES384","HS256","HS512","ES256","RS256","HS384","ES512","PS256","PS512","RS512","none"],"userinfo_encryption_alg_values_supported":["ECDH-ES+A256KW","ECDH-ES+A192KW","ECDH-ES+A128KW","RSA-OAEP","RSA-OAEP-256","RSA1_5","ECDH-ES"],"userinfo_encryption_enc_values_supported":["A256GCM","A192GCM","A128GCM","A128CBC-HS256","A192CBC-HS384","A256CBC-HS512"],"request_object_signing_alg_values_supported":["PS384","RS384","EdDSA","ES384","HS256","HS512","ES256","RS256","HS384","ES512","PS256","PS512","RS512","none"],"request_object_encryption_alg_values_supported":["ECDH-ES+A256KW","ECDH-ES+A192KW","ECDH-ES+A128KW","RSA-OAEP","RSA-OAEP-256","RSA1_5","ECDH-ES"],"request_object_encryption_enc_values_supported":["A256GCM","A192GCM","A128GCM","A128CBC-HS256","A192CBC-HS384","A256CBC-HS512"],"response_modes_supported":["query","fragment","form_post","query.jwt","fragment.jwt","form_post.jwt","jwt"],"registration_endpoint":"http://localhost:28080/realms/openbeheer-dev/clients-registrations/openid-connect","token_endpoint_auth_methods_supported":["private_key_jwt","client_secret_basic","client_secret_post","tls_client_auth","client_secret_jwt"],"token_endpoint_auth_signing_alg_values_supported":["PS384","RS384","EdDSA","ES384","HS256","HS512","ES256","RS256","HS384","ES512","PS256","PS512","RS512"],"introspection_endpoint_auth_methods_supported":["private_key_jwt","client_secret_basic","client_secret_post","tls_client_auth","client_secret_jwt"],"introspection_endpoint_auth_signing_alg_values_supported":["PS384","RS384","EdDSA","ES384","HS256","HS512","ES256","RS256","HS384","ES512","PS256","PS512","RS512"],"authorization_signing_alg_values_supported":["PS384","RS384","EdDSA","ES384","HS256","HS512","ES256","RS256","HS384","ES512","PS256","PS512","RS512"],"authorization_encryption_alg_values_supported":["ECDH-ES+A256KW","ECDH-ES+A192KW","ECDH-ES+A128KW","RSA-OAEP","RSA-OAEP-256","RSA1_5","ECDH-ES"],"authorization_encryption_enc_values_supported":["A256GCM","A192GCM","A128GCM","A128CBC-HS256","A192CBC-HS384","A256CBC-HS512"],"claims_supported":["aud","sub","iss","auth_time","name","given_name","family_name","preferred_username","email","acr"],"claim_types_supported":["normal"],"claims_parameter_supported":true,"scopes_supported":["openid","microprofile-jwt","offline_access","roles","profile","email","address","acr","basic","web-origins","phone","service_account"],"request_parameter_supported":true,"request_uri_parameter_supported":true,"require_request_uri_registration":true,"code_challenge_methods_supported":["plain","S256"],"tls_client_certificate_bound_access_tokens":true,"revocation_endpoint":"http://localhost:28080/realms/openbeheer-dev/protocol/openid-connect/revoke","revocation_endpoint_auth_methods_supported":["private_key_jwt","client_secret_basic","client_secret_post","tls_client_auth","client_secret_jwt"],"revocation_endpoint_auth_signing_alg_values_supported":["PS384","RS384","EdDSA","ES384","HS256","HS512","ES256","RS256","HS384","ES512","PS256","PS512","RS512"],"backchannel_logout_supported":true,"backchannel_logout_session_supported":true,"device_authorization_endpoint":"http://localhost:28080/realms/openbeheer-dev/protocol/openid-connect/auth/device","backchannel_token_delivery_modes_supported":["poll","ping"],"backchannel_authentication_endpoint":"http://localhost:28080/realms/openbeheer-dev/protocol/openid-connect/ext/ciba/auth","backchannel_authentication_request_signing_alg_values_supported":["PS384","RS384","EdDSA","ES384","ES256","RS256","ES512","PS256","PS512","RS512"],"require_pushed_authorization_requests":false,"pushed_authorization_request_endpoint":"http://localhost:28080/realms/openbeheer-dev/protocol/openid-connect/ext/par/request","mtls_endpoint_aliases":{"token_endpoint":"http://localhost:28080/realms/openbeheer-dev/protocol/openid-connect/token","revocation_endpoint":"http://localhost:28080/realms/openbeheer-dev/protocol/openid-connect/revoke","introspection_endpoint":"http://localhost:28080/realms/openbeheer-dev/protocol/openid-connect/token/introspect","device_authorization_endpoint":"http://localhost:28080/realms/openbeheer-dev/protocol/openid-connect/auth/device","registration_endpoint":"http://localhost:28080/realms/openbeheer-dev/clients-registrations/openid-connect","userinfo_endpoint":"http://localhost:28080/realms/openbeheer-dev/protocol/openid-connect/userinfo","pushed_authorization_request_endpoint":"http://localhost:28080/realms/openbeheer-dev/protocol/openid-connect/ext/par/request","backchannel_authentication_endpoint":"http://localhost:28080/realms/openbeheer-dev/protocol/openid-connect/ext/ciba/auth"},"authorization_response_iss_parameter_supported":true}' | ||
| headers: | ||
| Cache-Control: | ||
| - no-cache, must-revalidate, no-transform, no-store | ||
| Content-Type: | ||
| - application/json;charset=UTF-8 | ||
| Referrer-Policy: | ||
| - no-referrer | ||
| Strict-Transport-Security: | ||
| - max-age=31536000; includeSubDomains | ||
| X-Content-Type-Options: | ||
| - nosniff | ||
| X-Frame-Options: | ||
| - SAMEORIGIN | ||
| content-length: | ||
| - '6549' | ||
| status: | ||
| code: 200 | ||
| message: OK | ||
| version: 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the order in
settings.SETUP_CONFIGURATION_STEPSnot enforce this? Or can steps be skipped?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, steps can be skipped!