pas.plugins.authomatic 1.1.2__tar.gz → 2.0.0b1__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 (88) hide show
  1. pas.plugins.authomatic-2.0.0b1/.gitignore +18 -0
  2. {pas.plugins.authomatic-1.1.2 → pas.plugins.authomatic-2.0.0b1}/PKG-INFO +76 -202
  3. {pas.plugins.authomatic-1.1.2 → pas.plugins.authomatic-2.0.0b1}/README.md +52 -28
  4. {pas.plugins.authomatic-1.1.2/src → pas.plugins.authomatic-2.0.0b1}/pas/plugins/authomatic/__init__.py +17 -6
  5. {pas.plugins.authomatic-1.1.2/src → pas.plugins.authomatic-2.0.0b1}/pas/plugins/authomatic/browser/controlpanel.py +1 -2
  6. {pas.plugins.authomatic-1.1.2/src → pas.plugins.authomatic-2.0.0b1}/pas/plugins/authomatic/browser/view.py +19 -7
  7. {pas.plugins.authomatic-1.1.2/src → pas.plugins.authomatic-2.0.0b1}/pas/plugins/authomatic/configure.zcml +4 -0
  8. pas.plugins.authomatic-2.0.0b1/pas/plugins/authomatic/integration/__init__.py +8 -0
  9. {pas.plugins.authomatic-1.1.2/src → pas.plugins.authomatic-2.0.0b1}/pas/plugins/authomatic/integration/restapi.py +1 -3
  10. {pas.plugins.authomatic-1.1.2/src → pas.plugins.authomatic-2.0.0b1}/pas/plugins/authomatic/interfaces.py +1 -2
  11. {pas.plugins.authomatic-1.1.2/src → pas.plugins.authomatic-2.0.0b1}/pas/plugins/authomatic/locales/de/LC_MESSAGES/pas.plugins.authomatic.po +24 -16
  12. pas.plugins.authomatic-2.0.0b1/pas/plugins/authomatic/locales/es/LC_MESSAGES/pas.plugins.authomatic.po +143 -0
  13. {pas.plugins.authomatic-1.1.2/src → pas.plugins.authomatic-2.0.0b1}/pas/plugins/authomatic/locales/fr/LC_MESSAGES/pas.plugins.authomatic.po +24 -16
  14. {pas.plugins.authomatic-1.1.2/src → pas.plugins.authomatic-2.0.0b1}/pas/plugins/authomatic/locales/it/LC_MESSAGES/pas.plugins.authomatic.po +24 -16
  15. {pas.plugins.authomatic-1.1.2/src → pas.plugins.authomatic-2.0.0b1}/pas/plugins/authomatic/locales/pas.plugins.authomatic.pot +24 -16
  16. {pas.plugins.authomatic-1.1.2/src → pas.plugins.authomatic-2.0.0b1}/pas/plugins/authomatic/locales/pt_BR/LC_MESSAGES/pas.plugins.authomatic.po +25 -17
  17. {pas.plugins.authomatic-1.1.2/src → pas.plugins.authomatic-2.0.0b1}/pas/plugins/authomatic/locales/ro/LC_MESSAGES/pas.plugins.authomatic.po +43 -26
  18. {pas.plugins.authomatic-1.1.2/src → pas.plugins.authomatic-2.0.0b1}/pas/plugins/authomatic/locales/update.py +6 -1
  19. pas.plugins.authomatic-2.0.0b1/pas/plugins/authomatic/logging.py +6 -0
  20. pas.plugins.authomatic-2.0.0b1/pas/plugins/authomatic/patches/__init__.py +5 -0
  21. pas.plugins.authomatic-2.0.0b1/pas/plugins/authomatic/patches/authomatic.py +151 -0
  22. {pas.plugins.authomatic-1.1.2/src → pas.plugins.authomatic-2.0.0b1}/pas/plugins/authomatic/plugin.py +34 -20
  23. {pas.plugins.authomatic-1.1.2/src → pas.plugins.authomatic-2.0.0b1}/pas/plugins/authomatic/services/authomatic.py +39 -8
  24. {pas.plugins.authomatic-1.1.2/src → pas.plugins.authomatic-2.0.0b1}/pas/plugins/authomatic/services/login.py +7 -11
  25. {pas.plugins.authomatic-1.1.2/src → pas.plugins.authomatic-2.0.0b1}/pas/plugins/authomatic/testing.py +15 -18
  26. {pas.plugins.authomatic-1.1.2/src → pas.plugins.authomatic-2.0.0b1}/pas/plugins/authomatic/useridentities.py +2 -2
  27. {pas.plugins.authomatic-1.1.2/src → pas.plugins.authomatic-2.0.0b1}/pas/plugins/authomatic/useridfactories.py +10 -3
  28. pas.plugins.authomatic-2.0.0b1/pyproject.toml +274 -0
  29. pas.plugins.authomatic-1.1.2/.coveragerc +0 -7
  30. pas.plugins.authomatic-1.1.2/.editorconfig +0 -36
  31. pas.plugins.authomatic-1.1.2/CHANGELOG.md +0 -150
  32. pas.plugins.authomatic-1.1.2/CONTRIBUTORS.md +0 -3
  33. pas.plugins.authomatic-1.1.2/MANIFEST.in +0 -5
  34. pas.plugins.authomatic-1.1.2/Makefile +0 -116
  35. pas.plugins.authomatic-1.1.2/docs/authomatic.svg +0 -18
  36. pas.plugins.authomatic-1.1.2/docs/plone-control-panel.png +0 -0
  37. pas.plugins.authomatic-1.1.2/docs/plugin-settings.png +0 -0
  38. pas.plugins.authomatic-1.1.2/pyproject.toml +0 -44
  39. pas.plugins.authomatic-1.1.2/requirements.txt +0 -1
  40. pas.plugins.authomatic-1.1.2/setup.cfg +0 -4
  41. pas.plugins.authomatic-1.1.2/setup.py +0 -74
  42. pas.plugins.authomatic-1.1.2/src/pas/plugins/authomatic/integration/__init__.py +0 -2
  43. pas.plugins.authomatic-1.1.2/src/pas/plugins/authomatic/tests/__init__.py +0 -0
  44. pas.plugins.authomatic-1.1.2/src/pas/plugins/authomatic/tests/mocks.py +0 -27
  45. pas.plugins.authomatic-1.1.2/src/pas/plugins/authomatic/tests/test_browser_controlpanel.py +0 -75
  46. pas.plugins.authomatic-1.1.2/src/pas/plugins/authomatic/tests/test_plugin.py +0 -109
  47. pas.plugins.authomatic-1.1.2/src/pas/plugins/authomatic/tests/test_services_authomatic.py +0 -53
  48. pas.plugins.authomatic-1.1.2/src/pas/plugins/authomatic/tests/test_services_login.py +0 -28
  49. pas.plugins.authomatic-1.1.2/src/pas/plugins/authomatic/tests/test_setup.py +0 -43
  50. pas.plugins.authomatic-1.1.2/src/pas/plugins/authomatic/tests/test_setuphandler.py +0 -48
  51. pas.plugins.authomatic-1.1.2/src/pas/plugins/authomatic/tests/test_upgrades.py +0 -39
  52. pas.plugins.authomatic-1.1.2/src/pas/plugins/authomatic/tests/test_useridentities.py +0 -136
  53. pas.plugins.authomatic-1.1.2/src/pas/plugins/authomatic/tests/test_useridfactories.py +0 -26
  54. pas.plugins.authomatic-1.1.2/src/pas.plugins.authomatic.egg-info/PKG-INFO +0 -411
  55. pas.plugins.authomatic-1.1.2/src/pas.plugins.authomatic.egg-info/SOURCES.txt +0 -79
  56. pas.plugins.authomatic-1.1.2/src/pas.plugins.authomatic.egg-info/dependency_links.txt +0 -1
  57. pas.plugins.authomatic-1.1.2/src/pas.plugins.authomatic.egg-info/entry_points.txt +0 -5
  58. pas.plugins.authomatic-1.1.2/src/pas.plugins.authomatic.egg-info/namespace_packages.txt +0 -2
  59. pas.plugins.authomatic-1.1.2/src/pas.plugins.authomatic.egg-info/not-zip-safe +0 -1
  60. pas.plugins.authomatic-1.1.2/src/pas.plugins.authomatic.egg-info/requires.txt +0 -12
  61. pas.plugins.authomatic-1.1.2/src/pas.plugins.authomatic.egg-info/top_level.txt +0 -1
  62. {pas.plugins.authomatic-1.1.2 → pas.plugins.authomatic-2.0.0b1}/LICENSE.txt +0 -0
  63. {pas.plugins.authomatic-1.1.2/src → pas.plugins.authomatic-2.0.0b1}/pas/__init__.py +0 -0
  64. {pas.plugins.authomatic-1.1.2/src → pas.plugins.authomatic-2.0.0b1}/pas/plugins/__init__.py +0 -0
  65. {pas.plugins.authomatic-1.1.2/src → pas.plugins.authomatic-2.0.0b1}/pas/plugins/authomatic/browser/__init__.py +0 -0
  66. {pas.plugins.authomatic-1.1.2/src → pas.plugins.authomatic-2.0.0b1}/pas/plugins/authomatic/browser/add_plugin.pt +0 -0
  67. {pas.plugins.authomatic-1.1.2/src → pas.plugins.authomatic-2.0.0b1}/pas/plugins/authomatic/browser/authomatic.png +0 -0
  68. {pas.plugins.authomatic-1.1.2/src → pas.plugins.authomatic-2.0.0b1}/pas/plugins/authomatic/browser/authomatic.pt +0 -0
  69. {pas.plugins.authomatic-1.1.2/src → pas.plugins.authomatic-2.0.0b1}/pas/plugins/authomatic/browser/configure.zcml +0 -0
  70. {pas.plugins.authomatic-1.1.2/src → pas.plugins.authomatic-2.0.0b1}/pas/plugins/authomatic/browser/resources/authomatic-logo.svg +0 -0
  71. {pas.plugins.authomatic-1.1.2/src → pas.plugins.authomatic-2.0.0b1}/pas/plugins/authomatic/browser/resources/authomatic.css +0 -0
  72. {pas.plugins.authomatic-1.1.2/src → pas.plugins.authomatic-2.0.0b1}/pas/plugins/authomatic/browser/resources/authomatic.less +0 -0
  73. {pas.plugins.authomatic-1.1.2/src → pas.plugins.authomatic-2.0.0b1}/pas/plugins/authomatic/integration/zope.py +0 -0
  74. {pas.plugins.authomatic-1.1.2/src → pas.plugins.authomatic-2.0.0b1}/pas/plugins/authomatic/locales/__init__.py +0 -0
  75. {pas.plugins.authomatic-1.1.2/src → pas.plugins.authomatic-2.0.0b1}/pas/plugins/authomatic/locales/pas.plugins.authomatic-manual.pot +0 -0
  76. {pas.plugins.authomatic-1.1.2/src → pas.plugins.authomatic-2.0.0b1}/pas/plugins/authomatic/meta.zcml +0 -0
  77. {pas.plugins.authomatic-1.1.2/src → pas.plugins.authomatic-2.0.0b1}/pas/plugins/authomatic/profiles/default/browserlayer.xml +0 -0
  78. {pas.plugins.authomatic-1.1.2/src → pas.plugins.authomatic-2.0.0b1}/pas/plugins/authomatic/profiles/default/controlpanel.xml +0 -0
  79. {pas.plugins.authomatic-1.1.2/src → pas.plugins.authomatic-2.0.0b1}/pas/plugins/authomatic/profiles/default/metadata.xml +0 -0
  80. {pas.plugins.authomatic-1.1.2/src → pas.plugins.authomatic-2.0.0b1}/pas/plugins/authomatic/profiles/default/registry.xml +0 -0
  81. {pas.plugins.authomatic-1.1.2/src → pas.plugins.authomatic-2.0.0b1}/pas/plugins/authomatic/profiles/uninstall/browserlayer.xml +0 -0
  82. {pas.plugins.authomatic-1.1.2/src → pas.plugins.authomatic-2.0.0b1}/pas/plugins/authomatic/profiles/uninstall/controlpanel.xml +0 -0
  83. {pas.plugins.authomatic-1.1.2/src → pas.plugins.authomatic-2.0.0b1}/pas/plugins/authomatic/profiles/uninstall/registry.xml +0 -0
  84. {pas.plugins.authomatic-1.1.2/src → pas.plugins.authomatic-2.0.0b1}/pas/plugins/authomatic/profiles.zcml +0 -0
  85. {pas.plugins.authomatic-1.1.2/src → pas.plugins.authomatic-2.0.0b1}/pas/plugins/authomatic/services/__init__.py +0 -0
  86. {pas.plugins.authomatic-1.1.2/src → pas.plugins.authomatic-2.0.0b1}/pas/plugins/authomatic/services/configure.zcml +0 -0
  87. {pas.plugins.authomatic-1.1.2/src → pas.plugins.authomatic-2.0.0b1}/pas/plugins/authomatic/setuphandlers.py +0 -0
  88. {pas.plugins.authomatic-1.1.2/src → pas.plugins.authomatic-2.0.0b1}/pas/plugins/authomatic/utils.py +0 -0
