pas.plugins.authomatic 1.1.2__tar.gz → 1.3.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 (82) hide show
  1. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/CHANGELOG.md +19 -0
  2. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/Makefile +1 -1
  3. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/PKG-INFO +32 -3
  4. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/setup.py +2 -2
  5. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/src/pas/plugins/authomatic/browser/view.py +11 -2
  6. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/src/pas/plugins/authomatic/configure.zcml +4 -0
  7. pas_plugins_authomatic-1.3.0/src/pas/plugins/authomatic/locales/es/LC_MESSAGES/pas.plugins.authomatic.po +135 -0
  8. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/src/pas/plugins/authomatic/locales/update.py +1 -0
  9. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/src/pas/plugins/authomatic/plugin.py +18 -2
  10. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/src/pas/plugins/authomatic/services/authomatic.py +38 -7
  11. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/src/pas/plugins/authomatic/tests/test_plugin.py +14 -0
  12. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/src/pas/plugins/authomatic/tests/test_setup.py +1 -0
  13. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/src/pas/plugins/authomatic/tests/test_upgrades.py +1 -0
  14. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/src/pas/plugins/authomatic/tests/test_useridentities.py +20 -0
  15. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/src/pas/plugins/authomatic/useridentities.py +1 -1
  16. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/src/pas/plugins/authomatic/useridfactories.py +10 -0
  17. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/src/pas.plugins.authomatic.egg-info/PKG-INFO +32 -3
  18. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/src/pas.plugins.authomatic.egg-info/SOURCES.txt +1 -0
  19. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/.coveragerc +0 -0
  20. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/.editorconfig +0 -0
  21. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/CONTRIBUTORS.md +0 -0
  22. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/LICENSE.txt +0 -0
  23. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/MANIFEST.in +0 -0
  24. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/README.md +0 -0
  25. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/docs/authomatic.svg +0 -0
  26. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/docs/plone-control-panel.png +0 -0
  27. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/docs/plugin-settings.png +0 -0
  28. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/pyproject.toml +0 -0
  29. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/requirements.txt +0 -0
  30. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/setup.cfg +0 -0
  31. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/src/pas/__init__.py +0 -0
  32. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/src/pas/plugins/__init__.py +0 -0
  33. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/src/pas/plugins/authomatic/__init__.py +0 -0
  34. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/src/pas/plugins/authomatic/browser/__init__.py +0 -0
  35. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/src/pas/plugins/authomatic/browser/add_plugin.pt +0 -0
  36. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/src/pas/plugins/authomatic/browser/authomatic.png +0 -0
  37. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/src/pas/plugins/authomatic/browser/authomatic.pt +0 -0
  38. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/src/pas/plugins/authomatic/browser/configure.zcml +0 -0
  39. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/src/pas/plugins/authomatic/browser/controlpanel.py +0 -0
  40. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/src/pas/plugins/authomatic/browser/resources/authomatic-logo.svg +0 -0
  41. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/src/pas/plugins/authomatic/browser/resources/authomatic.css +0 -0
  42. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/src/pas/plugins/authomatic/browser/resources/authomatic.less +0 -0
  43. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/src/pas/plugins/authomatic/integration/__init__.py +0 -0
  44. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/src/pas/plugins/authomatic/integration/restapi.py +0 -0
  45. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/src/pas/plugins/authomatic/integration/zope.py +0 -0
  46. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/src/pas/plugins/authomatic/interfaces.py +0 -0
  47. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/src/pas/plugins/authomatic/locales/__init__.py +0 -0
  48. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/src/pas/plugins/authomatic/locales/de/LC_MESSAGES/pas.plugins.authomatic.po +0 -0
  49. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/src/pas/plugins/authomatic/locales/fr/LC_MESSAGES/pas.plugins.authomatic.po +0 -0
  50. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/src/pas/plugins/authomatic/locales/it/LC_MESSAGES/pas.plugins.authomatic.po +0 -0
  51. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/src/pas/plugins/authomatic/locales/pas.plugins.authomatic-manual.pot +0 -0
  52. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/src/pas/plugins/authomatic/locales/pas.plugins.authomatic.pot +0 -0
  53. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/src/pas/plugins/authomatic/locales/pt_BR/LC_MESSAGES/pas.plugins.authomatic.po +0 -0
  54. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/src/pas/plugins/authomatic/locales/ro/LC_MESSAGES/pas.plugins.authomatic.po +0 -0
  55. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/src/pas/plugins/authomatic/meta.zcml +0 -0
  56. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/src/pas/plugins/authomatic/profiles/default/browserlayer.xml +0 -0
  57. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/src/pas/plugins/authomatic/profiles/default/controlpanel.xml +0 -0
  58. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/src/pas/plugins/authomatic/profiles/default/metadata.xml +0 -0
  59. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/src/pas/plugins/authomatic/profiles/default/registry.xml +0 -0
  60. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/src/pas/plugins/authomatic/profiles/uninstall/browserlayer.xml +0 -0
  61. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/src/pas/plugins/authomatic/profiles/uninstall/controlpanel.xml +0 -0
  62. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/src/pas/plugins/authomatic/profiles/uninstall/registry.xml +0 -0
  63. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/src/pas/plugins/authomatic/profiles.zcml +0 -0
  64. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/src/pas/plugins/authomatic/services/__init__.py +0 -0
  65. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/src/pas/plugins/authomatic/services/configure.zcml +0 -0
  66. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/src/pas/plugins/authomatic/services/login.py +0 -0
  67. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/src/pas/plugins/authomatic/setuphandlers.py +0 -0
  68. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/src/pas/plugins/authomatic/testing.py +0 -0
  69. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/src/pas/plugins/authomatic/tests/__init__.py +0 -0
  70. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/src/pas/plugins/authomatic/tests/mocks.py +0 -0
  71. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/src/pas/plugins/authomatic/tests/test_browser_controlpanel.py +0 -0
  72. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/src/pas/plugins/authomatic/tests/test_services_authomatic.py +0 -0
  73. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/src/pas/plugins/authomatic/tests/test_services_login.py +0 -0
  74. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/src/pas/plugins/authomatic/tests/test_setuphandler.py +0 -0
  75. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/src/pas/plugins/authomatic/tests/test_useridfactories.py +0 -0
  76. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/src/pas/plugins/authomatic/utils.py +0 -0
  77. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/src/pas.plugins.authomatic.egg-info/dependency_links.txt +0 -0
  78. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/src/pas.plugins.authomatic.egg-info/entry_points.txt +0 -0
  79. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/src/pas.plugins.authomatic.egg-info/namespace_packages.txt +0 -0
  80. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/src/pas.plugins.authomatic.egg-info/not-zip-safe +0 -0
  81. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/src/pas.plugins.authomatic.egg-info/requires.txt +0 -0
  82. {pas.plugins.authomatic-1.1.2 → pas_plugins_authomatic-1.3.0}/src/pas.plugins.authomatic.egg-info/top_level.txt +0 -0
