|
5 | 5 | Configuration (CLI)
|
6 | 6 | ===================
|
7 | 7 |
|
8 |
| -After deploying Objecttypes API and Objects API, they need to be configured to be fully functional. The |
9 |
| -command line tool `setup_configuration`_ assist with this configuration: |
10 |
| - |
11 |
| -You can get the full command documentation with: |
12 |
| - |
13 |
| -.. code-block:: bash |
14 |
| -
|
15 |
| - src/manage.py setup_configuration --help |
16 |
| -
|
17 |
| -.. warning:: This command is declarative - if configuration is manually changed after |
18 |
| - running the command and you then run the exact same command again, the manual |
19 |
| - changes will be reverted. |
20 |
| - |
21 |
| -.. _`setup_configuration`: https://github.com/maykinmedia/django-setup-configuration/ |
22 |
| - |
23 |
| -Preparation |
24 |
| -=========== |
25 |
| - |
26 |
| -The command executes the list of pluggable configuration steps, and each step |
27 |
| -requires specific configuration information, that should be prepared. |
28 |
| -Here is the description of all available configuration steps and the configuration |
29 |
| -format, use by each step. |
| 8 | +.. setup-config-usage:: |
| 9 | + :show_command_usage: true |
| 10 | + :show_steps: false |
| 11 | + :show_steps_toc: false |
| 12 | + :show_steps_autodoc: false |
30 | 13 |
|
31 | 14 | Objects API
|
32 | 15 | ===========
|
33 | 16 |
|
34 |
| -Objecttypes configuration |
35 |
| -------------------------- |
36 |
| - |
37 |
| -To configure objecttypes the following configuration could be used: |
38 |
| - |
39 |
| -.. code-block:: yaml |
40 |
| -
|
41 |
| - zgw_consumers_config_enable: true |
42 |
| - zgw_consumers: |
43 |
| - services: |
44 |
| - - identifier: objecttypen-foo |
45 |
| - label: Objecttypen API Foo |
46 |
| - api_root: http://objecttypen.foo/api/v1/ |
47 |
| - api_type: orc |
48 |
| - auth_type: api_key |
49 |
| - header_key: Authorization |
50 |
| - header_value: Token ba9d233e95e04c4a8a661a27daffe7c9bd019067 |
51 |
| -
|
52 |
| - - identifier: objecttypen-bar |
53 |
| - label: Objecttypen API Bar |
54 |
| - api_root: http://objecttypen.bar/api/v1/ |
55 |
| - api_type: orc |
56 |
| - auth_type: api_key |
57 |
| - header_key: Authorization |
58 |
| - header_value: Token b9f100590925b529664ed9d370f5f8da124b2c20 |
59 |
| -
|
60 |
| - objecttypes_config_enable: true |
61 |
| - objecttypes: |
62 |
| - items: |
63 |
| - - uuid: b427ef84-189d-43aa-9efd-7bb2c459e281 |
64 |
| - name: Object Type 1 |
65 |
| - service_identifier: objecttypen-foo |
66 |
| -
|
67 |
| - - uuid: b0e8553f-8b1a-4d55-ab90-6d02f1bcf2c2 |
68 |
| - name: Object Type 2 |
69 |
| - service_identifier: objecttypen-bar |
70 |
| - ... |
71 |
| -
|
72 |
| -.. note:: The ``uuid`` field will be used to lookup existing ``ObjectType``'s. |
73 |
| - |
74 |
| -Objecttypes require a corresponding ``Service`` to work correctly. Creating |
75 |
| -these ``Service``'s can be done by defining these in the same yaml file. ``Service`` |
76 |
| -instances will be created before the ``ObjectType``'s are created. |
77 |
| - |
78 |
| -Objecttypes connection configuration |
79 |
| ------------------------------------- |
80 |
| - |
81 |
| -In order to be able to retrieve objecttypes, a corresponding ``Service`` should be |
82 |
| -created. An example of a configuration could be seen below: |
| 17 | +.. setup-config-usage:: |
| 18 | + :show_command_usage: false |
83 | 19 |
|
84 |
| -.. code-block:: yaml |
85 |
| -
|
86 |
| - zgw_consumers_config_enable: true |
87 |
| - zgw_consumers: |
88 |
| - services: |
89 |
| - - identifier: objecttypes-api-1 |
90 |
| - label: Objecttypes API 1 |
91 |
| - api_root: http://objecttypes-1.local/api/v1/ |
92 |
| - api_connection_check_path: objecttypes |
93 |
| - api_type: orc |
94 |
| - auth_type: api_key |
95 |
| - header_key: Authorization |
96 |
| - header_value: Token ba9d233e95e04c4a8a661a27daffe7c9bd019067 |
97 |
| - - identifier: objecttypes-api-2 |
98 |
| - label: Objecttypes API 2 |
99 |
| - api_root: http://objecttypes-2.local/api/v1/ |
100 |
| - api_connection_check_path: objecttypes |
101 |
| - api_type: orc |
102 |
| - auth_type: api_key |
103 |
| - header_key: Authorization |
104 |
| - header_value: Token b9f100590925b529664ed9d370f5f8da124b2c20 |
105 |
| -
|
106 |
| -
|
107 |
| -Tokens configuration |
108 |
| --------------------- |
109 |
| -Create or update the (single) YAML configuration file with your settings: |
110 |
| - |
111 |
| -.. code-block:: yaml |
| 20 | +Objecttypes API |
| 21 | +=============== |
112 | 22 |
|
113 |
| - tokenauth_config_enable: true |
114 |
| - tokenauth: |
115 |
| - items: |
116 |
| - - identifier: token-1 |
117 |
| - token: ba9d233e95e04c4a8a661a27daffe7c9bd019067 |
118 |
| - contact_person: Person 1 |
119 |
| - email: person-1@example.com |
120 |
| - organization: Organization XYZ # optional |
121 |
| - application: Application XYZ # optional |
122 |
| - administration: Administration XYZ # optional |
123 |
| - permissions: |
124 |
| - - object_type: b427ef84-189d-43aa-9efd-7bb2c459e281 |
125 |
| - mode: read_and_write |
126 |
| -
|
127 |
| - - identifier: token-2 |
128 |
| - token: 7b2b212d9f16d171a70a1d927cdcfbd5ca7a4799 |
129 |
| - contact_person: Person 2 |
130 |
| - email: person-2@example.com |
131 |
| - permissions: |
132 |
| - - object_type: b0e8553f-8b1a-4d55-ab90-6d02f1bcf2c2 |
133 |
| - mode: read_only |
134 |
| - use_fields: true |
135 |
| - fields: |
136 |
| - '1': |
137 |
| - - record__data__leeftijd |
138 |
| - - record__data__kiemjaar |
139 |
| -
|
140 |
| -.. note:: To ensure the proper functioning of the tokens, it is essential to first configure the ``objecttypes``. |
141 |
| - Then, the token configuration must be completed to guarantee the correct configuration of the ``Permissions``. |
142 |
| - |
143 |
| - |
144 |
| -Mozilla-django-oidc-db |
145 |
| ----------------------- |
146 |
| - |
147 |
| -Create or update the (single) YAML configuration file with your settings: |
| 23 | +.. FIXME these can currently only be included manually, because these docs are built in |
| 24 | +.. the objects API repo |
148 | 25 |
|
149 |
| -.. code-block:: yaml |
| 26 | +.. autoclass:: django_setup_configuration.contrib.sites.steps.SitesConfigurationStep |
| 27 | + :noindex: |
| 28 | +.. setup-config-example:: django_setup_configuration.contrib.sites.steps.SitesConfigurationStep |
150 | 29 |
|
151 |
| - oidc_db_config_enable: true |
152 |
| - oidc_db_config_admin_auth: |
153 |
| - items: |
154 |
| - - identifier: admin-oidc |
155 |
| - oidc_rp_client_id: client-id |
156 |
| - oidc_rp_client_secret: secret |
157 |
| - endpoint_config: |
158 |
| - oidc_op_authorization_endpoint: https://example.com/realms/test/protocol/openid-connect/auth |
159 |
| - oidc_op_token_endpoint: https://example.com/realms/test/protocol/openid-connect/token |
160 |
| - oidc_op_user_endpoint: https://example.com/realms/test/protocol/openid-connect/userinfo |
| 30 | +.. autoclass:: mozilla_django_oidc_db.setup_configuration.steps.AdminOIDCConfigurationStep |
| 31 | + :noindex: |
| 32 | +.. setup-config-example:: mozilla_django_oidc_db.setup_configuration.steps.AdminOIDCConfigurationStep |
161 | 33 |
|
162 |
| - # workaround for https://github.com/maykinmedia/django-setup-configuration/issues/27 |
163 |
| - userinfo_claims_source: id_token |
164 | 34 |
|
165 |
| -More details about configuring mozilla-django-oidc-db through ``setup_configuration`` |
166 |
| -can be found at the _`documentation`: https://mozilla-django-oidc-db.readthedocs.io/en/latest/setup_configuration.html. |
| 35 | +**objecttypes.setup_configuration.steps.token_auth.TokenAuthConfigurationStep** |
| 36 | +------------------------------------------------------------------------------- |
167 | 37 |
|
168 |
| -Sites configuration |
169 |
| -------------------- |
| 38 | +Configure tokens with permissions for other applications to access Objectstypes API |
170 | 39 |
|
171 | 40 | .. code-block:: yaml
|
172 | 41 |
|
173 |
| - sites_config_enable: true |
174 |
| - sites_config: |
175 |
| - items: |
176 |
| - - domain: example.com |
177 |
| - name: Example site |
178 |
| - - domain: test.example.com |
179 |
| - name: Test site |
| 42 | + tokenauth_config_enable: true |
| 43 | + tokenauth: |
180 | 44 |
|
181 |
| -More details about sites configuration through ``setup_configuration`` |
182 |
| -can be found at the _`site documentation`: https://github.com/maykinmedia/django-setup-configuration/blob/main/docs/sites_config.rst |
183 |
| - |
184 |
| - |
185 |
| -Notifications configuration |
186 |
| ---------------------------- |
187 |
| - |
188 |
| -To configure sending notifications for the application ensure there is a ``services`` |
189 |
| -item present that matches the ``notifications_api_service_identifier`` in the |
190 |
| -``notifications_config`` namespace: |
191 |
| - |
192 |
| -.. code-block:: yaml |
| 45 | + # REQUIRED: true |
| 46 | + items: |
| 47 | + - |
193 | 48 |
|
194 |
| - zgw_consumers_config_enable: true |
195 |
| - zgw_consumers: |
196 |
| - services: |
197 |
| - - identifier: notifications-api |
198 |
| - label: Notificaties API |
199 |
| - api_root: http://notificaties.local/api/v1/ |
200 |
| - api_connection_check_path: notificaties |
201 |
| - api_type: nrc |
202 |
| - auth_type: api_key |
| 49 | + # DESCRIPTION: A human-friendly label to refer to this token |
| 50 | + # REQUIRED: true |
| 51 | + identifier: objects-api |
203 | 52 |
|
204 |
| - notifications_config_enable: true |
205 |
| - notifications_config: |
206 |
| - notifications_api_service_identifier: notifications-api |
207 |
| - notification_delivery_max_retries: 1 |
208 |
| - notification_delivery_retry_backoff: 2 |
209 |
| - notification_delivery_retry_backoff_max: 3 |
| 53 | + # REQUIRED: true |
| 54 | + token: modify-this |
210 | 55 |
|
211 |
| -Execution |
212 |
| -========= |
| 56 | + # DESCRIPTION: Name of the person in the organization who can access the API |
| 57 | + # REQUIRED: true |
| 58 | + contact_person: example_string |
213 | 59 |
|
| 60 | + # DESCRIPTION: Email of the person, who can access the API |
| 61 | + # REQUIRED: true |
| 62 | + email: example_string |
214 | 63 |
|
215 |
| -With the full command invocation, everything is configured at once and immediately |
216 |
| -tested. |
| 64 | + # DESCRIPTION: Organization which has access to the API |
| 65 | + # DEFAULT VALUE: "" |
| 66 | + # REQUIRED: false |
| 67 | + organization: example_string |
217 | 68 |
|
218 |
| -.. code-block:: bash |
| 69 | + # DESCRIPTION: Application which has access to the API |
| 70 | + # DEFAULT VALUE: "" |
| 71 | + # REQUIRED: false |
| 72 | + application: example_string |
219 | 73 |
|
220 |
| - src/manage.py setup_configuration --yaml-file /path/to/config.yaml |
| 74 | + # DESCRIPTION: Administration which has access to the API |
| 75 | + # DEFAULT VALUE: "" |
| 76 | + # REQUIRED: false |
| 77 | + administration: example_string |
0 commit comments