dservercore 0.22.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.22.0 → dservercore-0.23.0}/CHANGELOG.rst +91 -2
  2. {dservercore-0.22.0 → dservercore-0.23.0}/MANIFEST.in +0 -1
  3. {dservercore-0.22.0/dservercore.egg-info → dservercore-0.23.0}/PKG-INFO +120 -48
  4. dservercore-0.22.0/PKG-INFO → dservercore-0.23.0/README.rst +97 -61
  5. {dservercore-0.22.0 → dservercore-0.23.0}/docs/requirements.txt +1 -1
  6. {dservercore-0.22.0 → dservercore-0.23.0}/dservercore/__init__.py +18 -19
  7. dservercore-0.23.0/dservercore/annotations_routes.py +134 -0
  8. {dservercore-0.22.0 → dservercore-0.23.0}/dservercore/config.py +16 -2
  9. {dservercore-0.22.0 → dservercore-0.23.0}/dservercore/config_routes.py +12 -1
  10. dservercore-0.23.0/dservercore/date_utils.py +30 -0
  11. {dservercore-0.22.0 → dservercore-0.23.0}/dservercore/manifest_routes.py +1 -1
  12. {dservercore-0.22.0 → dservercore-0.23.0}/dservercore/me_routes.py +31 -6
  13. dservercore-0.23.0/dservercore/readme_routes.py +80 -0
  14. {dservercore-0.22.0 → dservercore-0.23.0}/dservercore/schemas.py +38 -4
  15. {dservercore-0.22.0 → dservercore-0.23.0}/dservercore/sort.py +0 -4
  16. {dservercore-0.22.0 → dservercore-0.23.0}/dservercore/sql_models.py +58 -7
  17. dservercore-0.23.0/dservercore/tags_routes.py +138 -0
  18. dservercore-0.23.0/dservercore/user_routes.py +362 -0
  19. {dservercore-0.22.0 → dservercore-0.23.0}/dservercore/utils.py +315 -11
  20. {dservercore-0.22.0 → dservercore-0.23.0}/dservercore/utils_auth.py +9 -0
  21. dservercore-0.23.0/dservercore/version.py +24 -0
  22. dservercore-0.23.0/pyproject.toml +74 -0
  23. {dservercore-0.22.0 → dservercore-0.23.0}/tests/conftest.py +31 -13
  24. {dservercore-0.22.0 → dservercore-0.23.0}/tests/test_cli.py +4 -0
  25. dservercore-0.23.0/tests/test_jwt_audience_issuer.py +300 -0
  26. {dservercore-0.22.0 → dservercore-0.23.0}/tests/test_me_routes.py +15 -4
  27. dservercore-0.23.0/tests/test_readme_write_authorization.py +27 -0
  28. {dservercore-0.22.0 → dservercore-0.23.0}/tests/test_sorting.py +15 -15
  29. {dservercore-0.22.0 → dservercore-0.23.0}/tests/test_sql_dataset_utils.py +2 -0
  30. {dservercore-0.22.0 → dservercore-0.23.0}/tests/test_sql_list_datasets_by_user.py +4 -0
  31. {dservercore-0.22.0 → dservercore-0.23.0}/tests/test_summary_of_datasets_by_user.py +3 -0
  32. dservercore-0.23.0/tests/test_uploaded_by.py +148 -0
  33. {dservercore-0.22.0 → dservercore-0.23.0}/tests/test_uri_routes.py +48 -23
  34. dservercore-0.23.0/tests/test_uri_search_by_uuid.py +56 -0
  35. {dservercore-0.22.0 → dservercore-0.23.0}/tests/test_user_routes.py +311 -14
  36. {dservercore-0.22.0 → dservercore-0.23.0}/tests/test_utils_permission_management.py +6 -0
  37. {dservercore-0.22.0 → dservercore-0.23.0}/tests/test_utils_register_dataset.py +18 -3
  38. {dservercore-0.22.0 → dservercore-0.23.0}/tests/test_utils_user_management.py +14 -0
  39. dservercore-0.22.0/.github/dependabot.yml +0 -17
  40. dservercore-0.22.0/.github/workflows/publish.yml +0 -139
  41. dservercore-0.22.0/.github/workflows/test.yml +0 -62
  42. dservercore-0.22.0/README.rst +0 -804
  43. dservercore-0.22.0/dservercore/annotations_routes.py +0 -49
  44. dservercore-0.22.0/dservercore/date_utils.py +0 -22
  45. dservercore-0.22.0/dservercore/readme_routes.py +0 -48
  46. dservercore-0.22.0/dservercore/tags_routes.py +0 -49
  47. dservercore-0.22.0/dservercore/templates/index.html +0 -9
  48. dservercore-0.22.0/dservercore/user_routes.py +0 -169
  49. dservercore-0.22.0/dservercore/version.py +0 -21
  50. dservercore-0.22.0/dservercore.egg-info/SOURCES.txt +0 -105
  51. dservercore-0.22.0/dservercore.egg-info/dependency_links.txt +0 -1
  52. dservercore-0.22.0/dservercore.egg-info/entry_points.txt +0 -5
  53. dservercore-0.22.0/dservercore.egg-info/requires.txt +0 -24
  54. dservercore-0.22.0/dservercore.egg-info/top_level.txt +0 -1
  55. dservercore-0.22.0/pyproject.toml +0 -60
  56. dservercore-0.22.0/setup.cfg +0 -14
  57. {dservercore-0.22.0 → dservercore-0.23.0}/.dockerignore +0 -0
  58. {dservercore-0.22.0 → dservercore-0.23.0}/.gitignore +0 -0
  59. {dservercore-0.22.0 → dservercore-0.23.0}/.readthedocs.yaml +0 -0
  60. {dservercore-0.22.0 → dservercore-0.23.0}/CITATION.cff +0 -0
  61. {dservercore-0.22.0 → dservercore-0.23.0}/CONTRIBUTORS.rst +0 -0
  62. {dservercore-0.22.0 → dservercore-0.23.0}/LICENSE +0 -0
  63. {dservercore-0.22.0 → dservercore-0.23.0}/SPEC.rst +0 -0
  64. {dservercore-0.22.0 → dservercore-0.23.0}/docs/.gitignore +0 -0
  65. {dservercore-0.22.0 → dservercore-0.23.0}/docs/Makefile +0 -0
  66. {dservercore-0.22.0 → dservercore-0.23.0}/docs/api.rst +0 -0
  67. {dservercore-0.22.0 → dservercore-0.23.0}/docs/changelog.rst +0 -0
  68. {dservercore-0.22.0 → dservercore-0.23.0}/docs/conf.py +0 -0
  69. {dservercore-0.22.0 → dservercore-0.23.0}/docs/icons/22x22/dtool_logo.png +0 -0
  70. {dservercore-0.22.0 → dservercore-0.23.0}/docs/index.rst +0 -0
  71. {dservercore-0.22.0 → dservercore-0.23.0}/docs/make.bat +0 -0
  72. {dservercore-0.22.0 → dservercore-0.23.0}/docs/readme.rst +0 -0
  73. {dservercore-0.22.0 → dservercore-0.23.0}/dservercore/base_uri_routes.py +0 -0
  74. {dservercore-0.22.0 → dservercore-0.23.0}/dservercore/blueprint.py +0 -0
  75. {dservercore-0.22.0 → dservercore-0.23.0}/dservercore/cli.py +0 -0
  76. {dservercore-0.22.0 → dservercore-0.23.0}/dservercore/extensions.py +0 -0
  77. {dservercore-0.22.0 → dservercore-0.23.0}/dservercore/uri_routes.py +0 -0
  78. {dservercore-0.22.0 → dservercore-0.23.0}/dservercore/uuid_routes.py +0 -0
  79. {dservercore-0.22.0 → dservercore-0.23.0}/icons/22x22/dtool_logo.png +0 -0
  80. {dservercore-0.22.0 → dservercore-0.23.0}/provision/.gitignore +0 -0
  81. {dservercore-0.22.0 → dservercore-0.23.0}/provision/playbook.yml +0 -0
  82. {dservercore-0.22.0 → dservercore-0.23.0}/provision/roles/dtool_lookup_server/files/start_gunicorn.sh +0 -0
  83. {dservercore-0.22.0 → dservercore-0.23.0}/provision/roles/dtool_lookup_server/tasks/main.yml +0 -0
  84. {dservercore-0.22.0 → dservercore-0.23.0}/provision/roles/dtool_lookup_server/templates/load_env.sh +0 -0
  85. {dservercore-0.22.0 → dservercore-0.23.0}/provision/roles/epel/tasks/main.yml +0 -0
  86. {dservercore-0.22.0 → dservercore-0.23.0}/provision/roles/firewalld/tasks/main.yml +0 -0
  87. {dservercore-0.22.0 → dservercore-0.23.0}/provision/roles/mongodb/tasks/main.yml +0 -0
  88. {dservercore-0.22.0 → dservercore-0.23.0}/provision/roles/nginx/files/nginx.conf +0 -0
  89. {dservercore-0.22.0 → dservercore-0.23.0}/provision/roles/nginx/handlers/main.yml +0 -0
  90. {dservercore-0.22.0 → dservercore-0.23.0}/provision/roles/nginx/tasks/main.yml +0 -0
  91. {dservercore-0.22.0 → dservercore-0.23.0}/provision/roles/nginx/templates/dtool_lookup_server.conf +0 -0
  92. {dservercore-0.22.0 → dservercore-0.23.0}/provision/roles/ntp/handlers/main.yml +0 -0
  93. {dservercore-0.22.0 → dservercore-0.23.0}/provision/roles/ntp/tasks/main.yml +0 -0
  94. {dservercore-0.22.0 → dservercore-0.23.0}/provision/roles/ntp/templates/ntp.conf +0 -0
  95. {dservercore-0.22.0 → dservercore-0.23.0}/provision/roles/python_tools/tasks/main.yml +0 -0
  96. {dservercore-0.22.0 → dservercore-0.23.0}/registration_utils/.gitignore +0 -0
  97. {dservercore-0.22.0 → dservercore-0.23.0}/registration_utils/deprecated-mass_registration.py +0 -0
  98. {dservercore-0.22.0 → dservercore-0.23.0}/registration_utils/get_token.sh +0 -0
  99. {dservercore-0.22.0 → dservercore-0.23.0}/registration_utils/register.py +0 -0
  100. {dservercore-0.22.0 → dservercore-0.23.0}/registration_utils/requirements.txt +0 -0
  101. {dservercore-0.22.0 → dservercore-0.23.0}/requirements.txt +0 -0
  102. {dservercore-0.22.0 → dservercore-0.23.0}/tests/test_base_uri_routes.py +0 -0
  103. {dservercore-0.22.0 → dservercore-0.23.0}/tests/test_config.py +0 -0
  104. {dservercore-0.22.0 → dservercore-0.23.0}/tests/test_config_routes.py +0 -0
  105. {dservercore-0.22.0 → dservercore-0.23.0}/tests/test_lookup_datasets_by_user_and_uuid.py +0 -0
  106. {dservercore-0.22.0 → dservercore-0.23.0}/tests/test_metadata_retrieval_routes.py +0 -0
  107. {dservercore-0.22.0 → dservercore-0.23.0}/tests/test_timestamp_consistency.py +0 -0
  108. {dservercore-0.22.0 → dservercore-0.23.0}/tests/test_utils.py +0 -0
  109. {dservercore-0.22.0 → dservercore-0.23.0}/tests/test_utils_auth.py +0 -0
  110. {dservercore-0.22.0 → dservercore-0.23.0}/tests/test_utils_base_uri_management.py +0 -0
  111. {dservercore-0.22.0 → dservercore-0.23.0}/tests/test_utils_dataset_info_is_valid.py +0 -0
  112. {dservercore-0.22.0 → dservercore-0.23.0}/tests/test_utils_get_annotations_from_uri_by_user.py +0 -0
  113. {dservercore-0.22.0 → dservercore-0.23.0}/tests/test_utils_get_manifest_from_uri_by_user.py +0 -0
  114. {dservercore-0.22.0 → dservercore-0.23.0}/tests/test_utils_get_readme_from_uri_by_user.py +0 -0
  115. {dservercore-0.22.0 → dservercore-0.23.0}/tests/test_utils_preprocess_query_base_uris.py +0 -0
  116. {dservercore-0.22.0 → dservercore-0.23.0}/tests/test_uuid_routes.py +0 -0
  117. {dservercore-0.22.0 → dservercore-0.23.0}/tox.ini +0 -0