@@ -1,5 +1,24 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.3.0 (2024-11-21)
4
+
5
+ - Search users by fullname and email. @alecghica
6
+ - Fix login on Volto frontend when already logged-in in Plone Classic. @avoinea
7
+ - Add the possibility to override the ZopeRequestAdapter.
8
+ - Fix the authomatic view when it is reporting an exception that does not have a message attribute
9
+
10
+
11
+ ## 1.2.0 (2023-09-13)
12
+
13
+ - Add Spanish translation. @macagua
14
+
15
+ - Better handle values from identity data. @cekk
16
+
17
+ - Add `username_userid` User ID factory. @ericof
18
+
19
+ - Annotate transaction in POST calls to authenticate a user. @ericof
20
+
21
+
3
22
  ## 1.1.2 (2023-03-15)
4
23
 
5
24
  - Support Python 3.11 for Plone 6. @ericof
@@ -20,7 +20,7 @@ PLONE6=6.0-latest
20
20
 
21
21
  BACKEND_FOLDER=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
22
22
 
23
- CODE_QUALITY_VERSION=2
23
+ CODE_QUALITY_VERSION=2.1.1
24
24
  ifndef LOG_LEVEL
25
25
  LOG_LEVEL=INFO
26
26
  endif
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pas.plugins.authomatic
3
- Version: 1.1.2
3
+ Version: 1.3.0
4
4
  Summary: Provides OAuth2/OpenID login for Plone using Authomatic.
