dservercore 0.21.0__tar.gz → 0.23.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. {dservercore-0.21.0 → dservercore-0.23.0}/CHANGELOG.rst +101 -2
  2. {dservercore-0.21.0 → dservercore-0.23.0}/MANIFEST.in +0 -1
  3. {dservercore-0.21.0/dservercore.egg-info → dservercore-0.23.0}/PKG-INFO +120 -47
  4. dservercore-0.21.0/PKG-INFO → dservercore-0.23.0/README.rst +97 -60
  5. {dservercore-0.21.0 → dservercore-0.23.0}/docs/requirements.txt +1 -1
  6. {dservercore-0.21.0 → dservercore-0.23.0}/dservercore/__init__.py +24 -8
  7. dservercore-0.23.0/dservercore/annotations_routes.py +134 -0
  8. {dservercore-0.21.0 → dservercore-0.23.0}/dservercore/base_uri_routes.py +1 -1
  9. {dservercore-0.21.0 → dservercore-0.23.0}/dservercore/config.py +20 -1
  10. {dservercore-0.21.0 → dservercore-0.23.0}/dservercore/config_routes.py +13 -2
  11. dservercore-0.23.0/dservercore/date_utils.py +30 -0
  12. {dservercore-0.21.0 → dservercore-0.23.0}/dservercore/manifest_routes.py +2 -2
  13. {dservercore-0.21.0 → dservercore-0.23.0}/dservercore/me_routes.py +32 -7
  14. dservercore-0.23.0/dservercore/readme_routes.py +80 -0
  15. {dservercore-0.21.0 → dservercore-0.23.0}/dservercore/schemas.py +38 -4
  16. {dservercore-0.21.0 → dservercore-0.23.0}/dservercore/sort.py +0 -4
  17. {dservercore-0.21.0 → dservercore-0.23.0}/dservercore/sql_models.py +58 -7
  18. dservercore-0.23.0/dservercore/tags_routes.py +138 -0
  19. {dservercore-0.21.0 → dservercore-0.23.0}/dservercore/uri_routes.py +1 -1
  20. dservercore-0.23.0/dservercore/user_routes.py +362 -0
  21. {dservercore-0.21.0 → dservercore-0.23.0}/dservercore/utils.py +334 -26
  22. {dservercore-0.21.0 → dservercore-0.23.0}/dservercore/utils_auth.py +37 -0
  23. {dservercore-0.21.0 → dservercore-0.23.0}/dservercore/uuid_routes.py +1 -1
  24. dservercore-0.23.0/dservercore/version.py +24 -0
  25. dservercore-0.23.0/pyproject.toml +74 -0
  26. {dservercore-0.21.0 → dservercore-0.23.0}/tests/conftest.py +31 -13
  27. {dservercore-0.21.0 → dservercore-0.23.0}/tests/test_cli.py +4 -0
  28. dservercore-0.23.0/tests/test_jwt_audience_issuer.py +300 -0
  29. {dservercore-0.21.0 → dservercore-0.23.0}/tests/test_me_routes.py +15 -4
  30. dservercore-0.23.0/tests/test_readme_write_authorization.py +27 -0
  31. {dservercore-0.21.0 → dservercore-0.23.0}/tests/test_sorting.py +15 -15
  32. {dservercore-0.21.0 → dservercore-0.23.0}/tests/test_sql_dataset_utils.py +2 -0
  33. {dservercore-0.21.0 → dservercore-0.23.0}/tests/test_sql_list_datasets_by_user.py +4 -0
  34. {dservercore-0.21.0 → dservercore-0.23.0}/tests/test_summary_of_datasets_by_user.py +3 -0
  35. dservercore-0.23.0/tests/test_uploaded_by.py +148 -0
  36. {dservercore-0.21.0 → dservercore-0.23.0}/tests/test_uri_routes.py +48 -23
  37. dservercore-0.23.0/tests/test_uri_search_by_uuid.py +56 -0
  38. {dservercore-0.21.0 → dservercore-0.23.0}/tests/test_user_routes.py +311 -14
  39. {dservercore-0.21.0 → dservercore-0.23.0}/tests/test_utils_permission_management.py +6 -0
  40. {dservercore-0.21.0 → dservercore-0.23.0}/tests/test_utils_register_dataset.py +18 -3
  41. {dservercore-0.21.0 → dservercore-0.23.0}/tests/test_utils_user_management.py +14 -0
  42. dservercore-0.21.0/.github/dependabot.yml +0 -17
  43. dservercore-0.21.0/.github/workflows/publish.yml +0 -139
  44. dservercore-0.21.0/.github/workflows/test.yml +0 -61
  45. dservercore-0.21.0/README.rst +0 -804
  46. dservercore-0.21.0/dservercore/annotations_routes.py +0 -49
  47. dservercore-0.21.0/dservercore/date_utils.py +0 -22
  48. dservercore-0.21.0/dservercore/readme_routes.py +0 -48
  49. dservercore-0.21.0/dservercore/tags_routes.py +0 -49
  50. dservercore-0.21.0/dservercore/templates/index.html +0 -9
  51. dservercore-0.21.0/dservercore/user_routes.py +0 -169
  52. dservercore-0.21.0/dservercore/version.py +0 -16
  53. dservercore-0.21.0/dservercore.egg-info/SOURCES.txt +0 -105
  54. dservercore-0.21.0/dservercore.egg-info/dependency_links.txt +0 -1
  55. dservercore-0.21.0/dservercore.egg-info/entry_points.txt +0 -5
  56. dservercore-0.21.0/dservercore.egg-info/requires.txt +0 -24
  57. dservercore-0.21.0/dservercore.egg-info/top_level.txt +0 -1
  58. dservercore-0.21.0/pyproject.toml +0 -60
  59. dservercore-0.21.0/setup.cfg +0 -14
  60. {dservercore-0.21.0 → dservercore-0.23.0}/.dockerignore +0 -0
  61. {dservercore-0.21.0 → dservercore-0.23.0}/.gitignore +0 -0
  62. {dservercore-0.21.0 → dservercore-0.23.0}/.readthedocs.yaml +0 -0
  63. {dservercore-0.21.0 → dservercore-0.23.0}/CITATION.cff +0 -0
  64. {dservercore-0.21.0 → dservercore-0.23.0}/CONTRIBUTORS.rst +0 -0
  65. {dservercore-0.21.0 → dservercore-0.23.0}/LICENSE +0 -0
  66. {dservercore-0.21.0 → dservercore-0.23.0}/SPEC.rst +0 -0
  67. {dservercore-0.21.0 → dservercore-0.23.0}/docs/.gitignore +0 -0
  68. {dservercore-0.21.0 → dservercore-0.23.0}/docs/Makefile +0 -0
  69. {dservercore-0.21.0 → dservercore-0.23.0}/docs/api.rst +0 -0
  70. {dservercore-0.21.0 → dservercore-0.23.0}/docs/changelog.rst +0 -0
  71. {dservercore-0.21.0 → dservercore-0.23.0}/docs/conf.py +0 -0
  72. {dservercore-0.21.0 → dservercore-0.23.0}/docs/icons/22x22/dtool_logo.png +0 -0
  73. {dservercore-0.21.0 → dservercore-0.23.0}/docs/index.rst +0 -0
  74. {dservercore-0.21.0 → dservercore-0.23.0}/docs/make.bat +0 -0
  75. {dservercore-0.21.0 → dservercore-0.23.0}/docs/readme.rst +0 -0
  76. {dservercore-0.21.0 → dservercore-0.23.0}/dservercore/blueprint.py +0 -0
  77. {dservercore-0.21.0 → dservercore-0.23.0}/dservercore/cli.py +0 -0
  78. {dservercore-0.21.0 → dservercore-0.23.0}/dservercore/extensions.py +0 -0
  79. {dservercore-0.21.0 → dservercore-0.23.0}/icons/22x22/dtool_logo.png +0 -0
  80. {dservercore-0.21.0 → dservercore-0.23.0}/provision/.gitignore +0 -0
  81. {dservercore-0.21.0 → dservercore-0.23.0}/provision/playbook.yml +0 -0
  82. {dservercore-0.21.0 → dservercore-0.23.0}/provision/roles/dtool_lookup_server/files/start_gunicorn.sh +0 -0
  83. {dservercore-0.21.0 → dservercore-0.23.0}/provision/roles/dtool_lookup_server/tasks/main.yml +0 -0
  84. {dservercore-0.21.0 → dservercore-0.23.0}/provision/roles/dtool_lookup_server/templates/load_env.sh +0 -0
  85. {dservercore-0.21.0 → dservercore-0.23.0}/provision/roles/epel/tasks/main.yml +0 -0
  86. {dservercore-0.21.0 → dservercore-0.23.0}/provision/roles/firewalld/tasks/main.yml +0 -0
  87. {dservercore-0.21.0 → dservercore-0.23.0}/provision/roles/mongodb/tasks/main.yml +0 -0
  88. {dservercore-0.21.0 → dservercore-0.23.0}/provision/roles/nginx/files/nginx.conf +0 -0
  89. {dservercore-0.21.0 → dservercore-0.23.0}/provision/roles/nginx/handlers/main.yml +0 -0
  90. {dservercore-0.21.0 → dservercore-0.23.0}/provision/roles/nginx/tasks/main.yml +0 -0
  91. {dservercore-0.21.0 → dservercore-0.23.0}/provision/roles/nginx/templates/dtool_lookup_server.conf +0 -0
  92. {dservercore-0.21.0 → dservercore-0.23.0}/provision/roles/ntp/handlers/main.yml +0 -0
  93. {dservercore-0.21.0 → dservercore-0.23.0}/provision/roles/ntp/tasks/main.yml +0 -0
  94. {dservercore-0.21.0 → dservercore-0.23.0}/provision/roles/ntp/templates/ntp.conf +0 -0
  95. {dservercore-0.21.0 → dservercore-0.23.0}/provision/roles/python_tools/tasks/main.yml +0 -0
  96. {dservercore-0.21.0 → dservercore-0.23.0}/registration_utils/.gitignore +0 -0
  97. {dservercore-0.21.0 → dservercore-0.23.0}/registration_utils/deprecated-mass_registration.py +0 -0
  98. {dservercore-0.21.0 → dservercore-0.23.0}/registration_utils/get_token.sh +0 -0
  99. {dservercore-0.21.0 → dservercore-0.23.0}/registration_utils/register.py +0 -0
  100. {dservercore-0.21.0 → dservercore-0.23.0}/registration_utils/requirements.txt +0 -0
  101. {dservercore-0.21.0 → dservercore-0.23.0}/requirements.txt +0 -0
  102. {dservercore-0.21.0 → dservercore-0.23.0}/tests/test_base_uri_routes.py +0 -0
  103. {dservercore-0.21.0 → dservercore-0.23.0}/tests/test_config.py +0 -0
  104. {dservercore-0.21.0 → dservercore-0.23.0}/tests/test_config_routes.py +0 -0
  105. {dservercore-0.21.0 → dservercore-0.23.0}/tests/test_lookup_datasets_by_user_and_uuid.py +0 -0
  106. {dservercore-0.21.0 → dservercore-0.23.0}/tests/test_metadata_retrieval_routes.py +0 -0
  107. {dservercore-0.21.0 → dservercore-0.23.0}/tests/test_timestamp_consistency.py +0 -0
  108. {dservercore-0.21.0 → dservercore-0.23.0}/tests/test_utils.py +0 -0
  109. {dservercore-0.21.0 → dservercore-0.23.0}/tests/test_utils_auth.py +0 -0
  110. {dservercore-0.21.0 → dservercore-0.23.0}/tests/test_utils_base_uri_management.py +0 -0
  111. {dservercore-0.21.0 → dservercore-0.23.0}/tests/test_utils_dataset_info_is_valid.py +0 -0
  112. {dservercore-0.21.0 → dservercore-0.23.0}/tests/test_utils_get_annotations_from_uri_by_user.py +0 -0
  113. {dservercore-0.21.0 → dservercore-0.23.0}/tests/test_utils_get_manifest_from_uri_by_user.py +0 -0
  114. {dservercore-0.21.0 → dservercore-0.23.0}/tests/test_utils_get_readme_from_uri_by_user.py +0 -0
  115. {dservercore-0.21.0 → dservercore-0.23.0}/tests/test_utils_preprocess_query_base_uris.py +0 -0
  116. {dservercore-0.21.0 → dservercore-0.23.0}/tests/test_uuid_routes.py +0 -0
  117. {dservercore-0.21.0 → dservercore-0.23.0}/tox.ini +0 -0