@@ -0,0 +1,18 @@
1
+ !src/pas
2
+ .coverage*
3
+ .pydevproject
4
+ .pytest_cache
5
+ .ruff_cache
6
+ .python-version
7
+ .venv
8
+ *.egg-info
9
+ *.log
10
+ *.mo
11
+ *.pyc
12
+ *.swp
13
+ constraints-mxdev.txt
14
+ constraints.txt
15
+ instance
16
+ requirements-mxdev.txt
17
+ requirements.lock
18
+ requirements.txt
@@ -1,36 +1,40 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: pas.plugins.authomatic
3
- Version: 1.1.2
3
+ Version: 2.0.0b1
4
4
  Summary: Provides OAuth2/OpenID login for Plone using Authomatic.
5
- Home-page: https://github.com/collective/pas.plugins.authomatic
6
- Author: Jens Klein and Matthias Dollfuss
7
- Author-email: dev@bluedynamics.com
8
- License: GPL
9
- Project-URL: Repository, https://github.com/collective/pas.plugins.authomatic/
10
5
  Project-URL: Changelog, https://github.com/collective/pas.plugins.authomatic/blob/main/CHANGELOG.md
6
+ Project-URL: Homepage, https://github.com/collective/pas.plugins.authomatic
11
7
  Project-URL: Issues, https://github.com/collective/pas.plugins.authomatic/issues
12
- Keywords: Python Plone PAS OAuth Authentication
8
+ Project-URL: Repository, https://github.com/collective/pas.plugins.authomatic/
9
+ Author: Matthias Dollfuss
10
+ Author-email: Jens Klein <dev@bluedynamics.com>, Érico Andrei <ericof@plone.org>
11
+ License: GNU General Public License v2 (GPLv2)
12
+ License-File: LICENSE.txt
13
+ Keywords: Authentication,OAuth,PAS,Plone,Python
13
14
  Classifier: Development Status :: 5 - Production/Stable
14
15
  Classifier: Environment :: Web Environment
15
- Classifier: Framework :: Plone :: 5.2
16
+ Classifier: Framework :: Plone
16
17
  Classifier: Framework :: Plone :: 6.0
18
+ Classifier: Framework :: Plone :: 6.1
17
19
  Classifier: Framework :: Plone :: Addon
18
- Classifier: Framework :: Plone
19
- Classifier: Framework :: Zope :: 5
20
20
  Classifier: Framework :: Zope
21
+ Classifier: Framework :: Zope :: 5
21
22
  Classifier: License :: OSI Approved :: GNU General Public License v2 (GPLv2)
23
+ Classifier: Programming Language :: Python
22
24
  Classifier: Programming Language :: Python :: 3 :: Only
23
- Classifier: Programming Language :: Python :: 3.7
24
- Classifier: Programming Language :: Python :: 3.8
25
- Classifier: Programming Language :: Python :: 3.9
26
- Classifier: Programming Language :: Python :: 3.10
27
25
  Classifier: Programming Language :: Python :: 3.11
28
- Classifier: Programming Language :: Python
29
- Requires-Python: >=3.7
30
- Description-Content-Type: text/markdown
26
+ Classifier: Programming Language :: Python :: 3.12
27
+ Requires-Python: >=3.11
28
+ Requires-Dist: authomatic>=1.3.0
29
+ Requires-Dist: plone-restapi
30
+ Requires-Dist: products-cmfplone>=6.0
31
31
  Provides-Extra: test
32
- License-File: LICENSE.txt
33
-
32
+ Requires-Dist: collective-mockmailhost; extra == 'test'
33
+ Requires-Dist: plone-app-robotframework[debug]; extra == 'test'
34
+ Requires-Dist: plone-app-testing; extra == 'test'
35
+ Requires-Dist: plone-restapi[test]; extra == 'test'
36
+ Requires-Dist: zest-releaser[recommended]; extra == 'test'
37
+ Description-Content-Type: text/markdown
34
38
 
35
39
  <div align="center"><img alt="logo" src="https://raw.githubusercontent.com/collective/pas.plugins.authomatic/main/docs/authomatic.svg" width="70" /></div>
36
40
 
@@ -56,8 +60,7 @@ License-File: LICENSE.txt
56
60
 
57
61
  </div>
58
62
 
59
- Features
60
- --------
63
+ ## Features
61
64
 
62
65
  **pas.plugins.authomatic** provides OAuth2 and OpenID login capability for Plone sites by integrating the awesome [Authomatic](https://authomatic.github.io/authomatic/) package.
63
66
 
@@ -72,12 +75,11 @@ through standards like OAuth and OpenID.
72
75
  *by author Peter Hudec on Authomatic website*
73
76
 
74
77
 
75
- Supported Providers
76
- -------------------
78
+ ### Supported Providers
77
79
 
78
80
  Out of the box, **pas.plugins.authomatic** supports the following providers
79
81
 
80
- *OAuth 1.0a*
82
+ #### OAuth 1.0
81
83
 
82
84
  - Bitbucket
83
85
  - Flickr
@@ -91,7 +93,7 @@ Out of the box, **pas.plugins.authomatic** supports the following providers
91
93
  - Xing
92
94
  - Yahoo
93
95
 
94
- *OAuth 2.0*
96
+ #### OAuth 2.0
95
97
 
96
98
  - Amazon
97
99
  - Behance
@@ -112,33 +114,58 @@ Out of the box, **pas.plugins.authomatic** supports the following providers
112
114
  - Yammer
113
115
  - Yandex
114
116
 
115
- *OpenID*
117
+ #### OpenID
116
118
 
117
119
  - python-openid
118
120
  - Google App Engine based OpenID.
119
121
 
120
122
 
121
- Documentation
122
- -------------
123
+ ## Documentation
123
124
 
124
125
  This package supports Plone sites using Volto or the Classic UI.
125
126
 
126
- For the Classic UI:
127
-
128
- - This package creates a view called `authomatic-handler` where you can login with different providers.
129
- - The view can be used as well to add an identity from a provider to an existing account.
130
- - The provider is choosen in the URL so if you call `/authomatic-handler/PROVIDER` you will use PROVIDER to login.
131
-
132
- For Volto:
127
+ ### Volto Frontend
133
128
 
134
129
  - Endpoint `@login` with GET: Returns list of authentication options
135
130
  - Endpoint `@login-authomatic` with GET: Provide information to start the OAuth process.
136
131
  - Endpoint `@login-authomatic` with POST: Handles OAuth login and returns a JSON web token (JWT).
137
132
  - For Volto sites you must also install [@plone-collective/volto-authomatic](https://github.com/collective/volto-authomatic).
133
+ - Plugin configuration is available in the Control-panel `/controlpanel/authomatic` (linked under users)
134
+ - Example JSON configuration (first level key is the PROVIDER):
135
+
136
+ ```json
137
+ {
138
+ "github": {
139
+ "display": {
140
+ "title": "Github",
141
+ "cssclasses": {
142
+ "button": "plone-btn plone-btn-default",
143
+ "icon": "glypicon glyphicon-github"
144
+ },
145
+ "as_form": false
146
+ },
147
+ "propertymap": {
148
+ "email": "email",
149
+ "link": "home_page",
150
+ "location": "location",
151
+ "name": "fullname"
152
+ },
153
+ "class_": "authomatic.providers.oauth2.GitHub",
154
+ "consumer_key": "5c4901d141e736f114a7",
155
+ "consumer_secret": "d4692ca3c0ab6cc1f8b28d3ccb1ea15b61e7ef5c",
156
+ "access_headers": {
157
+ "User-Agent": "Plone Authomatic Plugin"
158
+ }
159
+ },
160
+ }
161
+ ```
138
162
 
139
163
 
140
- Configuration is, currently, done via Classic UI:
164
+ ### Classic UI
141
165
 
166
+ - This package creates a view called `authomatic-handler` where you can login with different providers.
167
+ - The view can be used as well to add an identity from a provider to an existing account.
168
+ - The provider is choosen in the URL so if you call `/authomatic-handler/PROVIDER` you will use PROVIDER to login.
142
169
  - Plugin configuration is available in the Controlpanel `@@authomatic-controlpanel` (linked under users)
143
170
  - Example JSON configuration (first level key is the PROVIDER):
144
171
 
@@ -169,8 +196,7 @@ Configuration is, currently, done via Classic UI:
169
196
  }
170
197
  ```
171
198
 
172
- Installation
173
- ------------
199
+ ## Installation
174
200
 
175
201
  Add **pas.plugins.authomatic** to the Plone installation using `pip`:
176
202
 
@@ -190,8 +216,7 @@ or add it as a dependency on your package's `setup.py`
190
216
 
191
217
  Start Plone and activate the plugin in the addons control-panel.
192
218
 
193
- Configuration
194
- -------------
219
+ ## Configuration
195
220
 
196
221
  Using Classic UI, go to the `Authomatic` controlpanel.
197
222
 
@@ -217,8 +242,7 @@ There are some differences in configuration:
217
242
  It is a mapping from authomatic/provider user properties to plone user properties, like `"fullname": "name",`. Look at each providers documentation which properties are available.
218
243
 
219
244
 
220
- Source Code and Contributions
221
- -----------------------------
245
+ ## Source Code and Contributions
222
246
 
223
247
  If you want to help with the development (improvement, update, bug-fixing, ...) of `pas.plugins.authomatic` this is a great idea!
224
248
 
@@ -232,15 +256,14 @@ Creator of **pas.plugins.authomatic** is Jens Klein.
232
256
 
233
257
  We appreciate any contribution and if a release is needed to be done on PyPI, please just contact one of us.
234
258
 
235
- Development
236
- -----------
259
+ ### Development
237
260
 
238
261
  You need a working `python` environment (system, virtualenv, pyenv, etc) version 3.7 or superior.
239
262
 
240
263
  Then install the dependencies and a development instance using:
241
264
 
242
265
  ```bash
243
- make build
266
+ make install
244
267
  ```
245
268
 
246
269
  To run tests for this package:
@@ -249,163 +272,14 @@ To run tests for this package:
249
272
  make test
250
273
  ```
251
274
 
252
- By default we use the latest Plone version in the 6.x series.
253
-
254
- License
255
- -------
256
-
257
- The project is licensed under the GPLv2.
258
-
259
-
260
- # Changelog
261
-
262
- ## 1.1.2 (2023-03-15)
263
-
264
- - Support Python 3.11 for Plone 6. @ericof
265
-
266
- - Lint fixes @ericof
267
-
268
-
269
- ## 1.1.1 (2022-10-14)
270
-
271
- - Upgrade plone/code-analysis-action to version 2. @ericof
272
-
273
- - Fix packaging issue related to CHANGELOG.md not being included in the source package. @ericof
274
-
275
- - Support Python 3.10 for Plone 6. @ericof
276
-
277
-
278
- ## 1.1.0 (2022-10-10)
279
-
280
- - Add the plone.restapi adapter to show the controlpanel in Volto. @erral
275
+ To lint the codebase:
281
276
 
282
- - Add possibility to redirect to `next_url` via provided cookie @avoinea
283
-
284
-
285
- ## 1.0.0 (2022-07-25)
286
-
287
- - Use plone/plone-setup GitHub Action. @ericof
288
-
289
- - Add Brazilian Portuguese translation. @ericof
290
-
291
- - Use plone/code-analysis-action GitHub Action for code analysis. @ericof
292
-
293
- - Fix doChangeUser takes 2 positional arguments but 3 were given @avoinea
294
-
295
- ## 1.0b2 (2021-08-18)
296
-
297
- - Fix tox setup, move CI from TravisCI to GitHub Actions. @jensens
298
-
299
- - Code Style Black, Isort, zpretty and Pyupgrade applied. @jensens
300
-
301
- - Add missing no-op methods for IUserManagement to plugin.
302
- This fixes the tests. @jensens
303
-
304
- - Drop Python 2 support and so require Plone 5.2. @jensens
305
-
306
- - Include permissions from CMFCore to avoid ComponentLookupError. @bsuttor
307
-
308
- - Fixed ModuleNotFoundError: No module named 'App.class_init' on Zope 5. @bsuttor
309
-
310
- - Add french translation @mpeeters
311
-
312
- - PAS event notification IPrincipalCreatedEvent. @jensens
313
-
314
- - Python 3 and Plone 52 compatibility. @cekk
315
-
316
- - Fix #44: Fullfill strictly exact_match when enumerating users @allusa
317
-
318
- - Allow users deletion. @cekk
319
-
320
- - Drop Plone < 5.1.x compatibility. @cekk
321
-
322
- - Fix #54: Notification of PrincipalCreated event. @ericof
323
-
324
- - Closes #55: Support plone.restapi. @ericof
325
-
326
- ## 1.0b1 (2017-11-20)
327
-
328
- - Slighly beautify login modal. @jensens
329
-
330
- - Fix #33" Page does not exist Control Settings. @jensens
331
-
332
- - Fix #31: Link is broken to JSON configuration documentation in help text. @jensens
333
-
334
- - Fix #28: After uninstall plone.external_login_url is still registered and the login broken. @jensens
335
-
336
- - Support for Plone 5.1 tested (worked, ust control-panel icon needed some tweak).
337
- Buildout configuration for 5.1 added. @jensens
338
-
339
- - Install: Hide non-valid profiles at install form. @jensens
340
-
341
- - Additional checks to ensure to never have an empty/None key stored. @jensens
342
-
343
- - Fix #27: Update user data after login. @jensens
344
-
345
- - Fix filter users bug in enumerateUsers plugin where it was always returning
346
- all the users. @sneridagh
347
-
348
- - fix typo and wording of login message @tkimnguyen
349
-
350
-
351
- ## 1.0a7 (2016-02-15)
352
-
353
- - Workaround for None users. @sneridagh
354
-
355
-
356
- ## 1.0a6 (2016-01-11)
357
-
358
- - Fix #21: When you logout and then login again, a new user is created. @jensens
359
-
360
-
361
- ## 1.0a5 (2015-12-04)
362
-
363
- - Fix: #18 "Provider Login" option for "Generator for Plone User ID" seems
364
- broken @jensens
365
-
366
- - Fix: Title indicates if an identity is added @jensens
367
-
368
- - Fix: Correct usage of plone.protect @jensens
369
-
370
-
371
- ## 1.0a4 (2015-11-20)
372
-
373
- - Added german translation @jensens
374
-
375
- - Restored Plone 4 compatibility @keul
376
-
377
- - Added italian translation @keul
378
-
379
- - Proper uninstall @keul
380
-
381
- ## 1.0a3 (2015-11-15)
382
-
383
- - Refactor authomatic-handler to enable adding identities. @jensens
384
-
385
- - Fix: use secret from settings as secret for Authomatic. @jensens
386
-
387
- - Renamed view ``authomatic-login`` to ``authomatic-handler``, because this
388
- view will be used to add an identity too (url must be registered on provider
389
- side sometimes and we want to do this only once). @jensens
390
-
391
-
392
- ## 1.0a2 (2015-11-14)
393
-
394
- - Minimal validation of JSON. @jensens
395
-
396
- - Make the whole ``remember`` procedure a ``safeWrite`` if called from login
397
- view. We can not pass a authenticator token here, because of redirects and
398
- expected return urls . @jensens
399
-
400
- - Allow selection of user id generator strategy. @jensens
401
-
402
- - Allow multiple services for one user. This changes a lot behind the scenes. @jensens
403
-
404
- - Use authomatic.core.User attributes instead of raw provider data. closes [#9](https://github.com/collective/pas.plugins.authomatic/issues/9) @ericof
405
-
406
-
407
- ## 1.0a1 (2015-10-28)
277
+ ```bash
278
+ make lint
279
+ ```
408
280
 
409
- - Initial release.
281
+ By default we use the latest Plone version in the 6.x series.
410
282
 
283
+ ## License
411
284
 
285
+ The project is licensed under the GPLv2.
@@ -22,8 +22,7 @@
22
22
 
23
23
  </div>
24
24
 
25
- Features
26
- --------
25
+ ## Features
27
26
 
28
27
  **pas.plugins.authomatic** provides OAuth2 and OpenID login capability for Plone sites by integrating the awesome [Authomatic](https://authomatic.github.io/authomatic/) package.
29
28
 
@@ -38,12 +37,11 @@ through standards like OAuth and OpenID.
38
37
  *by author Peter Hudec on Authomatic website*
39
38
 
40
39
 
41
- Supported Providers
42
- -------------------
40
+ ### Supported Providers
43
41
 
44
42
  Out of the box, **pas.plugins.authomatic** supports the following providers
45
43
 
46
- *OAuth 1.0a*
44
+ #### OAuth 1.0
47
45
 
48
46
  - Bitbucket
49
47
  - Flickr
@@ -57,7 +55,7 @@ Out of the box, **pas.plugins.authomatic** supports the following providers
57
55
  - Xing
58
56
  - Yahoo
59
57
 
60
- *OAuth 2.0*
58
+ #### OAuth 2.0
61
59
 
62
60
  - Amazon
63
61
  - Behance
@@ -78,33 +76,58 @@ Out of the box, **pas.plugins.authomatic** supports the following providers
78
76
  - Yammer
79
77
  - Yandex
80
78
 
81
- *OpenID*
79
+ #### OpenID
82
80
 
83
81
  - python-openid
84
82
  - Google App Engine based OpenID.
85
83
 
86
84
 
87
- Documentation
88
- -------------
85
+ ## Documentation
89
86
 
90
87
  This package supports Plone sites using Volto or the Classic UI.
91
88
 
92
- For the Classic UI:
93
-
94
- - This package creates a view called `authomatic-handler` where you can login with different providers.
95
- - The view can be used as well to add an identity from a provider to an existing account.
96
- - The provider is choosen in the URL so if you call `/authomatic-handler/PROVIDER` you will use PROVIDER to login.
97
-
98
- For Volto:
89
+ ### Volto Frontend
99
90
 
100
91
  - Endpoint `@login` with GET: Returns list of authentication options
101
92
  - Endpoint `@login-authomatic` with GET: Provide information to start the OAuth process.
102
93
  - Endpoint `@login-authomatic` with POST: Handles OAuth login and returns a JSON web token (JWT).
103
94
  - For Volto sites you must also install [@plone-collective/volto-authomatic](https://github.com/collective/volto-authomatic).
95
+ - Plugin configuration is available in the Control-panel `/controlpanel/authomatic` (linked under users)
96
+ - Example JSON configuration (first level key is the PROVIDER):
97
+
98
+ ```json
99
+ {
100
+ "github": {
101
+ "display": {
102
+ "title": "Github",
103
+ "cssclasses": {
104
+ "button": "plone-btn plone-btn-default",
105
+ "icon": "glypicon glyphicon-github"
106
+ },
107
+ "as_form": false
108
+ },
109
+ "propertymap": {
110
+ "email": "email",
111
+ "link": "home_page",
112
+ "location": "location",
113
+ "name": "fullname"
114
+ },
115
+ "class_": "authomatic.providers.oauth2.GitHub",
116
+ "consumer_key": "5c4901d141e736f114a7",
117
+ "consumer_secret": "d4692ca3c0ab6cc1f8b28d3ccb1ea15b61e7ef5c",
118
+ "access_headers": {
119
+ "User-Agent": "Plone Authomatic Plugin"
120
+ }
121
+ },
122
+ }
123
+ ```
104
124
 
105
125
 
106
- Configuration is, currently, done via Classic UI:
126
+ ### Classic UI
107
127
 
128
+ - This package creates a view called `authomatic-handler` where you can login with different providers.
129
+ - The view can be used as well to add an identity from a provider to an existing account.
130
+ - The provider is choosen in the URL so if you call `/authomatic-handler/PROVIDER` you will use PROVIDER to login.
108
131
  - Plugin configuration is available in the Controlpanel `@@authomatic-controlpanel` (linked under users)
109
132
  - Example JSON configuration (first level key is the PROVIDER):
110
133
 
@@ -135,8 +158,7 @@ Configuration is, currently, done via Classic UI:
135
158
  }
136
159
  ```
137
160
 
138
- Installation
139
- ------------
161
+ ## Installation
140
162
 
141
163
  Add **pas.plugins.authomatic** to the Plone installation using `pip`:
142
164
 
@@ -156,8 +178,7 @@ or add it as a dependency on your package's `setup.py`
156
178
 
157
179
  Start Plone and activate the plugin in the addons control-panel.
158
180
 
159
- Configuration
160
- -------------
181
+ ## Configuration
161
182
 
162
183
  Using Classic UI, go to the `Authomatic` controlpanel.
163
184
 
@@ -183,8 +204,7 @@ There are some differences in configuration:
183
204
  It is a mapping from authomatic/provider user properties to plone user properties, like `"fullname": "name",`. Look at each providers documentation which properties are available.
184
205
 
185
206
 
186
- Source Code and Contributions
187
- -----------------------------
207
+ ## Source Code and Contributions
188
208
 
189
209
  If you want to help with the development (improvement, update, bug-fixing, ...) of `pas.plugins.authomatic` this is a great idea!
190
210
 
@@ -198,15 +218,14 @@ Creator of **pas.plugins.authomatic** is Jens Klein.
198
218
 
199
219
  We appreciate any contribution and if a release is needed to be done on PyPI, please just contact one of us.
200
220
 
201
- Development
202
- -----------
221
+ ### Development
203
222
 
204
223
  You need a working `python` environment (system, virtualenv, pyenv, etc) version 3.7 or superior.
205
224
 
206
225
  Then install the dependencies and a development instance using:
207
226
 
208
227
  ```bash
209
- make build
228
+ make install
210
229
  ```
211
230
 
212
231
  To run tests for this package:
@@ -215,9 +234,14 @@ To run tests for this package:
215
234
  make test
216
235
  ```
217
236
 
237
+ To lint the codebase:
238
+
239
+ ```bash
240
+ make lint
241
+ ```
242
+
218
243
  By default we use the latest Plone version in the 6.x series.
219
244
 
220
- License
221
- -------
245
+ ## License
222
246
 
223
247
  The project is licensed under the GPLv2.
@@ -1,9 +1,13 @@
1
- from AccessControl.Permissions import add_user_folders
2
- from pas.plugins.authomatic.plugin import AuthomaticPlugin
3
- from pas.plugins.authomatic.plugin import manage_addAuthomaticPlugin
4
- from pas.plugins.authomatic.plugin import manage_addAuthomaticPluginForm
5
- from pas.plugins.authomatic.plugin import tpl_dir
6
- from Products.PluggableAuthService import registerMultiPlugin
1
+ from pas.plugins.authomatic.patches import apply_patches
2
+
3
+
4
+ __version__ = "2.0.0b1"
5
+
6
+
7
+ PACKAGE_NAME = "pas.plugins.authomatic"
8
+
9
+
10
+ apply_patches()
7
11
 
8
12
 
9
13
  def initialize(context):
@@ -15,6 +19,13 @@ def initialize(context):
15
19
  Here, we call the Archetypes machinery to register our content types
16
20
  with Zope and the CMF.
17
21
  """
22
+ from AccessControl.Permissions import add_user_folders
23
+ from pas.plugins.authomatic.plugin import AuthomaticPlugin
24
+ from pas.plugins.authomatic.plugin import manage_addAuthomaticPlugin
25
+ from pas.plugins.authomatic.plugin import manage_addAuthomaticPluginForm
26
+ from pas.plugins.authomatic.plugin import tpl_dir
27
+ from Products.PluggableAuthService import registerMultiPlugin
28
+
18
29
  registerMultiPlugin(AuthomaticPlugin.meta_type)
19
30
  context.registerClass(
20
31
  AuthomaticPlugin,
@@ -8,7 +8,6 @@ from zope.interface import Interface
8
8
 
9
9
 
10
10
  class AuthomaticSettingsEditForm(controlpanel.RegistryEditForm):
11
-
12
11
  schema = IPasPluginsAuthomaticSettings
13
12
  label = _("PAS Authomatic Plugin Settings")
14
13
  description = ""
@@ -33,7 +32,7 @@ class AuthomaticSettingsConfigletPanel(RegistryConfigletPanel):
33
32
 
34
33
  schema = IPasPluginsAuthomaticSettings
35
34
  configlet_id = "authomatic"
36
- configlet_category_id = "Products"
35
+ configlet_category_id = "plone-users"
37
36
  title = _("Authomatic settings")
38
37
  group = ""
39
38
  schema_prefix = "pas.plugins.authomatic.interfaces.IPasPluginsAuthomaticSettings"
@@ -26,9 +26,14 @@ def is_root(obj):
26
26
 
27
27
  @implementer(IPublishTraverse)
28
28
  class AuthomaticView(BrowserView):
29
-
30
29
  template = ViewPageTemplateFile("authomatic.pt")
31
30
 
31
+ zope_request_adapter_factory = ZopeRequestAdapter
32
+
33
+ @property
34
+ def zope_request_adapter(self):
35
+ return self.zope_request_adapter_factory(self)
36
+
32
37
  def publishTraverse(self, request, name):
33
38
  if name and not hasattr(self, "provider"):
34
39
  self.provider = name
@@ -86,10 +91,15 @@ class AuthomaticView(BrowserView):
86
91
  self.request,
87
92
  )
88
93
 
94
+ def _handle_error(self, error):
95
+ try:
96
+ return error.message
97
+ except AttributeError:
98
+ return str(error)
99
+
89
100
  def __call__(self):
90
- cfg = authomatic_cfg()
91
101
  provider = getattr(self, "provider", "")
92
- if cfg is None:
102
+ if cfg := authomatic_cfg() is None:
93
103
  return _("Authomatic is not configured")
94
104
  if not is_root(self.context):
95
105
  # callback url is expected on either navigationroot or site root
@@ -104,20 +114,22 @@ class AuthomaticView(BrowserView):
104
114
  return _("Provider not supported")
105
115
  if not self.is_anon:
106
116
  if provider in self._provider_names:
107
- logger.warn(f"Provider {provider} is already connected to current user")
117
+ logger.warning(
118
+ f"Provider {provider} is already connected to current user"
119
+ )
108
120
  return self._redirect()
109
121
  # TODO: some sort of CSRF check might be needed, so that
110
122
  # not an account got connected by CSRF. Research needed.
111
123
  pass
112
124
  secret = authomatic_settings().secret
113
125
  auth = Authomatic(cfg, secret=secret)
114
- result = auth.login(ZopeRequestAdapter(self), self.provider)
126
+ result = auth.login(self.zope_request_adapter, self.provider)
115
127
  if not result:
116
128
  logger.info("return from view")
117
129
  # let authomatic do its work
118
130
  return
119
- if result.error:
120
- return result.error.message
131
+ elif error := result.error:
132
+ return self._handle_error(error)
121
133
  display = cfg[self.provider].get("display", {})
122
134
  provider_name = display.get("title", self.provider)
123
135
  if not self.is_anon:
@@ -40,5 +40,9 @@
40
40
  factory=".useridfactories.ProviderIDUserNameFactory"
41
41
  name="username"
42
42
  />
43
+ <utility
44
+ factory=".useridfactories.ProviderIDUserNameIdFactory"
45
+ name="username_userid"
46
+ />
43
47
 
44
48
  </configure>
@@ -0,0 +1,8 @@
1
+ from .restapi import RestAPIAdapter
2
+ from .zope import ZopeRequestAdapter
3
+
4
+
5
+ __all__ = [
6
+ "RestAPIAdapter",
7
+ "ZopeRequestAdapter",
8
+ ]