5
5
  Home-page: https://github.com/collective/pas.plugins.authomatic
6
- Author: Jens Klein and Matthias Dollfuss
6
+ Author: Jens Klein, Matthias Dollfuss, and Érico Andrei
7
7
  Author-email: dev@bluedynamics.com
8
8
  License: GPL
9
9
  Project-URL: Repository, https://github.com/collective/pas.plugins.authomatic/
@@ -28,8 +28,18 @@ Classifier: Programming Language :: Python :: 3.11
28
28
  Classifier: Programming Language :: Python
29
29
  Requires-Python: >=3.7
30
30
  Description-Content-Type: text/markdown
31
- Provides-Extra: test
32
31
  License-File: LICENSE.txt
32
+ Requires-Dist: authomatic>=1.0.0
33
+ Requires-Dist: Products.CMFPlone>=5.2
34
+ Requires-Dist: plone.restapi
35
+ Requires-Dist: setuptools
36
+ Provides-Extra: test
37
+ Requires-Dist: collective.MockMailHost; extra == "test"
38
+ Requires-Dist: parameterized; extra == "test"
39
+ Requires-Dist: plone.app.testing; extra == "test"
40
+ Requires-Dist: plone.restapi[test]; extra == "test"
41
+ Requires-Dist: plone.app.robotframework[debug]; extra == "test"
42
+ Requires-Dist: zest.releaser[recommended]; extra == "test"
33
43
 
34
44
 
35
45
  <div align="center"><img alt="logo" src="https://raw.githubusercontent.com/collective/pas.plugins.authomatic/main/docs/authomatic.svg" width="70" /></div>
@@ -259,6 +269,25 @@ The project is licensed under the GPLv2.
259
269
 
260
270
  # Changelog
261
271
 
272
+ ## 1.3.0 (2024-11-21)
273
+
274
+ - Search users by fullname and email. @alecghica
275
+ - Fix login on Volto frontend when already logged-in in Plone Classic. @avoinea
276
+ - Add the possibility to override the ZopeRequestAdapter.
277
+ - Fix the authomatic view when it is reporting an exception that does not have a message attribute
278
+
279
+
280
+ ## 1.2.0 (2023-09-13)
281
+
282
+ - Add Spanish translation. @macagua
283
+
284
+ - Better handle values from identity data. @cekk
285
+
286
+ - Add `username_userid` User ID factory. @ericof
287
+
288
+ - Annotate transaction in POST calls to authenticate a user. @ericof
289
+
290
+
262
291
  ## 1.1.2 (2023-03-15)
263
292
 
264
293
  - Support Python 3.11 for Plone 6. @ericof
@@ -11,7 +11,7 @@ long_description = f"""
11
11
 
12
12
  setup(
13
13
  name="pas.plugins.authomatic",
14
- version="1.1.2",
14
+ version="1.3.0",
15
15
  description="Provides OAuth2/OpenID login for Plone using Authomatic.",
16
16
  long_description=long_description,
17
17
  long_description_content_type="text/markdown",
@@ -34,7 +34,7 @@ setup(
34
34
  "Programming Language :: Python",
35
35
  ],
36
36
  keywords="Python Plone PAS OAuth Authentication",
37
- author="Jens Klein and Matthias Dollfuss",
37
+ author="Jens Klein, Matthias Dollfuss, and Érico Andrei",
38
38
  author_email="dev@bluedynamics.com",
39
39
  url="https://github.com/collective/pas.plugins.authomatic",
40
40
  project_urls={
@@ -29,6 +29,12 @@ class AuthomaticView(BrowserView):
29
29
 
30
30
  template = ViewPageTemplateFile("authomatic.pt")
31
31
 
32
+ zope_request_adapter_factory = ZopeRequestAdapter
33
+
34
+ @property
35
+ def zope_request_adapter(self):
36
+ return self.zope_request_adapter_factory(self)
37
+
32
38
  def publishTraverse(self, request, name):
33
39
  if name and not hasattr(self, "provider"):
34
40
  self.provider = name
@@ -111,13 +117,16 @@ class AuthomaticView(BrowserView):
111
117
  pass
112
118
  secret = authomatic_settings().secret
113
119
  auth = Authomatic(cfg, secret=secret)
114
- result = auth.login(ZopeRequestAdapter(self), self.provider)
120
+ result = auth.login(self.zope_request_adapter, self.provider)
115
121
  if not result:
116
122
  logger.info("return from view")
117
123
  # let authomatic do its work
118
124
  return
119
125
  if result.error:
120
- return result.error.message
126
+ try:
127
+ return result.error.message
128
+ except AttributeError:
129
+ return str(result.error)
121
130
  display = cfg[self.provider].get("display", {})
122
131
  provider_name = display.get("title", self.provider)
123
132
  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,135 @@
1
+ # Translation of pas.plugins.authomatic.pot to Spanish
2
+ # Leonardo J. Caballero G. <leonardocaballero@gmail.com>, 2023.
3
+ msgid ""
4
+ msgstr ""
5
+ "Project-Id-Version: pas.plugins.authomatic\n"
6
+ "Report-Msgid-Bugs-To: \n"
7
+ "POT-Creation-Date: 2022-07-22 15:19+0000\n"
8
+ "PO-Revision-Date: 2023-05-25 14:22-0400\n"
9
+ "Last-Translator: Leonardo J. Caballero G. <leonardocaballero@gmail.com>\n"
10
+ "Language: es\n"
11
+ "Language-Team: ES <LL@li.org>\n"
12
+ "Content-Type: text/plain; charset=utf-8\n"
13
+ "Content-Transfer-Encoding: 8bit\n"
14
+ "Plural-Forms: nplurals=2; plural=(n != 1);\n"
15
+ "Preferred-Encodings: utf-8\n"
16
+ "MIME-Version: 1.0\n"
17
+ "Language-Code: es\n"
18
+ "Language-Name: Español\n"
19
+ "Domain: pas.plugins.authomatic\n"
20
+ "X-Is-Fallback-For: es-ar es-bo es-cl es-co es-cr es-do es-ec es-es es-sv es-gt es-hn es-mx es-ni es-pa es-py es-pe es-pr es-us es-uy es-ve\n"
21
+
22
+ #: pas/plugins/authomatic/profiles/default/controlpanel.xml
23
+ msgid "Authomatic (OAuth2/OpenID)"
24
+ msgstr "Authomatic (OAuth2/OpenID)"
25
+
26
+ #: pas/plugins/authomatic/profiles.zcml:16
27
+ msgid "Authomatic PAS Plugin"
28
+ msgstr "Plugin PAS Authomatic"
29
+
30
+ #: pas/plugins/authomatic/profiles.zcml:25
31
+ msgid "Authomatic PAS Plugin: uninstall"
32
+ msgstr "Complemento PAS Authomatic: desinstalar"
33
+
34
+ #: pas/plugins/authomatic/browser/view.py:93
35
+ msgid "Authomatic is not configured"
36
+ msgstr "Authomatic no esta configurado"
37
+
38
+ #: pas/plugins/authomatic/profiles.zcml:16
39
+ msgid "Authomatic: Login with OAuth/OpenID 3rd party auth providers using the pas.plugins.authomatic add-on."
40
+ msgstr "Authomatic: inicie sesión con proveedores de autenticación de terceros de OAuth/OpenID mediante el complemento pas.plugins.authomatic."
41
+
42
+ #: pas/plugins/authomatic/interfaces.py:101
43
+ msgid "Generator for Plone User IDs."
44
+ msgstr "Generador de ID de usuario de Plone."
45
+
46
+ #: pas/plugins/authomatic/interfaces.py:111
47
+ msgid "JSON configuration"
48
+ msgstr "Configuración JSON"
49
+
50
+ #: pas/plugins/authomatic/browser/controlpanel.py:9
51
+ msgid "PAS Authomatic Plugin Settings"
52
+ msgstr "Configuración de complemento PAS Authomatic"
53
+
54
+ #: pas/plugins/authomatic/useridfactories.py:31
55
+ msgid "Provider User ID"
56
+ msgstr "User ID del provider"
57
+
58
+ #: pas/plugins/authomatic/useridfactories.py:39
59
+ msgid "Provider User Name"
60
+ msgstr "Nombre de usuario del proveedor"
61
+
62
+ #: pas/plugins/authomatic/browser/view.py:104
63
+ msgid "Provider not supported"
64
+ msgstr "Proveedor no compatible"
65
+
66
+ #: pas/plugins/authomatic/interfaces.py:91
67
+ msgid "Secret"
68
+ msgstr "Secreto"
69
+
70
+ #: pas/plugins/authomatic/useridfactories.py:23
71
+ msgid "UUID as User ID"
72
+ msgstr "UUID como ID de Usuario"
73
+
74
+ #: pas/plugins/authomatic/profiles.zcml:25
75
+ msgid "Uninstalls the pas.plugins.authomatic add-on. This REMOVES ALL USERS managed by this plugin!"
76
+ msgstr "Desinstala el complemento pas.plugins.authomatic. ¡Esto ELIMINA TODOS LOS USUARIOS administrados por este complemento!"
77
+
78
+ #. Default: "Choose one of these external authentication providers"
79
+ #: pas/plugins/authomatic/browser/authomatic.pt:14
80
+ msgid "add_description"
81
+ msgstr "Elija uno de estos proveedores de autenticación externos"
82
+
83
+ #. Default: "Add identity"
84
+ #: pas/plugins/authomatic/browser/authomatic.pt:12
85
+ msgid "add_identity_title"
86
+ msgstr "Añadir identidad"
87
+
88
+ #. Default: "Added identity provided by ${provider}"
89
+ #: pas/plugins/authomatic/browser/view.py:68
90
+ msgid "added_identity"
91
+ msgstr "Añadir identidad proveída por ${provider}"
92
+
93
+ #. Default: "Configuration parameters for the different authorization providers. Details at https://authomatic.github.io/authomatic/reference/providers.html - difference: \"class_\" has to be a string, which is then resolved as a dotted path. Also sections \"display\" and \"propertymap\" are special."
94
+ #: pas/plugins/authomatic/interfaces.py:112
95
+ msgid "help_json_config"
96
+ msgstr "Parámetros de configuración de los diferentes proveedores de autorización. Detalles en https://authomatic.github.io/authomatic/reference/providers.html - diferencia: \"class_\" tiene que ser una cadena, que luego se resuelve como una ruta punteada. También las secciones \"display\" y \"propertymap\" son especiales."
97
+
98
+ #. Default: "Some random string used to encrypt the state"
99
+ #: pas/plugins/authomatic/interfaces.py:92
100
+ msgid "help_secret"
101
+ msgstr "Alguna cadena aleatoria utilizada para cifrar el estado"
102
+
103
+ #. Default: "It is visible if no fullname is mapped and in some rare cases in URLs. It is the identifier used for the user inside Plone."
104
+ #: pas/plugins/authomatic/interfaces.py:102
105
+ msgid "help_userid_factory_name"
106
+ msgstr "Es visible si no se asigna ningún nombre completo y, en algunos casos excepcionales, en las URL. Es el identificador utilizado para el usuario dentro de Plone."
107
+
108
+ #. Default: "At least one provider must be configured."
109
+ #: pas/plugins/authomatic/interfaces.py:71
110
+ msgid "invalid_cfg_empty_dict"
111
+ msgstr "Se debe configurar al menos un proveedor."
112
+
113
+ #. Default: "JSON root must be a mapping (dict)"
114
+ #: pas/plugins/authomatic/interfaces.py:68
115
+ msgid "invalid_cfg_no_dict"
116
+ msgstr "La raíz JSON debe ser una asignación (dict)"
117
+
118
+ #. Default: "JSON is not valid, parser complained: ${message}"
119
+ #: pas/plugins/authomatic/interfaces.py:61
120
+ msgid "invalid_json"
121
+ msgstr "JSON no es válido, el analizador se quejó: ${message}"
122
+
123
+ #. Default: "Logged in with ${provider}"
124
+ #: pas/plugins/authomatic/browser/view.py:81
125
+ msgid "logged_in_with"
126
+ msgstr "Iniciado sesión con ${provider}"
127
+
128
+ #. Default: "Log in with"
129
+ #: pas/plugins/authomatic/browser/authomatic.pt:9
130
+ msgid "login_title"
131
+ msgstr "Inicia con"
132
+
133
+ #: pas/plugins/authomatic/browser/view.py:100
134
+ msgid "redirecting"
135
+ msgstr "redirigir"
@@ -1,4 +1,5 @@
1
1
  """Update locales."""
2
+
2
3
  from pathlib import Path
3
4
 
4
5
  import logging
@@ -262,10 +262,26 @@ class AuthomaticPlugin(BasePlugin):
262
262
  if not userid:
263
263
  logger.warn("None userid found. This should not happen!")
264
264
  continue
265
- if not userid.startswith(search_id):
266
- continue
265
+
266
+ # search for a match in fullname, email and userid
267
267
  identity = self._useridentities_by_userid[userid]
268
+ search_term = search_id.lower()
268
269
  identity_userid = identity.userid
270
+ identity_fullname = identity.propertysheet.getProperty(
271
+ "fullname", ""
272
+ ).lower()
273
+ identity_email = identity.propertysheet.getProperty("email", "").lower()
274
+ if (
275
+ search_term not in identity_userid
276
+ and search_term not in identity_fullname # noqa: W503
277
+ and search_term not in identity_email # noqa: W503
278
+ ):
279
+ continue
280
+
281
+ # if not userid.startswith(search_id):
282
+ # continue
283
+ # identity = self._useridentities_by_userid[userid]
284
+ # identity_userid = identity.userid
269
285
  ret.append(
270
286
  {
271
287
  "id": identity_userid,
@@ -7,11 +7,18 @@ from plone.protect.interfaces import IDisableCSRFProtection
7
7
  from plone.restapi.deserializer import json_body
8
8
  from plone.restapi.services import Service
9
9
  from Products.PluggableAuthService.interfaces.plugins import IAuthenticationPlugin
10
+ from transaction.interfaces import NoTransaction
10
11
  from urllib.parse import parse_qsl
11
12
  from zope.interface import alsoProvides
12
13
  from zope.interface import implementer
13
14
  from zope.publisher.interfaces import IPublishTraverse
14
15
 
16
+ import logging
17
+ import transaction
18
+
19
+
20
+ logger = logging.getLogger("pas.plugins.authomatic")
21
+
15
22
 
16
23
  @implementer(IPublishTraverse)
17
24
  class LoginAuthomatic(Service):
@@ -158,15 +165,13 @@ class Post(LoginAuthomatic):
158
165
  break
159
166
  return plugin
160
167
 
161
- def _add_identity(self, result):
168
+ def _add_identity(self, result, userid=None):
162
169
  """Add an identity to an existing user.
163
170
 
164
171
  :param result: Authomatic login result.
165
172
  """
166
173
  aclu = self._get_acl_users()
167
- aclu.authomatic.remember_identity(
168
- result,
169
- )
174
+ aclu.authomatic.remember_identity(result, userid)
170
175
 
171
176
  def _remember_identity(self, result):
172
177
  """Store identity information.
@@ -189,6 +194,23 @@ class Post(LoginAuthomatic):
189
194
  token = plugin.create_token(user.getId(), data=payload)
190
195
  return token
191
196
 
197
+ def _annotate_transaction(self, action, user):
198
+ """Add a note to the current transaction."""
199
+ try:
200
+ # Get the current transaction
201
+ tx = transaction.get()
202
+ except NoTransaction:
203
+ return None
204
+ # Set user on the transaction
205
+ tx.setUser(user.getUser())
206
+ user_info = user.getProperty("fullname") or user.getUserName()
207
+ msg = ""
208
+ if action == "login":
209
+ msg = f"(Logged in {user_info})"
210
+ elif action == "add_identity":
211
+ msg = f"(Added new identity to user {user_info})"
212
+ tx.note(msg)
213
+
192
214
  def reply(self) -> dict:
193
215
  """Process OAuth callback, authenticate the user and return a JWT Token.
194
216
 
@@ -217,14 +239,23 @@ class Post(LoginAuthomatic):
217
239
  }
218
240
  elif result:
219
241
  alsoProvides(self.request, IDisableCSRFProtection)
242
+ action = ""
220
243
  if api.user.is_anonymous():
221
244
  self._remember_identity(result)
245
+ action = "login"
222
246
  else:
223
247
  # Authenticated user, add an identity to it
224
- self._add_identity(result)
248
+ try:
249
+ userid = api.user.get_current().getId()
250
+ self._add_identity(result, userid)
251
+ action = "add_identity"
252
+ except ValueError as err:
253
+ logger.exception(err)
254
+
225
255
  user = api.user.get_current()
226
256
  # Make sure we are not setting cookies here
227
257
  # as it will break the authentication mechanism with JWT tokens
228
258
  self.request.response.cookies = {}
229
- token = self.get_token(user)
230
- return {"token": token}
259
+ if action:
260
+ self._annotate_transaction(action, user=user)
261
+ return {"token": self.get_token(user)}
@@ -1,3 +1,4 @@
1
+ from pas.plugins.authomatic.testing import AUTHOMATIC_PLONE_INTEGRATION_TESTING
1
2
  from pas.plugins.authomatic.testing import AUTHOMATIC_ZOPE_FIXTURE
2
3
  from pas.plugins.authomatic.tests.mocks import make_user
3
4
 
@@ -56,6 +57,19 @@ class TestPlugin(unittest.TestCase):
56
57
  self.assertEqual(admin["pluginid"], "users")
57
58
  self.assertEqual(self.aclu.getUserById("admin").getId(), "admin")
58
59
 
60
+
61
+ class TestPlonePlugin(unittest.TestCase):
62
+
63
+ layer = AUTHOMATIC_PLONE_INTEGRATION_TESTING
64
+
65
+ def setUp(self):
66
+ # create plugin
67
+ from pas.plugins.authomatic.setuphandlers import _add_plugin
68
+
69
+ self.aclu = self.layer["app"].acl_users
70
+ _add_plugin(self.aclu, "authomatic")
71
+ self.plugin = self.aclu["authomatic"]
72
+
59
73
  def test_user_enumaration(self):
60
74
  make_user("123joe", testcase=self)
61
75
  make_user("123jane", testcase=self)
@@ -1,4 +1,5 @@
1
1
  """Setup tests for this package."""
2
+
2
3
  from pas.plugins.authomatic.testing import AUTHOMATIC_PLONE_INTEGRATION_TESTING
3
4
  from Products.CMFPlone.utils import get_installer
4
5
 
@@ -1,4 +1,5 @@
1
1
  """Upgrades tests for this package."""
2
+
2
3
  from parameterized import parameterized
3
4
  from pas.plugins.authomatic.testing import AUTHOMATIC_PLONE_INTEGRATION_TESTING
4
5
  from plone.app.testing import setRoles
@@ -132,5 +132,25 @@ class TestUserIdentities(unittest.TestCase):
132
132
  self.assertEqual(sheet.getProperty("email"), "andrewpipkin@foobar.com")
133
133
  self.assertEqual(sheet.getProperty("customdomain"), "foobar.com")
134
134
 
135
+ def test_read_attribute_from_provider_data_if_default_is_none(self):
136
+ PNAME = "mockhub"
137
+ user = self._make_authomatic_user(
138
+ provider_name=PNAME, data={"email": "jdoe@foobar.com"}
139
+ )
140
+ user.email = None
141
+ authomatic_result = MockResult(
142
+ user=user,
143
+ provider=MockResult(name=PNAME),
144
+ )
145
+ uis = make_user("mustermann")
146
+ uis.handle_result(authomatic_result)
147
+
148
+ # mock cfg
149
+ with mock.patch("pas.plugins.authomatic.useridentities.authomatic_cfg") as acfg:
150
+ cfg = self._make_cfg(PNAME)
151
+ acfg.return_value = cfg
152
+ sheet = uis.propertysheet
153
+ self.assertEqual(sheet.getProperty("email"), "jdoe@foobar.com")
154
+
135
155
  def test_credentials(self):
136
156
  pass
@@ -71,7 +71,7 @@ class UserIdentities(Persistent):
71
71
  for akey, pkey in cfg.get("propertymap", {}).items():
72
72
  # Always search first on the user attributes, then on the raw
73
73
  # data this guaratees we do not break existing configurations
74
- ainfo = identity.get(akey, identity["data"].get(akey, None))
74
+ ainfo = identity.get(akey, None) or identity["data"].get(akey, None)
75
75
  if ainfo is None:
76
76
  continue
77
77
  if isinstance(pkey, dict):
@@ -48,3 +48,13 @@ def new_userid(plugin, result):
48
48
  IUserIDFactory, name=settings.userid_factory_name, default=UUID4UserIDFactory()
49
49
  )
50
50
  return factory(plugin, result)
51
+
52
+
53
+ class ProviderIDUserNameIdFactory(BaseUserIDFactory):
54
+ title = _("Provider User Name or User ID")
55
+
56
+ def __call__(self, plugin, result):
57
+ user_id = result.user.username
58
+ if not user_id:
59
+ user_id = result.user.id
60
+ return self.normalize(plugin, result, user_id)
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pas.plugins.authomatic
3
- Version: 1.1.2
3
+ Version: 1.3.0
4
4
  Summary: Provides OAuth2/OpenID login for Plone using Authomatic.
5
5
  Home-page: https://github.com/collective/pas.plugins.authomatic
6
- Author: Jens Klein and Matthias Dollfuss
6
+ Author: Jens Klein, Matthias Dollfuss, and Érico Andrei
7
7
  Author-email: dev@bluedynamics.com
8
8
  License: GPL
9
9
  Project-URL: Repository, https://github.com/collective/pas.plugins.authomatic/
@@ -28,8 +28,18 @@ Classifier: Programming Language :: Python :: 3.11
28
28
  Classifier: Programming Language :: Python
29
29
  Requires-Python: >=3.7
30
30
  Description-Content-Type: text/markdown
31
- Provides-Extra: test
32
31
  License-File: LICENSE.txt
32
+ Requires-Dist: authomatic>=1.0.0
33
+ Requires-Dist: Products.CMFPlone>=5.2
34
+ Requires-Dist: plone.restapi
35
+ Requires-Dist: setuptools
36
+ Provides-Extra: test
37
+ Requires-Dist: collective.MockMailHost; extra == "test"
38
+ Requires-Dist: parameterized; extra == "test"
39
+ Requires-Dist: plone.app.testing; extra == "test"
40
+ Requires-Dist: plone.restapi[test]; extra == "test"
41
+ Requires-Dist: plone.app.robotframework[debug]; extra == "test"
42
+ Requires-Dist: zest.releaser[recommended]; extra == "test"
33
43
 
34
44
 
35
45
  <div align="center"><img alt="logo" src="https://raw.githubusercontent.com/collective/pas.plugins.authomatic/main/docs/authomatic.svg" width="70" /></div>
@@ -259,6 +269,25 @@ The project is licensed under the GPLv2.
259
269
 
260
270
  # Changelog
261
271
 
272
+ ## 1.3.0 (2024-11-21)
273
+
274
+ - Search users by fullname and email. @alecghica
275
+ - Fix login on Volto frontend when already logged-in in Plone Classic. @avoinea
276
+ - Add the possibility to override the ZopeRequestAdapter.
277
+ - Fix the authomatic view when it is reporting an exception that does not have a message attribute
278
+
279
+
280
+ ## 1.2.0 (2023-09-13)
281
+
282
+ - Add Spanish translation. @macagua
283
+
284
+ - Better handle values from identity data. @cekk
285
+
286
+ - Add `username_userid` User ID factory. @ericof
287
+
288
+ - Annotate transaction in POST calls to authenticate a user. @ericof
289
+
290
+
262
291
  ## 1.1.2 (2023-03-15)
263
292
 
264
293
  - Support Python 3.11 for Plone 6. @ericof
@@ -51,6 +51,7 @@ src/pas/plugins/authomatic/locales/pas.plugins.authomatic-manual.pot
51
51
  src/pas/plugins/authomatic/locales/pas.plugins.authomatic.pot
52
52
  src/pas/plugins/authomatic/locales/update.py
53
53
  src/pas/plugins/authomatic/locales/de/LC_MESSAGES/pas.plugins.authomatic.po
54
+ src/pas/plugins/authomatic/locales/es/LC_MESSAGES/pas.plugins.authomatic.po
54
55
  src/pas/plugins/authomatic/locales/fr/LC_MESSAGES/pas.plugins.authomatic.po
55
56
  src/pas/plugins/authomatic/locales/it/LC_MESSAGES/pas.plugins.authomatic.po
56
57
  src/pas/plugins/authomatic/locales/pt_BR/LC_MESSAGES/pas.plugins.authomatic.po