@@ -4,6 +4,105 @@ CHANGELOG
4
4
  This project uses `semantic versioning <http://semver.org/>`_.
5
5
  This change log uses principles from `keep a changelog <http://keepachangelog.com/>`_.
6
6
 
7
+ [0.23.0] - 2026-11-30
8
+ ---------------------
9
+
10
+ Upgrading: run ``flask db migrate`` and ``flask db upgrade`` to add the new
11
+ columns to the SQL database (see Changed), and make sure all token issuers
12
+ set the ``aud`` and ``iss`` claims (or disable the checks).
13
+
14
+ Changed
15
+ ^^^^^^^
16
+
17
+ - **Breaking:** tokens must have audience (``aud``) and issuer (``iss``)
18
+ ``dserver``; other tokens are rejected with 422. This rejects tokens signed
19
+ with the same key for another purpose. Configure with
20
+ ``JWT_DECODE_AUDIENCE`` / ``JWT_DECODE_ISSUER``; an empty (or blank) value
21
+ disables the respective check. Tokens from ``flask user token`` carry the
22
+ configured claims, as do tokens from the dserver token generator plugins
23
+ (OAuth2, LDAP). The standalone ``token-generator-ldap`` must be updated, or
24
+ the checks disabled; other token issuers must add the claims. See
25
+ "Audience and issuer of JSON Web Tokens" in the README
26
+ - **Breaking:** dropped support for Python 3.7, 3.8 and 3.9; the minimum is
27
+ now Python 3.10 (tested up to 3.14)
28
+ - **Breaking:** the SQL schema changed and needs a database migration: new
29
+ columns ``user.display_name``, ``dataset.uploaded_by`` and
30
+ ``dataset.uploaded_at``; ``base_uri.base_uri`` and ``dataset.uri`` are
31
+ widened from 255 to 1024 characters
32
+ - Annotation values in ``/annotations`` responses may be any JSON value, not
33
+ only strings
34
+ - Supports Flask 3 (removed the ``flask<3`` upper bound) and marshmallow 4
35
+ - Requires ``flask-jwt-extended>=4.7.0``
36
+ - Build backend changed from ``setuptools``/``setuptools_scm`` to
37
+ ``hatchling``/``hatch-vcs``; the version is still derived from git tags
38
+
39
+ Added
40
+ ^^^^^
41
+
42
+ - Health check endpoint ``GET /config/health`` for container orchestration
43
+ (does not require authorization)
44
+ - Routes to modify dataset tags, annotations and README, written to the
45
+ search and retrieve databases and to the dataset in storage; they require
46
+ register permission on the dataset's base URI:
47
+
48
+ - ``PUT /tags/<uri>`` - replace all tags
49
+ - ``POST /tags/<uri>/<tag>`` - add a tag
50
+ - ``DELETE /tags/<uri>/<tag>`` - remove a tag
51
+ - ``PUT /annotations/<uri>`` - replace all annotations
52
+ - ``PUT /annotations/<uri>/<name>`` - set one annotation
53
+ - ``DELETE /annotations/<uri>/<name>`` - delete one annotation
54
+ - ``PUT /readmes/<uri>`` - replace the README
55
+
56
+ Updating the databases needs search and retrieve plugins that implement
57
+ ``set_tags``, ``set_annotations`` and ``set_readme`` (not yet in
58
+ ``dserver-search-plugin-mongo`` / ``dserver-retrieve-plugin-mongo`` 0.4.2);
59
+ with older plugins only the dataset in storage is updated
60
+ - User management routes (admin only):
61
+
62
+ - ``PATCH /users/<username>`` - update ``is_admin`` and/or ``display_name``
63
+ - ``POST`` / ``DELETE /users/<username>/search/<base_uri>`` - grant / revoke
64
+ search permission
65
+ - ``POST`` / ``DELETE /users/<username>/register/<base_uri>`` - grant /
66
+ revoke register permission
67
+
68
+ - Optional ``display_name`` for users, returned with user information, set
69
+ through ``PUT`` / ``PATCH /users/<username>`` or by the user through
70
+ ``PATCH /me``
71
+ - Datasets record the authenticated user who registered them
72
+ (``uploaded_by``) and when (``uploaded_at``); clients cannot set these.
73
+ Registrations outside an authenticated request (CLI, indexer) leave
74
+ ``uploaded_by`` empty
75
+ - ``uploaded_by`` search filter (needs search plugin support) and
76
+ ``uploaders``, ``datasets_per_uploader`` and ``size_in_bytes_per_uploader``
77
+ in user summaries
78
+
79
+ Removed
80
+ ^^^^^^^
81
+
82
+ - Unused ``flask-pymongo`` dependency
83
+ - ``JSONIFY_PRETTYPRINT_REGULAR`` config key (no longer used by Flask 3)
84
+
85
+ Fixed
86
+ ^^^^^
87
+
88
+ - Searching by ``uuids`` found no datasets
89
+ - ``GET /users`` now lists each user's search and register permissions
90
+ - User summaries no longer fail for datasets without ``size_in_bytes``
91
+ - OpenAPI documentation of the 401 response of ``GET /tags/<uri>`` and
92
+ ``GET /manifests/<uri>``
93
+ - ``myst-parser==4.0.0`` pin in the docs requirements relaxed to
94
+ ``myst-parser>=5.0``
95
+
96
+ [0.22.0]
97
+ ------------
98
+
99
+ Changed
100
+ ^^^^^^^
101
+
102
+ - ``pkg_resources`` has been deprecated with Python 3.12. Replaced use of ``pkg_resources.iter_entry_points`` with ``importlib.metadata.entry_points`` for >= Python 3.8
103
+ - Added configuration option ``DISABLE_JWT_AUTHORISATION`` to disable JWT authorisation for testing purposes or for running locally
104
+ - Added configuration option ``DEFAULT_USER`` to specify the default user identity used when JWT authorisation is disabled
105
+
7
106
  [0.21.0]