@@ -4,6 +4,95 @@ 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
+
7
96
  [0.22.0]
8
97
  ------------
9
98
 
@@ -217,11 +306,11 @@ Added
217
306
 
218
307
  - Added hook to allow the loading of plugins. Scaffold code for implementing a
219
308
  plugin can be found in
220
- https://github.com/livMatS/dserver-plugin-scaffolding.
309
+ https://github.com/livMatS/dtool-lookup-server-plugin-scaffolding.
221
310
  For examples of actual plugins see:
222
311
  https://github.com/livMatS/dserver-dependency-graph-plugin
223
312
  and
224
- https://github.com/livMatS/dserver-plugin-scaffolding
313
+ https://github.com/livMatS/dtool-lookup-server-plugin-scaffolding
225
314
  - Added /config route; see
226
315
  https://github.com/jic-dtool/dservercore/pull/6
227
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,58 +1,38 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.5
2
2
  Name: dservercore
3
- Version: 0.22.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.6.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"
55
- Dynamic: license-file
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
56
36
 
57
37
  dservercore
58
38
  ===========
@@ -110,8 +90,8 @@ manage users, base URIs and users' permissions on those base URIs.
110
90
  <https://github.com/jic-dtool/dtool-lookup-client>`_, and the
111
91
  `dtool-lookup-webapp <https://github.com/jic-dtool/dtool-lookup-webapp>`_.
112
92
  Third party applications making use of the dserver have also been
113
- created, notably the `livMatS/dtool-lookup-gui
114
- <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>`_.
115
95
 
116
96
  ``dservercore`` provides the core Flask app central to dserver's
117
97
  modular, pluggable framework.
@@ -237,6 +217,34 @@ file::
237
217
 
238
218
  export JWT_PUBLIC_KEY="ssh-rsa XXXXXX user@localhost"
239
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
+
240
248
  Inspecting the flask app configuration
241
249
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
242
250
 
@@ -560,6 +568,57 @@ URI ``s3://dtool-demo/ba92a5fa-d3b4-4f10-bcb9-947f62e652db``::
560
568
  http://localhost:5000/manifests/s3/dtool-demo/ba92a5fa-d3b4-4f10-bcb9-947f62e652db
561
569
 
562
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
+
563
622
  Getting information about one's own permissions
564
623
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
565
624
 
@@ -783,6 +842,19 @@ and extension plugins with their versions, i.e.::
783
842
 
784
843
  This request does not require any authorization.
785
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
+
786
858
  Creating a plugin
787
859
  -----------------
788
860
 
@@ -855,6 +927,6 @@ A respective entry in a ``pyproject.toml`` would look as follows.
855
927
 
856
928
  Examples of actual plugins include:
857
929
 
858
- - `dserver-direct-mongo-plugin <https://github.com/livMatS/dserver-direct-mongo-plugin>`_
859
- - `dserver-dependency-graph-plugin <https://github.com/livMatS/dserver-dependency-graph-plugin>`_
860
- - `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,59 +1,3 @@
1
- Metadata-Version: 2.4
2
- Name: dservercore
3
- Version: 0.22.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.6.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
- Dynamic: license-file
56
-
57
1
  dservercore
58
2
  ===========
59
3
 
@@ -110,8 +54,8 @@ manage users, base URIs and users' permissions on those base URIs.
110
54
  <https://github.com/jic-dtool/dtool-lookup-client>`_, and the
111
55
  `dtool-lookup-webapp <https://github.com/jic-dtool/dtool-lookup-webapp>`_.
112
56
  Third party applications making use of the dserver have also been
113
- created, notably the `livMatS/dtool-lookup-gui
114
- <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>`_.
115
59
 
116
60
  ``dservercore`` provides the core Flask app central to dserver's
117
61
  modular, pluggable framework.
@@ -237,6 +181,34 @@ file::
237
181
 
238
182
  export JWT_PUBLIC_KEY="ssh-rsa XXXXXX user@localhost"
239
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
+
240
212
  Inspecting the flask app configuration
241
213
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
242
214
 
@@ -560,6 +532,57 @@ URI ``s3://dtool-demo/ba92a5fa-d3b4-4f10-bcb9-947f62e652db``::
560
532
  http://localhost:5000/manifests/s3/dtool-demo/ba92a5fa-d3b4-4f10-bcb9-947f62e652db
561
533
 
562
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
+
563
586
  Getting information about one's own permissions
564
587
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
565
588
 
@@ -783,6 +806,19 @@ and extension plugins with their versions, i.e.::
783
806
 
784
807
  This request does not require any authorization.
785
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
+
786
822
  Creating a plugin
787
823
  -----------------
788
824
 
@@ -855,6 +891,6 @@ A respective entry in a ``pyproject.toml`` would look as follows.
855
891
 
856
892
  Examples of actual plugins include:
857
893
 
858
- - `dserver-direct-mongo-plugin <https://github.com/livMatS/dserver-direct-mongo-plugin>`_
859
- - `dserver-dependency-graph-plugin <https://github.com/livMatS/dserver-dependency-graph-plugin>`_
860
- - `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
@@ -33,7 +33,7 @@ try:
33
33
  __version__ = version(__name__)
34
34
  logger.debug("Determined version %s via importlib_metadata.version", __version__)
35
35
  except PackageNotFoundError:
36
- # 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
37
37
  try:
38
38
  from .version import version as __version__
39
39
  logger.debug("Determined version %s from autogenerated dserver_retrieve_plugin/version.py", __version__)
@@ -42,24 +42,16 @@ except PackageNotFoundError:
42
42
  __version__ = None
43
43
 
44
44
 
45
- # Python version-dependent treatment of entry points
46
- if sys.version_info >= (3, 8):
47
- from importlib.metadata import entry_points
48
- eps = entry_points()
49
- if sys.version_info >= (3, 10):
50
- search_entrypoints_iterator = eps.select(group="dservercore.search")
51
- retrieve_entrypoints_iterator = eps.select(group="dservercore.retrieve")
52
- extension_entrypoints_iterator = eps.select(group="dservercore.extension")
53
- else:
54
- search_entrypoints_iterator = eps.get("dservercore.search", [])
55
- retrieve_entrypoints_iterator = eps.get("dservercore.retrieve", [])
56
- extension_entrypoints_iterator = eps.get("dservercore.extension", [])
57
- else: # Python version < 3.8
58
- from pkg_resources import iter_entry_points
59
-
60
- search_entrypoints_iterator = iter_entry_points("dservercore.search")
61
- retrieve_entrypoints_iterator = iter_entry_points("dservercore.retrieve")
62
- extension_entrypoints_iterator = iter_entry_points("dservercore.extension")
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", [])
63
55
 
64
56
 
65
57
  class ValidationError(ValueError):
@@ -293,6 +285,13 @@ def create_app(test_config=None):
293
285
  # load the test config if passed in
294
286
  app.config.from_mapping(test_config)
295
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
+
296
295
  CORS(app)
297
296
 
298
297
  for plugin in app.plugins: