pas.plugins.oidc 1.0a5__tar.gz → 2.0.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 (115) hide show
  1. pas_plugins_oidc-2.0.0/.gitignore +52 -0
  2. pas_plugins_oidc-2.0.0/CHANGELOG.md +180 -0
  3. pas.plugins.oidc-1.0a5/CONTRIBUTORS.rst → pas_plugins_oidc-2.0.0/CONTRIBUTORS.md +3 -2
  4. pas_plugins_oidc-2.0.0/PKG-INFO +420 -0
  5. pas_plugins_oidc-2.0.0/README.md +367 -0
  6. pas_plugins_oidc-2.0.0/dependabot.yml +11 -0
  7. pas_plugins_oidc-2.0.0/docs/Makefile +107 -0
  8. pas_plugins_oidc-2.0.0/docs/_static/allowedgroups1.png +0 -0
  9. pas_plugins_oidc-2.0.0/docs/_static/allowedgroups2.png +0 -0
  10. pas_plugins_oidc-2.0.0/docs/_static/allowedgroups3.png +0 -0
  11. pas_plugins_oidc-2.0.0/docs/_static/icon.png +0 -0
  12. pas_plugins_oidc-2.0.0/docs/conf.py +237 -0
  13. pas_plugins_oidc-2.0.0/docs/index.md +26 -0
  14. pas_plugins_oidc-2.0.0/docs/pyproject.toml +15 -0
  15. pas_plugins_oidc-2.0.0/docs/robots.txt +8 -0
  16. pas_plugins_oidc-2.0.0/docs/screenshot-settings.png +0 -0
  17. pas_plugins_oidc-2.0.0/docs/uv.lock +692 -0
  18. pas_plugins_oidc-2.0.0/instance.yaml +3 -0
  19. pas_plugins_oidc-2.0.0/pyproject.toml +219 -0
  20. {pas.plugins.oidc-1.0a5 → pas_plugins_oidc-2.0.0}/src/pas/__init__.py +0 -1
  21. {pas.plugins.oidc-1.0a5 → pas_plugins_oidc-2.0.0}/src/pas/plugins/__init__.py +0 -1
  22. pas_plugins_oidc-2.0.0/src/pas/plugins/oidc/__init__.py +31 -0
  23. {pas.plugins.oidc-1.0a5 → pas_plugins_oidc-2.0.0}/src/pas/plugins/oidc/browser/configure.zcml +17 -8
  24. pas_plugins_oidc-2.0.0/src/pas/plugins/oidc/browser/view.py +168 -0
  25. {pas.plugins.oidc-1.0a5 → pas_plugins_oidc-2.0.0}/src/pas/plugins/oidc/configure.zcml +17 -18
  26. pas_plugins_oidc-2.0.0/src/pas/plugins/oidc/controlpanel/classic.py +181 -0
  27. pas_plugins_oidc-2.0.0/src/pas/plugins/oidc/controlpanel/configure.zcml +27 -0
  28. pas_plugins_oidc-2.0.0/src/pas/plugins/oidc/controlpanel/deserializer.py +89 -0
  29. pas_plugins_oidc-2.0.0/src/pas/plugins/oidc/controlpanel/oidc.py +20 -0
  30. pas_plugins_oidc-2.0.0/src/pas/plugins/oidc/controlpanel/serializer.py +45 -0
  31. pas_plugins_oidc-2.0.0/src/pas/plugins/oidc/interfaces.py +141 -0
  32. pas_plugins_oidc-2.0.0/src/pas/plugins/oidc/locales/__main__.py +69 -0
  33. pas_plugins_oidc-2.0.0/src/pas/plugins/oidc/locales/de/LC_MESSAGES/pas.plugins.oidc.po +187 -0
  34. pas_plugins_oidc-2.0.0/src/pas/plugins/oidc/locales/en/LC_MESSAGES/pas.plugins.oidc.po +184 -0
  35. pas_plugins_oidc-2.0.0/src/pas/plugins/oidc/locales/es/LC_MESSAGES/pas.plugins.oidc.po +189 -0
  36. pas_plugins_oidc-2.0.0/src/pas/plugins/oidc/locales/pas.plugins.oidc.pot +191 -0
  37. pas_plugins_oidc-2.0.0/src/pas/plugins/oidc/plugins.py +541 -0
  38. pas_plugins_oidc-2.0.0/src/pas/plugins/oidc/profiles/default/browserlayer.xml +6 -0
  39. pas_plugins_oidc-2.0.0/src/pas/plugins/oidc/profiles/default/controlpanel.xml +21 -0
  40. pas_plugins_oidc-2.0.0/src/pas/plugins/oidc/profiles/default/metadata.xml +4 -0
  41. pas_plugins_oidc-2.0.0/src/pas/plugins/oidc/profiles/uninstall/browserlayer.xml +6 -0
  42. pas_plugins_oidc-2.0.0/src/pas/plugins/oidc/services/configure.zcml +11 -0
  43. pas_plugins_oidc-2.0.0/src/pas/plugins/oidc/services/login/configure.zcml +11 -0
  44. pas_plugins_oidc-2.0.0/src/pas/plugins/oidc/services/login/get.py +28 -0
  45. pas_plugins_oidc-2.0.0/src/pas/plugins/oidc/services/oidc/__init__.py +0 -0
  46. pas_plugins_oidc-2.0.0/src/pas/plugins/oidc/services/oidc/configure.zcml +31 -0
  47. pas_plugins_oidc-2.0.0/src/pas/plugins/oidc/services/oidc/oidc.py +235 -0
  48. pas_plugins_oidc-2.0.0/src/pas/plugins/oidc/session.py +39 -0
  49. {pas.plugins.oidc-1.0a5 → pas_plugins_oidc-2.0.0}/src/pas/plugins/oidc/setuphandlers.py +19 -42
  50. {pas.plugins.oidc-1.0a5 → pas_plugins_oidc-2.0.0}/src/pas/plugins/oidc/testing.py +12 -25
  51. pas_plugins_oidc-2.0.0/src/pas/plugins/oidc/upgrades/__init__.py +0 -0
  52. pas_plugins_oidc-2.0.0/src/pas/plugins/oidc/upgrades/configure.zcml +25 -0
  53. pas_plugins_oidc-2.0.0/src/pas/plugins/oidc/utils.py +216 -0
  54. pas_plugins_oidc-2.0.0/src/pas/plugins/oidc/www/oidcPluginForm.zpt +66 -0
  55. pas_plugins_oidc-2.0.0/tests/conftest.py +68 -0
  56. pas_plugins_oidc-2.0.0/tests/controlpanel/conftest.py +59 -0
  57. pas_plugins_oidc-2.0.0/tests/controlpanel/test_controlpanel_api.py +23 -0
  58. pas_plugins_oidc-2.0.0/tests/docker-compose.yml +39 -0
  59. pas_plugins_oidc-2.0.0/tests/functional/conftest.py +69 -0
  60. pas_plugins_oidc-2.0.0/tests/functional/test_controlpanel_classic.py +19 -0
  61. pas_plugins_oidc-2.0.0/tests/functional/test_functional.py +79 -0
  62. pas_plugins_oidc-2.0.0/tests/keycloak/Dockerfile +30 -0
  63. pas_plugins_oidc-2.0.0/tests/keycloak/import/.gitkeep +0 -0
  64. pas_plugins_oidc-2.0.0/tests/keycloak/import/plone-realm.json +2478 -0
  65. pas_plugins_oidc-2.0.0/tests/keycloak/import/plone-test-realm.json +2073 -0
  66. pas_plugins_oidc-2.0.0/tests/plugin/test_plugin.py +52 -0
  67. pas_plugins_oidc-2.0.0/tests/services/conftest.py +117 -0
  68. pas_plugins_oidc-2.0.0/tests/services/test_services_login_get.py +28 -0
  69. pas_plugins_oidc-2.0.0/tests/services/test_services_login_get_multiple_plugins.py +33 -0
  70. pas_plugins_oidc-2.0.0/tests/services/test_services_login_with_allowed_groups.py +36 -0
  71. pas_plugins_oidc-2.0.0/tests/services/test_services_oidc_get.py +82 -0
  72. pas_plugins_oidc-2.0.0/tests/services/test_services_oidc_post.py +92 -0
  73. pas_plugins_oidc-2.0.0/tests/setup/test_setup_install.py +39 -0
  74. pas_plugins_oidc-2.0.0/tests/setup/test_setup_uninstall.py +27 -0
  75. pas_plugins_oidc-2.0.0/tests/utils/test_utils_flow.py +70 -0
  76. pas_plugins_oidc-2.0.0/tests/utils/test_utils_str.py +35 -0
  77. pas_plugins_oidc-2.0.0/tests/utils/test_utils_url.py +53 -0
  78. pas.plugins.oidc-1.0a5/CHANGES.rst +0 -51
  79. pas.plugins.oidc-1.0a5/DEVELOP.rst +0 -42
  80. pas.plugins.oidc-1.0a5/MANIFEST.in +0 -4
  81. pas.plugins.oidc-1.0a5/PKG-INFO +0 -270
  82. pas.plugins.oidc-1.0a5/README.rst +0 -179
  83. pas.plugins.oidc-1.0a5/docs/conf.py +0 -239
  84. pas.plugins.oidc-1.0a5/docs/index.rst +0 -5
  85. pas.plugins.oidc-1.0a5/setup.cfg +0 -37
  86. pas.plugins.oidc-1.0a5/setup.py +0 -82
  87. pas.plugins.oidc-1.0a5/src/pas/plugins/oidc/__init__.py +0 -24
  88. pas.plugins.oidc-1.0a5/src/pas/plugins/oidc/browser/view.py +0 -303
  89. pas.plugins.oidc-1.0a5/src/pas/plugins/oidc/interfaces.py +0 -8
  90. pas.plugins.oidc-1.0a5/src/pas/plugins/oidc/locales/README.rst +0 -37
  91. pas.plugins.oidc-1.0a5/src/pas/plugins/oidc/locales/update.py +0 -74
  92. pas.plugins.oidc-1.0a5/src/pas/plugins/oidc/locales/update.sh +0 -12
  93. pas.plugins.oidc-1.0a5/src/pas/plugins/oidc/plugins.py +0 -412
  94. pas.plugins.oidc-1.0a5/src/pas/plugins/oidc/profiles/default/browserlayer.xml +0 -7
  95. pas.plugins.oidc-1.0a5/src/pas/plugins/oidc/profiles/default/metadata.xml +0 -4
  96. pas.plugins.oidc-1.0a5/src/pas/plugins/oidc/profiles/uninstall/browserlayer.xml +0 -7
  97. pas.plugins.oidc-1.0a5/src/pas/plugins/oidc/tests/test_functional.py +0 -115
  98. pas.plugins.oidc-1.0a5/src/pas/plugins/oidc/tests/test_plugin.py +0 -48
  99. pas.plugins.oidc-1.0a5/src/pas/plugins/oidc/tests/test_setup.py +0 -66
  100. pas.plugins.oidc-1.0a5/src/pas/plugins/oidc/utils.py +0 -61
  101. pas.plugins.oidc-1.0a5/src/pas.plugins.oidc.egg-info/PKG-INFO +0 -270
  102. pas.plugins.oidc-1.0a5/src/pas.plugins.oidc.egg-info/SOURCES.txt +0 -44
  103. pas.plugins.oidc-1.0a5/src/pas.plugins.oidc.egg-info/dependency_links.txt +0 -1
  104. pas.plugins.oidc-1.0a5/src/pas.plugins.oidc.egg-info/entry_points.txt +0 -5
  105. pas.plugins.oidc-1.0a5/src/pas.plugins.oidc.egg-info/namespace_packages.txt +0 -2
  106. pas.plugins.oidc-1.0a5/src/pas.plugins.oidc.egg-info/not-zip-safe +0 -1
  107. pas.plugins.oidc-1.0a5/src/pas.plugins.oidc.egg-info/requires.txt +0 -11
  108. pas.plugins.oidc-1.0a5/src/pas.plugins.oidc.egg-info/top_level.txt +0 -1
  109. {pas.plugins.oidc-1.0a5 → pas_plugins_oidc-2.0.0}/LICENSE.GPL +0 -0
  110. /pas.plugins.oidc-1.0a5/LICENSE.rst → /pas_plugins_oidc-2.0.0/LICENSE.md +0 -0
  111. {pas.plugins.oidc-1.0a5 → pas_plugins_oidc-2.0.0}/src/pas/plugins/oidc/browser/__init__.py +0 -0
  112. {pas.plugins.oidc-1.0a5/src/pas/plugins/oidc/locales → pas_plugins_oidc-2.0.0/src/pas/plugins/oidc/controlpanel}/__init__.py +0 -0
  113. {pas.plugins.oidc-1.0a5/src/pas/plugins/oidc/tests → pas_plugins_oidc-2.0.0/src/pas/plugins/oidc/locales}/__init__.py +0 -0
  114. /pas.plugins.oidc-1.0a5/src/pas/plugins/oidc/locales/en/LC_MESSAGES/pas.plugins.oidc.po → /pas_plugins_oidc-2.0.0/src/pas/plugins/oidc/services/__init__.py +0 -0
  115. /pas.plugins.oidc-1.0a5/src/pas/plugins/oidc/locales/pas.plugins.oidc.pot → /pas_plugins_oidc-2.0.0/src/pas/plugins/oidc/services/login/__init__.py +0 -0
@@ -0,0 +1,52 @@
1
+ *.egg-info
2
+ *.pyc
3
+ *.pyo
4
+
5
+ # translation related
6
+ *.mo
7
+
8
+ # tools related
9
+ build/
10
+ .coverage
11
+ .*project
12
+ coverage.xml
13
+ dist/
14
+ docs/_build
15
+ __pycache__/
16
+ .tox
17
+ node_modules/
18
+
19
+ # venv / buildout related
20
+ bin/
21
+ develop-eggs/
22
+ eggs/
23
+ .eggs/
24
+ etc/
25
+ .installed.cfg
26
+ include/
27
+ lib/
28
+ lib64
29
+ .mr.developer.cfg
30
+ parts/
31
+ pyvenv.cfg
32
+ var/
33
+ local.cfg
34
+ .venv
35
+
36
+ # mxdev
37
+ /instance/
38
+ /.make-sentinels/
39
+ /*-mxdev.txt
40
+ /reports/
41
+ /sources/
42
+ /venv/
43
+ .installed.txt
44
+ constraints*.txt
45
+ requirements*.txt
46
+
47
+ requirements-mxdev.txt
48
+
49
+ /.python-version
50
+ /dependencies.svg
51
+ .pytest_cache
52
+ .ruff_cache
@@ -0,0 +1,180 @@
1
+ # Changelog
2
+
3
+ <!--
4
+ You should *NOT* be adding new change log entries to this file.
5
+ You should create a file in the news directory instead.
6
+ For helpful instructions, please see:
7
+ https://github.com/plone/plone.releaser/blob/master/ADD-A-NEWS-ITEM.rst
8
+ -->
9
+
10
+ <!-- towncrier release notes start -->
11
+
12
+ ## 2.0.0 (2025-05-06)
13
+
14
+
15
+ ### New features:
16
+
17
+ - Updated Spanish translation [#74](https://github.com/collective/pas.plugins.oidc/issues/74)
18
+
19
+ ## 2.0.0rc2 (2025-03-26)
20
+
21
+
22
+ ### Internal:
23
+
24
+ - Add environment variable KEYCLOAK_VERSION to allow choosing which version of Keycloak will be used @ericof
25
+ - GHA: Do not fail fast during CI tests. @ericof
26
+
27
+
28
+ ### Documentation:
29
+
30
+ - Update README to refer to using uv instead of tox @ericof
31
+
32
+ ## 2.0.0rc1 (2025-03-26)
33
+
34
+
35
+ ### Breaking changes:
36
+
37
+ - Drop support for Python 3.8 @ericof
38
+ - Drop support for Python 3.9 @ericof
39
+
40
+
41
+ ### New features:
42
+
43
+ - Add support for Plone 6.1 @ericof
44
+ - Add support for Python 3.12 @ericof
45
+ - Add support for Python 3.13 @ericof
46
+
47
+
48
+ ### Internal:
49
+
50
+ - Move to pyproject.toml, hatchling and uv @ericof [#71](https://github.com/collective/pas.plugins.oidc/issues/71)
51
+ - Update GHA workflows @ericof
52
+
53
+ ## 2.0.0b4 (2025-02-28)
54
+
55
+
56
+ ### New features:
57
+
58
+ - Add backchannel logout implementation for classic ui session @mamico [#67](https://github.com/collective/pas.plugins.oidc/issues/67)
59
+
60
+ ## 2.0.0b3 (2025-02-03)
61
+
62
+
63
+ ### New features:
64
+
65
+ - Register the adapter as needed by the @login endpoint present in plone.restapi @erral [#47](https://github.com/collective/pas.plugins.oidc/issues/47)
66
+ - Changes to make compatible with OAM (Oracle Access Manager) @djay [#65](https://github.com/collective/pas.plugins.oidc/pull/64)
67
+
68
+
69
+ ### Internal:
70
+
71
+ - Bump plone.restapi to 9.10.0 [@ericof]
72
+
73
+
74
+ ## 2.0.0b2 (2024-12-09)
75
+
76
+
77
+ ### New features:
78
+
79
+ - Update the Deutsch translation [macagua] [#60](https://github.com/collective/pas.plugins.oidc/issues/60)
80
+ - Implement control panel to configure pas.plugins.oidc [@ericof] [#65](https://github.com/collective/pas.plugins.oidc/issues/65)
81
+
82
+
83
+ ### Documentation:
84
+
85
+ - Fixed port numbers on README file [macagua] [#51](https://github.com/collective/pas.plugins.oidc/issues/51)
86
+
87
+
88
+ ## 2.0.0b1 (2024-06-25)
89
+
90
+
91
+ ### New features:
92
+
93
+ - Added Deutsch translation
94
+ [@macagua] [#45](https://github.com/collective/pas.plugins.oidc/issues/45)
95
+ - Allow multiple instances of OIDC plugin in a given Plone site @erral [#48](https://github.com/collective/pas.plugins.oidc/issues/48)
96
+ - Notify user events on creation and authentication. [@Arkusm][@ericof] [#53](https://github.com/collective/pas.plugins.oidc/issues/53)
97
+ - Updated the latest .po templates for translate
98
+ Updated Spanish translation
99
+ [@macagua] [#55](https://github.com/collective/pas.plugins.oidc/issues/55)
100
+
101
+
102
+ ### Internal:
103
+
104
+ - Update configuration files @plone
105
+
106
+
107
+ ### Documentation:
108
+
109
+ - Recommend using `[pas.plugins.keycloakgroups](https://pypi.org/project/pas.plugins.keycloakgroups/)` for groups support with Keycloak [@ericof] [#42](https://github.com/collective/pas.plugins.oidc/issues/42)
110
+
111
+
112
+ ## 2.0.0a1 (2023-11-23)
113
+
114
+
115
+ ### New features:
116
+
117
+ - Implement [plone/meta](https://github.com/plone/meta) and convert documentation to Markdown [@ericof] [#32](https://github.com/collective/pas.plugins.oidc/issues/32)
118
+ - Drop support to Python 2.7 and Plone 5.2 [@ericof] [#33](https://github.com/collective/pas.plugins.oidc/issues/33)
119
+ - Implement restapi services to handle authentication flow [@ericof] [#38](https://github.com/collective/pas.plugins.oidc/issues/38)
120
+
121
+
122
+ ### Internal:
123
+
124
+ - Rewrite tests from unittest to pytest with [pytest-plone](https://pypi.org/project/pytest-plone/) [@ericof] [#34](https://github.com/collective/pas.plugins.oidc/issues/34)
125
+ - Allow dict instances to hold userinfo [@erral] [#35](https://github.com/collective/pas.plugins.oidc/issues/35)
126
+ - Declare the minimum requirements for Plone/python in the readme [mamico] [#36](https://github.com/collective/pas.plugins.oidc/issues/36)
127
+
128
+
129
+ ## 1.0.0 (2023-11-11)
130
+
131
+ - Allow dict instances to hold userinfo [@erral]
132
+
133
+ ## 1.0a6 (2023-07-20)
134
+
135
+ - Added Spanish translation [@macagua]
136
+
137
+ - Added improvements about i18n support [macagua]
138
+
139
+ - Drop python 2.7 and Plone 4 support [@erral]
140
+
141
+ - Add support for the post_logout parameter for logout api. [@ramiroluz]
142
+
143
+
144
+ ## 1.0a5 (2023-04-05)
145
+
146
+ - Catch exceptions during the OAuth process [@erral]
147
+
148
+ - Update the plugin to make challenges.
149
+ An anonymous user who visits a page for which you have to be authenticated,
150
+ is redirected to the new require_login view on the plugin.
151
+ This works the same way as the standard require_login page of Plone.
152
+ [@maurits]
153
+
154
+ - Add a property for the default userinfo instead of using only sub. [@eikichi18]
155
+
156
+
157
+ ## 1.0a4 (2023-01-16)
158
+
159
+ - Call getProperty only once when getting redirect_uris or scope. [@maurits]
160
+
161
+ - use getProperty accessor [@mamico]
162
+
163
+
164
+ ## 1.0a3 (2022-10-30)
165
+
166
+ - Removed the hardcoded auth cookie name [@alecghica]
167
+
168
+ - Fixed Python compatibility with version >= 3.6 [@alecghica]
169
+
170
+ - check if url is in portal before redirect #2 [@erral]
171
+
172
+ - manage came_from [@mamico]
173
+
174
+ ## 1.0a2 (unreleased)
175
+
176
+ - do userinforequest if there is a client.userinfo_endpoint [@mamico]
177
+
178
+ ## 1.0a1 (unreleased)
179
+
180
+ - Initial release. [@mamico]
@@ -1,6 +1,7 @@
1
- Contributors
2
- ============
1
+ # Contributors
3
2
 
4
3
  - mamico, mauro.amico@gmail.com
5
4
  - erral, Mikel Larreategi
6
5
  - alecghica, alec.ghica@eaudeweb.ro
6
+ - macagua, leonardocaballero@gmail.com
7
+ - ericof, ericof@plone.org
@@ -0,0 +1,420 @@
1
+ Metadata-Version: 2.4
2
+ Name: pas.plugins.oidc
3
+ Version: 2.0.0
4
+ Summary: OIDC support for Plone sites
5
+ Project-URL: Homepage, https://github.com/collective/pas.plugins.oidc
6
+ Project-URL: PyPI, https://pypi.org/project/pas.plugins.oidc
7
+ Project-URL: Source, https://github.com/collective/pas.plugins.oidc
8
+ Project-URL: Tracker, https://github.com/collective/pas.plugins.oidc/issues
9
+ Author-email: Mauro Amico <mauro.amico@gmail.com>, Érico Andrei <ericof@plone.org>
10
+ License-Expression: GPL-2.0-only
11
+ License-File: LICENSE.GPL
12
+ License-File: LICENSE.md
13
+ Keywords: Authentication,CMS,OAuth,OIDC,PAS,Plone,Python
14
+ Classifier: Development Status :: 4 - Beta
15
+ Classifier: Environment :: Web Environment
16
+ Classifier: Framework :: Plone
17
+ Classifier: Framework :: Plone :: 6.0
18
+ Classifier: Framework :: Plone :: 6.1
19
+ Classifier: Framework :: Plone :: Addon
20
+ Classifier: License :: OSI Approved :: GNU General Public License v2 (GPLv2)
21
+ Classifier: Operating System :: OS Independent
22
+ Classifier: Programming Language :: Python
23
+ Classifier: Programming Language :: Python :: 3.10
24
+ Classifier: Programming Language :: Python :: 3.11
25
+ Classifier: Programming Language :: Python :: 3.12
26
+ Classifier: Programming Language :: Python :: 3.13
27
+ Requires-Python: >=3.10
28
+ Requires-Dist: oic
29
+ Requires-Dist: plone-api
30
+ Requires-Dist: plone-app-registry
31
+ Requires-Dist: plone-base
32
+ Requires-Dist: plone-protect
33
+ Requires-Dist: plone-restapi>=9.10.0
34
+ Requires-Dist: products-cmfcore
35
+ Requires-Dist: products-cmfplone>=6.0
36
+ Requires-Dist: requests
37
+ Requires-Dist: z3c-form
38
+ Requires-Dist: zope
39
+ Provides-Extra: test
40
+ Requires-Dist: plone-app-contenttypes; extra == 'test'
41
+ Requires-Dist: plone-app-testing; extra == 'test'
42
+ Requires-Dist: plone-restapi[test]; extra == 'test'
43
+ Requires-Dist: plone-testing; extra == 'test'
44
+ Requires-Dist: pytest; extra == 'test'
45
+ Requires-Dist: pytest-cov; extra == 'test'
46
+ Requires-Dist: pytest-docker; extra == 'test'
47
+ Requires-Dist: pytest-mock; extra == 'test'
48
+ Requires-Dist: pytest-plone>=0.5.0; extra == 'test'
49
+ Requires-Dist: requests-mock; extra == 'test'
50
+ Requires-Dist: zest-releaser[recommended]>=9.5.0; extra == 'test'
51
+ Requires-Dist: zestreleaser-towncrier>=1.3.0; extra == 'test'
52
+ Description-Content-Type: text/markdown
53
+
54
+ <div align="center"><img alt="pas.plugins.oidc logo" src="https://raw.githubusercontent.com/collective/pas.plugins.oidc/main/docs/_static/icon.png" width="70" /></div>
55
+
56
+ <h1 align="center">pas.plugins.oidc</h1>
57
+
58
+ <div align="center">
59
+
60
+ [![PyPI](https://img.shields.io/pypi/v/pas.plugins.oidc)](https://pypi.org/project/pas.plugins.oidc/)
61
+ [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pas.plugins.oidc)](https://pypi.org/project/pas.plugins.oidc/)
62
+ [![PyPI - Wheel](https://img.shields.io/pypi/wheel/pas.plugins.oidc)](https://pypi.org/project/pas.plugins.oidc/)
63
+ [![PyPI - License](https://img.shields.io/pypi/l/pas.plugins.oidc)](https://pypi.org/project/pas.plugins.oidc/)
64
+ [![PyPI - Status](https://img.shields.io/pypi/status/pas.plugins.oidc)](https://pypi.org/project/pas.plugins.oidc/)
65
+
66
+
67
+ [![PyPI - Plone Versions](https://img.shields.io/pypi/frameworkversions/plone/pas.plugins.oidc)](https://pypi.org/project/pas.plugins.oidc/)
68
+
69
+ [![CI](https://github.com/collective/pas.plugins.oidc/actions/workflows/ci.yml/badge.svg)](https://github.com/collective/pas.plugins.oidc/actions/workflows/ci.yml)
70
+ ![Code Style](https://img.shields.io/badge/Code%20Style-Black-000000)
71
+
72
+ [![GitHub contributors](https://img.shields.io/github/contributors/collective/pas.plugins.oidc)](https://github.com/collective/pas.plugins.oidc)
73
+ [![GitHub Repo stars](https://img.shields.io/github/stars/collective/pas.plugins.oidc?style=social)](https://github.com/collective/pas.plugins.oidc)
74
+
75
+ </div>
76
+
77
+ ## Intro
78
+ This is a Plone authentication plugin for OpenID Connect.
79
+ OAuth 2.0 should work as well because OpenID Connect is built on top of this protocol.
80
+
81
+ ## Features
82
+
83
+ - PAS plugin, although currently no interfaces are activated.
84
+ - Three browser views for this PAS plugin, which are the main interaction with the outside world.
85
+
86
+ ### Group Enumeration
87
+
88
+ If you need to support group enumeration from a Keycloak server, we recommend installing the package [pas.plugins.keycloakgroups](https://pypi.org/project/pas.plugins.keycloakgroups/).
89
+
90
+ ## Installation
91
+
92
+ This package supports Plone sites using Volto and Classic UI.
93
+
94
+ For proper Volto support, the requirements are:
95
+
96
+ * plone.restapi >= 8.34.0
97
+ * Volto >= 16.10.0
98
+
99
+ Add **pas.plugins.oidc** to the Plone installation using `pip`:
100
+
101
+ ``bash
102
+ pip install pas.plugins.oidc
103
+ ``
104
+
105
+ ### Requirements
106
+
107
+ As of version 2.* of this package the minimum requirements are Plone 6.0 and python 3.8.
108
+
109
+ ### Warning
110
+
111
+ Pay attention to the customization of `User info property used as userid` field, with the wrong configuration it's easy to impersonate another user.
112
+
113
+
114
+ ## Configure the plugin
115
+
116
+ * Go to the Add-ons control panel and install `pas.plugins.oidc`.
117
+ * In the ZMI go to the plugin properties at `http://localhost:8080/Plone/acl_users/oidc/manage_propertiesForm`
118
+ * Configure the properties with the data obtained from your provider:
119
+ * `OIDC/Oauth2 Issuer`
120
+ * `Client ID`
121
+ * `Client secret`
122
+ * `redirect_uris`: this needs to match the **public URL** where the user will be redirected after the login flow is completed. It needs to include
123
+ the `/Plone/acl_users/oidc/callback` part. When using Volto you need to expose Plone somehow to have the login process finish correctly.
124
+ * `Use Zope session data manager`: see the section below about the usage of session.
125
+ * `Create user / update user properties`: when selected the user data in Plone will be updated with the data coming from the OIDC provider.
126
+ * `Create authentication __ac ticket`: when selected the user will be allowed to act as a logged-in user in Plone.
127
+ * `Create authentication auth_token (Volto/REST API) ticket`: when selected the user will be allowed to act as a logged-in user in the Volto frontend.
128
+ * `Open ID scopes to request to the server`: information requested to the OIDC provider. Leave it as it is or modify it according to your provider's information.
129
+ * `Use PKCE`: when enabled uses [PKCE](https://datatracker.ietf.org/doc/html/rfc7636) when requesting authentication from the provider.
130
+
131
+ ### Login and Logout URLs
132
+
133
+ #### Default UI (Volto)
134
+
135
+ When using this plugin with a [Volto frontend](https://6.docs.plone.org/volto/index.html), please install [@plone-collective/volto-authomatic](https://github.com/collective/volto-authomatic) add-on on your frontend project.
136
+
137
+ * **Login URL**: `<Path to your Plone site>`/login
138
+ * **Logout URL**: `<Path to your Plone site>`/logout
139
+
140
+ Also, on the OpenID provider, configure the Redirect URL as **`<Path to your Plone site>`/login-oidc/oidc**.
141
+
142
+ #### Classic UI
143
+
144
+ When using this plugin with *Plone 6 Classic UI* the standard URLs used for login (`http://localhost:8080/Plone/login`) and logout (`http://localhost:8080/Plone/logout`)
145
+ will not trigger the usage of the plugin.
146
+
147
+ To login into a site using the OIDC provider, you will need to change those login URLs to the following:
148
+
149
+ * **Login URL**: /`<Plone Site Id>`/acl_users/`<oidc pas plugin id>`/login
150
+ * **Logout URL**: /`<Plone Site Id>`/acl_users/`<oidc pas plugin id>`/logout
151
+
152
+ *Where:*
153
+
154
+ * `Plone Site Id`: is the id you gave to the Plone site when you created it. It is usually `Plone` but may vary. It is the last part of the URL when you browse Plone directly without using any proxy server, ex. `http://localhost:8080/Plone+` -> `Plone`.
155
+
156
+ * `oidc pas plugin id`: is the id you gave to the OIDC plugin when you created it inside the Plone PAS administration panel. If you just used the default configuration and installed this plugin using Plone's Add-on Control Panel, this id will be `oidc`.
157
+
158
+ ### Example setup with Keycloak
159
+
160
+ The `pas.plugins.oidc` repository has a working setup for a `Keycloak` development server using `Docker` and `Docker Compose`. To use it, in a terminal, run the command:
161
+
162
+ #### Start-up
163
+
164
+ ```bash
165
+ make keycloak-start
166
+ ```
167
+
168
+ This does **not** give you a production setup, but it is fine for local development.
169
+
170
+ This command will use the [`docker-compose.yml`](./tests/docker-compose.yml) file available in the `tests` directory.
171
+
172
+ #### Manage Keycloak
173
+
174
+ After start up, Keycloak will be accessible on [http://127.0.0.1:8180](http://127.0.0.1:8180), and you can manage it with the following credentials:
175
+
176
+ * **username**: admin
177
+ * **password**: admin
178
+
179
+ #### Realms
180
+
181
+ There are two realms configured `plone` and `plone-test`. The later is used in automated tests, while the former should be used for your development environment.
182
+
183
+ The `plone` realm ships with an user that has the following credentials:
184
+
185
+ * username: **user**
186
+ * password: **12345678**
187
+
188
+ And, to configure the oidc plugins, please use:
189
+
190
+ * client id: **plone**
191
+ * client secret: **12345678**
192
+
193
+ #### Stop Keycloak
194
+
195
+ To stop a running `Keycloak` (needed when running tests), use:
196
+
197
+ ```bash
198
+ make keycloak-stop
199
+ ```
200
+
201
+ #### Warning
202
+
203
+ Attention, before Keycloak 18, the parameter for logout was `redirect_uri` and it has been deprecated since version 18. But the
204
+ Keycloak server can run with the `redirect_uri` if needed, it is possible to use the plugin with the legacy `redirect_uri`
205
+ parameter enabled also. The problem is that if the deprecated parameter is enabled in the plugin but not in the server, the plugin
206
+ will not work.
207
+
208
+ So, this is the way it works:
209
+ * With legacy `redirect_uri` parameter enabled in Keycloak, the plugin works in default mode.
210
+ * With legacy `redirect_uri` parameter enabled in Keycloak, the plugin also works with legacy mode.
211
+ * With legacy `redirect_uri` parameter disabled in Keycloak (default after version 18), the plugin works in default mode.
212
+ * With legacy `redirect_uri` parameter disabled in Keycloak (default after version 18), the plugin does NOT work with legacy mode.
213
+
214
+ So, for Keycloak, it does not matter if we use the default or legacy mode if the Keycloak runs in legacy mode.
215
+
216
+ *Notes:*
217
+
218
+ * If legacy `redirect_uri` parameter is disabled in Keycloak, this is the default since version 18 of Keycloak according
219
+ to this comment in *Stack Overflow*: https://stackoverflow.com/a/72142887.
220
+ * The plugin will work only if the `Use deprecated redirect_uri for logout url(/Plone/acl_users/oidc/logout)`
221
+ option is un-checked at the plugin properties at http://localhost:8080/Plone/acl_users/oidc/manage_propertiesForm.
222
+
223
+ #### Additional Documentation
224
+
225
+ Please refer to the [Keycloak documentation](https://www.keycloak.org/documentation>) for up to date instructions.
226
+ Specifically, here we will use a Docker image, so follow the instructions on how to [get started with Keycloak on Docker](https://www.keycloak.org/getting-started/getting-started-docker).
227
+
228
+ #### Setup Plone as a client
229
+
230
+ * Make sure **pas.plugins.oidc** is installed.
231
+ * Start Plone and create a Plone site with id Plone.
232
+ * In the Add-ons control panel, install `pas.plugins.oidc`.
233
+ * In the ZMI go to the plugin properties at http://localhost:8080/Plone/acl_users/oidc/manage_propertiesForm
234
+ * Set these properties:
235
+ * `OIDC/Oauth2 Issuer`: http://127.0.0.1:8180/realms/plone/
236
+ * `Client ID`: *plone* (**Warning:** This property must match the `Client ID` you have set in Keycloak.)
237
+ * `Client secret`: *12345678* (**Warning:** This property must match the `Client secret` you have get in Keycloak.)
238
+ * `Use deprecated redirect_uri for logout url` checked. Use this if you need to run old versions of Keycloak.
239
+ * `Open ID scopes to request to the server`: this depends on which version of Keycloak you are using, and which scopes are available there.
240
+ In recent Keycloak versions, you *must* include `openid` as scope.
241
+ Suggestion is to use `openid` and `profile`.
242
+ * **Tip:** Leave the rest at the defaults, unless you know what you are doing.
243
+ * Click `Save`.
244
+
245
+ **Plone is ready done configured!**
246
+
247
+ See this screenshot:
248
+
249
+ ![](https://raw.githubusercontent.com/collective/pas.plugins.oidc/main/docs/screenshot-settings.png "Setup Plone as a client")
250
+
251
+ #### Login
252
+
253
+ Go to the other browser, or logout as admin from [Keycloak Admin Console](http://127.0.0.1:8180/admin).
254
+ Currently, the Plone login form is unchanged.
255
+
256
+ Instead, for testing go to the login page of the plugin: http://localhost:8080/Plone/acl_users/oidc/login,
257
+ this will take you to Keycloak to login, and then return. You should now be logged in to Plone, and see the
258
+ *full name* and *email*, if you have set this in Keycloak.
259
+
260
+ #### Logout
261
+
262
+ If the login did work as expected you can try to Plone logout.
263
+ Currently, the Plone logout form is unchanged.
264
+
265
+ Instead, for testing go to the logout page of the plugin: http://localhost:8080/Plone/acl_users/oidc/logout,
266
+ this will take you to Keycloak to logout, and then return to the post-logout redirect URL.
267
+
268
+ #### Backchannel SLO (experimental)
269
+
270
+ OIDC Backchannel Logout is a server-to-server mechanism where the IdP notifies RPs via an HTTP POST request to terminate user sessions upon logout, ensuring secure and seamless Single Logout (SLO) without relying on the user's browser.
271
+ See the specification [OpenID Connect Back-Channel Logout 1.0](https://openid.net/specs/openid-connect-backchannel-1_0.html).
272
+
273
+ Current backchannel logout implementation, in this product, utilizes functionality introduced in plone.session >= 4.0.0 (Plone 6 and later) for server-side session invalidation (see plone.session PR [plone.session#26](https://github.com/plone/plone.session/pull/26)), and, at the moment, applies only to Plone Classic UI.
274
+
275
+ To enable this functionality:
276
+
277
+ 1. Navigate to `.../acl_users/session/manage_secret` and enable the `Enable per-user keyring` option.
278
+
279
+ 2. Configure the OpenID Provider (e.g., Keycloak) to use the backchannel logout endpoint with the url: `.../acl_users/oidc/backchannel-logout`
280
+
281
+ #### Allowed groups
282
+
283
+ If you need to restrict access to a specific group, you can use the `Allowed groups` field in the plugin configuration. If the user is not in any of the groups listed, the login will be denied.
284
+
285
+ To use this feature, you need to create a new scope in the OIDC Provider (e.g., Keycloak) and add the groups to the user's token.
286
+
287
+ In Keycloak, go to the `Client Scopes` section and create a new scope named `groups`. Then, go to the `Mappers` tab and create a new mapper with the name `groups` and type `Group Membership` (Uncheck the `Full groups path` option).
288
+ You can find this configuration in the `plone` realm in the `tests` directory. The `plone` client is also configured to use the `groups` scope.
289
+
290
+ ![Create a new scope groups](docs/_static/allowedgroups1.png)
291
+
292
+ ![Add a new mapper Group Membership](docs/_static/allowedgroups2.png)
293
+
294
+ After that, go to the `Client Scopes` section and add the new scope to the client you are using with the plugin (for instance, `plone`).
295
+
296
+ ![Add the new scope to the client](docs/_static/allowedgroups3.png)
297
+
298
+ Finally, in the plugin configuration, add `groups` to the scopes field.
299
+
300
+ In the `Allowed groups` field, you can add the groups that are allowed to log in. For example, in this repository, you could set `Foundation Members`. Users who are not in this group will not be able to log in.
301
+
302
+ ## Technical Decisions
303
+
304
+ ### Usage of sessions in the login process
305
+
306
+ This plugin uses sessions during the login process to identify the user while he goes to the OIDC provider
307
+ and comes back from there.
308
+
309
+ The plugin has 2 ways of working with sessions:
310
+
311
+ - Use the Zope Session Management: if the `Use Zope session data manager` option in the plugin configuration is enabled,
312
+ the plugin will use the session configuration configured in Zope. To do so we advise using [Products.mcdutils](https://pypi.org/project/Products.mcdutils/)
313
+ to save the session data in a memcached based storage. Otherwise, Zope will try to use a ZODB-based session
314
+ which has shown several problems in the past.
315
+
316
+ - Use the cookie-based session management: if the `Use Zope session data manager` option in the plugin
317
+ configuration is disabled, the plugin will use a Cookie to save that information in the client's browser.
318
+
319
+ ### Settings in environment variables
320
+
321
+ Optionally, instead of editing your OIDC provider settings through the ZMI, you can use [collective.regenv](https://pypi.org/project/collective.regenv/) and provide
322
+ a `YAML` file with your settings. This is very useful if you have different settings in different environments
323
+ and you do not want to edit the settings each time you move the contents.
324
+
325
+ ### Varnish
326
+
327
+ Optionally, if you are using the [Varnish caching server](https://6.docs.plone.org/glossary.html#term-Varnish) in front
328
+ of Plone, you may see this plugin only partially working. Especially the `came_from` parameter may be ignored.
329
+ This is because the buildout standard configuration from [plone.recipe.varnish](https://pypi.org/project/plone.recipe.varnish/)
330
+ removes most cookies to improve anonymous caching.
331
+
332
+ The solution is to make sure the `__ac_session` cookie is added to the `cookie-pass` option.
333
+ Check what the current default is in the buildout recipe, and update it:
334
+
335
+
336
+ ## Contribute
337
+
338
+ - Issue Tracker: https://github.com/collective/pas.plugins.oidc/issues
339
+ - Source Code: https://github.com/collective/pas.plugins.oidc
340
+
341
+ ### Local Development Setup
342
+
343
+ You need a working `python` environment (system, `virtualenv`, `pyenv`, etc) version 3.8 or superior.
344
+
345
+ Then install the dependencies and a development instance using:
346
+
347
+ ```bash
348
+ make install
349
+ ```
350
+
351
+ ### Start Local Server
352
+
353
+ Start Plone, on port 8080, with the command:
354
+
355
+ ```bash
356
+ make start
357
+ ```
358
+
359
+ #### Keycloak
360
+
361
+ The `pas.plugins.oidc` repository has a working setup for a `Keycloak` development server using `Docker` and `Docker Compose`. To use it, in a terminal, run the command:
362
+
363
+ ```bash
364
+ make keycloak-start
365
+ ```
366
+
367
+ There are two realms configured `plone` and `plone-test`. The later is used in automated tests, while the former should be used for your development environment.
368
+
369
+ The `plone` realm ships with an user that has the following credentials:
370
+
371
+ * username: **user**
372
+ * password: **12345678**
373
+
374
+ To stop a running `Keycloak` (needed when running tests), use:
375
+
376
+ ```bash
377
+ make keycloak-stop
378
+ ```
379
+
380
+ ### Update translations
381
+
382
+ ```bash
383
+ make i18n
384
+ ```
385
+
386
+ ### Format codebase
387
+
388
+ ```bash
389
+ make format
390
+ ```
391
+
392
+ ### Run tests
393
+
394
+ Testing of this package is done with [`pytest`](https://docs.pytest.org/).
395
+
396
+ Run all tests with:
397
+
398
+ ```bash
399
+ make test
400
+ ```
401
+
402
+ Run all tests but stop on the first error and open a `pdb` session:
403
+
404
+ ```bash
405
+ uv run pytest -x --pdb
406
+ ```
407
+
408
+ Run tests named `TestServiceOIDCPost`:
409
+
410
+ ```bash
411
+ uv run pytest -k TestServiceOIDCPost
412
+ ```
413
+
414
+ ## References
415
+
416
+ * Blog post: https://www.codesyntax.com/en/blog/log-in-in-plone-using-your-google-workspace-account
417
+
418
+ ## License
419
+
420
+ The project is licensed under the GPLv2.