8
107
  --------
9
108
 
@@ -207,11 +306,11 @@ Added
207
306
 
208
307
  - Added hook to allow the loading of plugins. Scaffold code for implementing a
209
308
  plugin can be found in
210
- https://github.com/livMatS/dserver-plugin-scaffolding.
309
+ https://github.com/livMatS/dtool-lookup-server-plugin-scaffolding.
211
310
  For examples of actual plugins see:
212
311
  https://github.com/livMatS/dserver-dependency-graph-plugin
213
312
  and
214
- https://github.com/livMatS/dserver-plugin-scaffolding
313
+ https://github.com/livMatS/dtool-lookup-server-plugin-scaffolding
215
314
  - Added /config route; see
216
315
  https://github.com/jic-dtool/dservercore/pull/6
217
316
  - Added ability to filter searches by UUID by supplying ``uuids`` keyword and list of
@@ -1,3 +1,2 @@
1
1
  include README.rst
2
2
  include LICENSE
3
- include dserver/templates/*
@@ -1,57 +1,38 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.5
2
2
  Name: dservercore
3
- Version: 0.21.0
3
+ Version: 0.23.0
4
4
  Summary: Web API to register/lookup/search for dtool dataset metadata
5
- Author-email: Tjelvar Olsson <tjelvar.olsson@gmail.com>
6
- License: MIT License
7
-
8
- Copyright (c) 2018 jic-dtool
9
-
10
- Permission is hereby granted, free of charge, to any person obtaining a copy
11
- of this software and associated documentation files (the "Software"), to deal
12
- in the Software without restriction, including without limitation the rights
13
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
- copies of the Software, and to permit persons to whom the Software is
15
- furnished to do so, subject to the following conditions:
16
-
17
- The above copyright notice and this permission notice shall be included in all
18
- copies or substantial portions of the Software.
19
-
20
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
- SOFTWARE.
27
-
28
5
  Project-URL: Documentation, https://dservercore.readthedocs.io
29
6
  Project-URL: Repository, https://github.com/jic-dtool/dservercore
30
7
  Project-URL: Changelog, https://github.com/jic-dtool/dservercore/blob/main/CHANGELOG.rst
31
- Description-Content-Type: text/x-rst
8
+ Author-email: Tjelvar Olsson <tjelvar.olsson@gmail.com>
9
+ License: MIT
32
10
  License-File: LICENSE
33
- Requires-Dist: setuptools
34
- Requires-Dist: flask<3
35
- Requires-Dist: pymongo
11
+ Requires-Python: >=3.10
36
12
  Requires-Dist: alembic
37
- Requires-Dist: flask-sqlalchemy
38
- Requires-Dist: flask-migrate
39
- Requires-Dist: flask-pymongo
13
+ Requires-Dist: dtoolcore>=3.18.0
14
+ Requires-Dist: flask
15
+ Requires-Dist: flask-cors
16
+ Requires-Dist: flask-jwt-extended[asymmetric-crypto]>=4.7.0
40
17
  Requires-Dist: flask-marshmallow
18
+ Requires-Dist: flask-migrate
41
19
  Requires-Dist: flask-smorest
20
+ Requires-Dist: flask-sqlalchemy
42
21
  Requires-Dist: marshmallow-sqlalchemy
43
- Requires-Dist: flask-cors
44
- Requires-Dist: dtoolcore>=3.18.0
45
- Requires-Dist: flask-jwt-extended[asymmetric_crypto]>=4.0
22
+ Requires-Dist: pymongo
46
23
  Requires-Dist: pyyaml
47
- Provides-Extra: test
48
- Requires-Dist: pytest; extra == "test"
49
- Requires-Dist: pytest-cov; extra == "test"
24
+ Requires-Dist: setuptools
50
25
  Provides-Extra: docs
51
- Requires-Dist: sphinx; extra == "docs"
52
- Requires-Dist: sphinx_rtd_theme; extra == "docs"
53
- Requires-Dist: sphinxcontrib-spelling; extra == "docs"
54
- Requires-Dist: myst-parser==4.0.0; extra == "docs"
26
+ Requires-Dist: myst-parser>=5.0; extra == 'docs'
27
+ Requires-Dist: sphinx; extra == 'docs'
28
+ Requires-Dist: sphinx-rtd-theme; extra == 'docs'
29
+ Requires-Dist: sphinxcontrib-spelling; extra == 'docs'
30
+ Provides-Extra: test
31
+ Requires-Dist: dserver-retrieve-plugin-mongo; extra == 'test'
32
+ Requires-Dist: dserver-search-plugin-mongo; extra == 'test'
33
+ Requires-Dist: pytest; extra == 'test'
34
+ Requires-Dist: pytest-cov; extra == 'test'
35
+ Description-Content-Type: text/x-rst
55
36
 
56
37
  dservercore
57
38
  ===========
@@ -109,8 +90,8 @@ manage users, base URIs and users' permissions on those base URIs.
109
90
  <https://github.com/jic-dtool/dtool-lookup-client>`_, and the
110
91
  `dtool-lookup-webapp <https://github.com/jic-dtool/dtool-lookup-webapp>`_.
111
92
  Third party applications making use of the dserver have also been
112
- created, notably the `livMatS/dtool-lookup-gui
113
- <https://github.com/livMatS/dtool-lookup-gui>`_.
93
+ created, notably the `jic-dtool/dtool-lookup-gui
94
+ <https://github.com/jic-dtool/dtool-lookup-gui>`_.
114
95
 
115
96
  ``dservercore`` provides the core Flask app central to dserver's
116
97
  modular, pluggable framework.
@@ -236,6 +217,34 @@ file::
236
217
 
237
218
  export JWT_PUBLIC_KEY="ssh-rsa XXXXXX user@localhost"
238
219
 
220
+ Audience and issuer of JSON Web Tokens
221
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
222
+
223
+ dserver only accepts tokens whose audience (``aud`` claim) and issuer (``iss``
224
+ claim) are ``dserver``; other tokens are rejected with 422, as tokens with an
225
+ invalid signature. This keeps tokens signed with the same key for another
226
+ purpose out. Configure the expected values, or disable a check by setting it to
227
+ an empty value::
228
+
229
+ export JWT_DECODE_AUDIENCE=dserver
230
+ export JWT_DECODE_ISSUER=my-identity-provider
231
+
232
+ Every token issuer must issue tokens with these values:
233
+
234
+ - ``flask user token`` uses ``JWT_DECODE_AUDIENCE`` / ``JWT_DECODE_ISSUER``.
235
+ - The dserver token generator plugins (OAuth2, LDAP) run inside dserver and use
236
+ the same values, unless their own ``JWT_AUDIENCE`` / ``JWT_ISSUER`` are set.
237
+ If you set those, they must match ``JWT_DECODE_AUDIENCE`` /
238
+ ``JWT_DECODE_ISSUER``, or dserver rejects every token the plugin issues.
239
+ - The standalone `token-generator-ldap
240
+ <https://github.com/jic-dtool/token-generator-ldap>`_ issues tokens with
241
+ these claims only in recent versions (configurable with ``JWT_AUDIENCE`` /
242
+ ``JWT_ISSUER``); older installations issue tokens without them. Update it,
243
+ or disable the checks with empty ``JWT_DECODE_AUDIENCE`` and
244
+ ``JWT_DECODE_ISSUER``.
245
+ - Other token issuers must add ``"aud": "dserver"`` and ``"iss": "dserver"``
246
+ (or the configured values) to their tokens.
247
+
239
248
  Inspecting the flask app configuration
240
249
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
241
250
 
@@ -559,6 +568,57 @@ URI ``s3://dtool-demo/ba92a5fa-d3b4-4f10-bcb9-947f62e652db``::
559
568
  http://localhost:5000/manifests/s3/dtool-demo/ba92a5fa-d3b4-4f10-bcb9-947f62e652db
560
569
 
561
570
 
571
+ Modifying dataset tags
572
+ ~~~~~~~~~~~~~~~~~~~~~~
573
+
574
+ Add a single tag to a dataset::
575
+
576
+ $ curl -H "$HEADER" -X POST \
577
+ http://localhost:5000/tags/s3/dtool-demo/ba92a5fa-d3b4-4f10-bcb9-947f62e652db/new-tag
578
+
579
+ Replace all tags on a dataset::
580
+
581
+ $ curl -H "$HEADER" -H "Content-Type: application/json" \
582
+ -X PUT -d '{"tags": ["tag1", "tag2"]}' \
583
+ http://localhost:5000/tags/s3/dtool-demo/ba92a5fa-d3b4-4f10-bcb9-947f62e652db
584
+
585
+ Remove a tag from a dataset::
586
+
587
+ $ curl -H "$HEADER" -X DELETE \
588
+ http://localhost:5000/tags/s3/dtool-demo/ba92a5fa-d3b4-4f10-bcb9-947f62e652db/old-tag
589
+
590
+
591
+ Modifying dataset annotations
592
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
593
+
594
+ Set a single annotation on a dataset::
595
+
596
+ $ curl -H "$HEADER" -H "Content-Type: application/json" \
597
+ -X PUT -d '{"value": "some value"}' \
598
+ http://localhost:5000/annotations/s3/dtool-demo/ba92a5fa-d3b4-4f10-bcb9-947f62e652db/my-annotation
599
+
600
+ Replace all annotations on a dataset::
601
+
602
+ $ curl -H "$HEADER" -H "Content-Type: application/json" \
603
+ -X PUT -d '{"annotations": {"key1": "value1", "key2": 42}}' \
604
+ http://localhost:5000/annotations/s3/dtool-demo/ba92a5fa-d3b4-4f10-bcb9-947f62e652db
605
+
606
+ Delete an annotation from a dataset::
607
+
608
+ $ curl -H "$HEADER" -X DELETE \
609
+ http://localhost:5000/annotations/s3/dtool-demo/ba92a5fa-d3b4-4f10-bcb9-947f62e652db/my-annotation
610
+
611
+
612
+ Modifying dataset README
613
+ ~~~~~~~~~~~~~~~~~~~~~~~~
614
+
615
+ Update the README of a dataset::
616
+
617
+ $ curl -H "$HEADER" -H "Content-Type: application/json" \
618
+ -X PUT -d '{"readme": "---\ndescription: Updated README content\n"}' \
619
+ http://localhost:5000/readmes/s3/dtool-demo/ba92a5fa-d3b4-4f10-bcb9-947f62e652db
620
+
621
+
562
622
  Getting information about one's own permissions
563
623
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
564
624
 
@@ -782,6 +842,19 @@ and extension plugins with their versions, i.e.::
782
842
 
783
843
  This request does not require any authorization.
784
844
 
845
+ The request::
846
+
847
+ $ curl http://localhost:5000/config/health
848
+
849
+ will return a simple health check status for container orchestration::
850
+
851
+ {
852
+ "status": "healthy"
853
+ }
854
+
855
+ This request does not require any authorization and can be used for
856
+ Kubernetes liveness/readiness probes or Docker health checks.
857
+
785
858
  Creating a plugin
786
859
  -----------------
787
860
 
@@ -854,6 +927,6 @@ A respective entry in a ``pyproject.toml`` would look as follows.
854
927
 
855
928
  Examples of actual plugins include:
856
929
 
857
- - `dserver-direct-mongo-plugin <https://github.com/livMatS/dserver-direct-mongo-plugin>`_
858
- - `dserver-dependency-graph-plugin <https://github.com/livMatS/dserver-dependency-graph-plugin>`_
859
- - `dserver-notification-plugin <https://github.com/livMatS/dserver-notification-plugin>`_
930
+ - `dserver-direct-mongo-plugin <https://github.com/jic-dtool/dserver-direct-mongo-plugin>`_
931
+ - `dserver-dependency-graph-plugin <https://github.com/jic-dtool/dserver-dependency-graph-plugin>`_
932
+ - `dserver-notification-plugin <https://github.com/jic-dtool/dserver-notification-plugin>`_
@@ -1,58 +1,3 @@
1
- Metadata-Version: 2.1
2
- Name: dservercore
3
- Version: 0.21.0
4
- Summary: Web API to register/lookup/search for dtool dataset metadata
5
- Author-email: Tjelvar Olsson <tjelvar.olsson@gmail.com>
6
- License: MIT License
7
-
8
- Copyright (c) 2018 jic-dtool
9
-
10
- Permission is hereby granted, free of charge, to any person obtaining a copy
11
- of this software and associated documentation files (the "Software"), to deal
12
- in the Software without restriction, including without limitation the rights
13
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
- copies of the Software, and to permit persons to whom the Software is
15
- furnished to do so, subject to the following conditions:
16
-
17
- The above copyright notice and this permission notice shall be included in all
18
- copies or substantial portions of the Software.
19
-
20
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
- SOFTWARE.
27
-
28
- Project-URL: Documentation, https://dservercore.readthedocs.io
29
- Project-URL: Repository, https://github.com/jic-dtool/dservercore
30
- Project-URL: Changelog, https://github.com/jic-dtool/dservercore/blob/main/CHANGELOG.rst
31
- Description-Content-Type: text/x-rst
32
- License-File: LICENSE
33
- Requires-Dist: setuptools
34
- Requires-Dist: flask<3
35
- Requires-Dist: pymongo
36
- Requires-Dist: alembic
37
- Requires-Dist: flask-sqlalchemy
38
- Requires-Dist: flask-migrate
39
- Requires-Dist: flask-pymongo
40
- Requires-Dist: flask-marshmallow
41
- Requires-Dist: flask-smorest
42
- Requires-Dist: marshmallow-sqlalchemy
43
- Requires-Dist: flask-cors
44
- Requires-Dist: dtoolcore>=3.18.0
45
- Requires-Dist: flask-jwt-extended[asymmetric_crypto]>=4.0
46
- Requires-Dist: pyyaml
47
- Provides-Extra: test
48
- Requires-Dist: pytest; extra == "test"
49
- Requires-Dist: pytest-cov; extra == "test"
50
- Provides-Extra: docs
51
- Requires-Dist: sphinx; extra == "docs"
52
- Requires-Dist: sphinx_rtd_theme; extra == "docs"
53
- Requires-Dist: sphinxcontrib-spelling; extra == "docs"
54
- Requires-Dist: myst-parser==4.0.0; extra == "docs"
55
-
56
1
  dservercore
57
2
  ===========
58
3
 
@@ -109,8 +54,8 @@ manage users, base URIs and users' permissions on those base URIs.
109
54
  <https://github.com/jic-dtool/dtool-lookup-client>`_, and the
110
55
  `dtool-lookup-webapp <https://github.com/jic-dtool/dtool-lookup-webapp>`_.
111
56
  Third party applications making use of the dserver have also been
112
- created, notably the `livMatS/dtool-lookup-gui
113
- <https://github.com/livMatS/dtool-lookup-gui>`_.
57
+ created, notably the `jic-dtool/dtool-lookup-gui
58
+ <https://github.com/jic-dtool/dtool-lookup-gui>`_.
114
59
 
115
60
  ``dservercore`` provides the core Flask app central to dserver's
116
61
  modular, pluggable framework.
@@ -236,6 +181,34 @@ file::
236
181
 
237
182
  export JWT_PUBLIC_KEY="ssh-rsa XXXXXX user@localhost"
238
183
 
184
+ Audience and issuer of JSON Web Tokens
185
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
186
+
187
+ dserver only accepts tokens whose audience (``aud`` claim) and issuer (``iss``
188
+ claim) are ``dserver``; other tokens are rejected with 422, as tokens with an
189
+ invalid signature. This keeps tokens signed with the same key for another
190
+ purpose out. Configure the expected values, or disable a check by setting it to
191
+ an empty value::
192
+
193
+ export JWT_DECODE_AUDIENCE=dserver
194
+ export JWT_DECODE_ISSUER=my-identity-provider
195
+
196
+ Every token issuer must issue tokens with these values:
197
+
198
+ - ``flask user token`` uses ``JWT_DECODE_AUDIENCE`` / ``JWT_DECODE_ISSUER``.
199
+ - The dserver token generator plugins (OAuth2, LDAP) run inside dserver and use
200
+ the same values, unless their own ``JWT_AUDIENCE`` / ``JWT_ISSUER`` are set.
201
+ If you set those, they must match ``JWT_DECODE_AUDIENCE`` /
202
+ ``JWT_DECODE_ISSUER``, or dserver rejects every token the plugin issues.
203
+ - The standalone `token-generator-ldap
204
+ <https://github.com/jic-dtool/token-generator-ldap>`_ issues tokens with
205
+ these claims only in recent versions (configurable with ``JWT_AUDIENCE`` /
206
+ ``JWT_ISSUER``); older installations issue tokens without them. Update it,
207
+ or disable the checks with empty ``JWT_DECODE_AUDIENCE`` and
208
+ ``JWT_DECODE_ISSUER``.
209
+ - Other token issuers must add ``"aud": "dserver"`` and ``"iss": "dserver"``
210
+ (or the configured values) to their tokens.
211
+
239
212
  Inspecting the flask app configuration
240
213
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
241
214
 
@@ -559,6 +532,57 @@ URI ``s3://dtool-demo/ba92a5fa-d3b4-4f10-bcb9-947f62e652db``::
559
532
  http://localhost:5000/manifests/s3/dtool-demo/ba92a5fa-d3b4-4f10-bcb9-947f62e652db
560
533
 
561
534
 
535
+ Modifying dataset tags
536
+ ~~~~~~~~~~~~~~~~~~~~~~
537
+
538
+ Add a single tag to a dataset::
539
+
540
+ $ curl -H "$HEADER" -X POST \
541
+ http://localhost:5000/tags/s3/dtool-demo/ba92a5fa-d3b4-4f10-bcb9-947f62e652db/new-tag
542
+
543
+ Replace all tags on a dataset::
544
+
545
+ $ curl -H "$HEADER" -H "Content-Type: application/json" \
546
+ -X PUT -d '{"tags": ["tag1", "tag2"]}' \
547
+ http://localhost:5000/tags/s3/dtool-demo/ba92a5fa-d3b4-4f10-bcb9-947f62e652db
548
+
549
+ Remove a tag from a dataset::
550
+
551
+ $ curl -H "$HEADER" -X DELETE \
552
+ http://localhost:5000/tags/s3/dtool-demo/ba92a5fa-d3b4-4f10-bcb9-947f62e652db/old-tag
553
+
554
+
555
+ Modifying dataset annotations
556
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
557
+
558
+ Set a single annotation on a dataset::
559
+
560
+ $ curl -H "$HEADER" -H "Content-Type: application/json" \
561
+ -X PUT -d '{"value": "some value"}' \
562
+ http://localhost:5000/annotations/s3/dtool-demo/ba92a5fa-d3b4-4f10-bcb9-947f62e652db/my-annotation
563
+
564
+ Replace all annotations on a dataset::
565
+
566
+ $ curl -H "$HEADER" -H "Content-Type: application/json" \
567
+ -X PUT -d '{"annotations": {"key1": "value1", "key2": 42}}' \
568
+ http://localhost:5000/annotations/s3/dtool-demo/ba92a5fa-d3b4-4f10-bcb9-947f62e652db
569
+
570
+ Delete an annotation from a dataset::
571
+
572
+ $ curl -H "$HEADER" -X DELETE \
573
+ http://localhost:5000/annotations/s3/dtool-demo/ba92a5fa-d3b4-4f10-bcb9-947f62e652db/my-annotation
574
+
575
+
576
+ Modifying dataset README
577
+ ~~~~~~~~~~~~~~~~~~~~~~~~
578
+
579
+ Update the README of a dataset::
580
+
581
+ $ curl -H "$HEADER" -H "Content-Type: application/json" \
582
+ -X PUT -d '{"readme": "---\ndescription: Updated README content\n"}' \
583
+ http://localhost:5000/readmes/s3/dtool-demo/ba92a5fa-d3b4-4f10-bcb9-947f62e652db
584
+
585
+
562
586
  Getting information about one's own permissions
563
587
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
564
588
 
@@ -782,6 +806,19 @@ and extension plugins with their versions, i.e.::
782
806
 
783
807
  This request does not require any authorization.
784
808
 
809
+ The request::
810
+
811
+ $ curl http://localhost:5000/config/health
812
+
813
+ will return a simple health check status for container orchestration::
814
+
815
+ {
816
+ "status": "healthy"
817
+ }
818
+
819
+ This request does not require any authorization and can be used for
820
+ Kubernetes liveness/readiness probes or Docker health checks.
821
+
785
822
  Creating a plugin
786
823
  -----------------
787
824
 
@@ -854,6 +891,6 @@ A respective entry in a ``pyproject.toml`` would look as follows.
854
891
 
855
892
  Examples of actual plugins include:
856
893
 
857
- - `dserver-direct-mongo-plugin <https://github.com/livMatS/dserver-direct-mongo-plugin>`_
858
- - `dserver-dependency-graph-plugin <https://github.com/livMatS/dserver-dependency-graph-plugin>`_
859
- - `dserver-notification-plugin <https://github.com/livMatS/dserver-notification-plugin>`_
894
+ - `dserver-direct-mongo-plugin <https://github.com/jic-dtool/dserver-direct-mongo-plugin>`_
895
+ - `dserver-dependency-graph-plugin <https://github.com/jic-dtool/dserver-dependency-graph-plugin>`_
896
+ - `dserver-notification-plugin <https://github.com/jic-dtool/dserver-notification-plugin>`_
@@ -1,4 +1,4 @@
1
1
  sphinx
2
2
  sphinx_rtd_theme
3
3
  sphinxcontrib-spelling
4
- myst-parser==4.0.0
4
+ myst-parser>=5.0
@@ -18,10 +18,6 @@ from dservercore.schemas import SearchDatasetSchema, RegisterDatasetSchema
18
18
  from dservercore.sort import SortParameters
19
19
  from dservercore.sql_models import DatasetSchema
20
20
 
21
-
22
- from pkg_resources import iter_entry_points
23
-
24
-
25
21
  logger = logging.getLogger(__name__)
26
22
 
27
23
  # workaround for diverging python versions:
@@ -37,7 +33,7 @@ try:
37
33
  __version__ = version(__name__)
38
34
  logger.debug("Determined version %s via importlib_metadata.version", __version__)
39
35
  except PackageNotFoundError:
40
- # if that fails, check for static version file written by setuptools_scm
36
+ # if that fails, check for static version file written by hatch-vcs
41
37
  try:
42
38
  from .version import version as __version__
43
39
  logger.debug("Determined version %s from autogenerated dserver_retrieve_plugin/version.py", __version__)
@@ -46,6 +42,18 @@ except PackageNotFoundError:
46
42
  __version__ = None
47
43
 
48
44
 
45
+ from importlib.metadata import entry_points
46
+ eps = entry_points()
47
+ if sys.version_info >= (3, 10):
48
+ search_entrypoints_iterator = eps.select(group="dservercore.search")
49
+ retrieve_entrypoints_iterator = eps.select(group="dservercore.retrieve")
50
+ extension_entrypoints_iterator = eps.select(group="dservercore.extension")
51
+ else:
52
+ search_entrypoints_iterator = eps.get("dservercore.search", [])
53
+ retrieve_entrypoints_iterator = eps.get("dservercore.retrieve", [])
54
+ extension_entrypoints_iterator = eps.get("dservercore.extension", [])
55
+
56
+
49
57
  class ValidationError(ValueError):
50
58
  pass
51
59
 
@@ -228,9 +236,10 @@ class ExtensionABC(ABC):
228
236
  def create_app(test_config=None):
229
237
  app = Flask(__name__)
230
238
 
239
+
231
240
  # Load the search plugin.
232
241
  search_entrypoints = []
233
- for entrypoint in iter_entry_points("dservercore.search"):
242
+ for entrypoint in search_entrypoints_iterator:
234
243
  logger.info("Discovered search plugin entrypoint %s", entrypoint)
235
244
  search_entrypoints.append(entrypoint.load())
236
245
  if len(search_entrypoints) < 1:
@@ -241,7 +250,7 @@ def create_app(test_config=None):
241
250
 
242
251
  # Load the retrieve plugin.
243
252
  retrieve_entrypoints = []
244
- for entrypoint in iter_entry_points("dservercore.retrieve"):
253
+ for entrypoint in retrieve_entrypoints_iterator:
245
254
  logger.info("Discovered retrieve plugin entrypoint %s", entrypoint)
246
255
  retrieve_entrypoints.append(entrypoint.load())
247
256
  if len(retrieve_entrypoints) < 1:
@@ -252,7 +261,7 @@ def create_app(test_config=None):
252
261
 
253
262
  # Load any extension plugins.
254
263
  app.custom_extensions = []
255
- for entrypoint in iter_entry_points("dservercore.extension"):
264
+ for entrypoint in extension_entrypoints_iterator:
256
265
  logger.info("Discovered extension plugin entrypoint %s", entrypoint)
257
266
  ep = entrypoint.load()
258
267
  app.custom_extensions.append(ep())
@@ -276,6 +285,13 @@ def create_app(test_config=None):
276
285
  # load the test config if passed in
277
286
  app.config.from_mapping(test_config)
278
287
 
288
+ # A blank audience or issuer disables the check, also when set through a
289
+ # test or plugin config; flask-jwt-extended only skips it for None.
290
+ for key in ("JWT_DECODE_AUDIENCE", "JWT_DECODE_ISSUER",
291
+ "JWT_ENCODE_AUDIENCE", "JWT_ENCODE_ISSUER"):
292
+ if isinstance(app.config.get(key), str):
293
+ app.config[key] = app.config[key].strip() or None
294
+
279
295
  CORS(app)
280
296
 
281
297
  for plugin in app.plugins: