alpha-python 0.3.0__tar.gz → 0.3.2__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 (130) hide show
  1. {alpha_python-0.3.0 → alpha_python-0.3.2}/PKG-INFO +2 -2
  2. {alpha_python-0.3.0 → alpha_python-0.3.2}/pyproject.toml +2 -2
  3. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/__init__.py +17 -7
  4. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/handlers/api_generate_handler.py +13 -25
  5. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/infra/__init__.py +13 -2
  6. alpha_python-0.3.2/src/alpha/infra/connectors/__init__.py +22 -0
  7. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/providers/__init__.py +14 -3
  8. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/services/authentication_service.py +2 -1
  9. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha_python.egg-info/PKG-INFO +2 -2
  10. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha_python.egg-info/requires.txt +1 -1
  11. alpha_python-0.3.0/src/alpha/infra/connectors/__init__.py +0 -11
  12. {alpha_python-0.3.0 → alpha_python-0.3.2}/LICENSE +0 -0
  13. {alpha_python-0.3.0 → alpha_python-0.3.2}/README.md +0 -0
  14. {alpha_python-0.3.0 → alpha_python-0.3.2}/setup.cfg +0 -0
  15. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/adapters/__init__.py +0 -0
  16. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/adapters/sqla_unit_of_work.py +0 -0
  17. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/cli.py +0 -0
  18. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/containers/__init__.py +0 -0
  19. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/containers/container.py +0 -0
  20. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/domain/__init__.py +0 -0
  21. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/domain/models/__init__.py +0 -0
  22. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/domain/models/base_model.py +0 -0
  23. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/domain/models/life_cycle_base.py +0 -0
  24. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/domain/models/user.py +0 -0
  25. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/encoder.py +0 -0
  26. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/exceptions.py +0 -0
  27. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/factories/__init__.py +0 -0
  28. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/factories/_type_conversion_matrix.py +0 -0
  29. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/factories/_type_mapping.py +0 -0
  30. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/factories/class_factories.py +0 -0
  31. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/factories/default_field_factory.py +0 -0
  32. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/factories/field_iterator.py +0 -0
  33. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/factories/jwt_factory.py +0 -0
  34. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/factories/logging_handler_factory.py +0 -0
  35. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/factories/model_class_factory.py +0 -0
  36. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/factories/models/__init__.py +0 -0
  37. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/factories/models/factory_classes.py +0 -0
  38. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/factories/request_factory.py +0 -0
  39. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/factories/response_factory.py +0 -0
  40. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/factories/type_factories.py +0 -0
  41. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/handlers/__init__.py +0 -0
  42. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/handlers/api_run_handler.py +0 -0
  43. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/handlers/base_handler.py +0 -0
  44. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/handlers/gen-code.sh +0 -0
  45. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/handlers/models/__init__.py +0 -0
  46. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/handlers/models/argument.py +0 -0
  47. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/handlers/models/command.py +0 -0
  48. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/handlers/models/section.py +0 -0
  49. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/handlers/models/subparser.py +0 -0
  50. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/handlers/run-api.sh +0 -0
  51. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/handlers/templates/__init__.py +0 -0
  52. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/handlers/templates/python-flask/Dockerfile.mustache +0 -0
  53. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/handlers/templates/python-flask/README.mustache +0 -0
  54. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/handlers/templates/python-flask/__init__model.mustache +0 -0
  55. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/handlers/templates/python-flask/__init__test.mustache +0 -0
  56. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/handlers/templates/python-flask/__main__.mustache +0 -0
  57. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/handlers/templates/python-flask/base_model.mustache +0 -0
  58. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/handlers/templates/python-flask/controller.mustache +0 -0
  59. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/handlers/templates/python-flask/controller_test.mustache +0 -0
  60. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/handlers/templates/python-flask/dockerignore.mustache +0 -0
  61. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/handlers/templates/python-flask/encoder.mustache +0 -0
  62. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/handlers/templates/python-flask/git_push.sh.mustache +0 -0
  63. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/handlers/templates/python-flask/gitignore.mustache +0 -0
  64. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/handlers/templates/python-flask/model.mustache +0 -0
  65. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/handlers/templates/python-flask/openapi.mustache +0 -0
  66. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/handlers/templates/python-flask/param_type.mustache +0 -0
  67. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/handlers/templates/python-flask/requirements.mustache +0 -0
  68. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/handlers/templates/python-flask/security_controller_.mustache +0 -0
  69. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/handlers/templates/python-flask/setup.mustache +0 -0
  70. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/handlers/templates/python-flask/test-requirements.mustache +0 -0
  71. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/handlers/templates/python-flask/tox.mustache +0 -0
  72. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/handlers/templates/python-flask/travis.mustache +0 -0
  73. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/handlers/templates/python-flask/typing_utils.mustache +0 -0
  74. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/handlers/templates/python-flask/util.mustache +0 -0
  75. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/infra/connectors/ldap_connector.py +0 -0
  76. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/infra/connectors/oidc_connector.py +0 -0
  77. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/infra/databases/__init__.py +0 -0
  78. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/infra/databases/sql_alchemy.py +0 -0
  79. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/infra/models/__init__.py +0 -0
  80. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/infra/models/filter_operators.py +0 -0
  81. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/infra/models/json_patch.py +0 -0
  82. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/infra/models/order_by.py +0 -0
  83. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/infra/models/query_clause.py +0 -0
  84. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/infra/models/search_filter.py +0 -0
  85. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/interfaces/__init__.py +0 -0
  86. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/interfaces/attrs_instance.py +0 -0
  87. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/interfaces/dataclass_instance.py +0 -0
  88. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/interfaces/factories.py +0 -0
  89. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/interfaces/handler.py +0 -0
  90. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/interfaces/openapi_model.py +0 -0
  91. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/interfaces/patchable.py +0 -0
  92. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/interfaces/providers.py +0 -0
  93. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/interfaces/pydantic_instance.py +0 -0
  94. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/interfaces/sql_database.py +0 -0
  95. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/interfaces/sql_mapper.py +0 -0
  96. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/interfaces/sql_repository.py +0 -0
  97. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/interfaces/token_factory.py +0 -0
  98. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/interfaces/unit_of_work.py +0 -0
  99. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/interfaces/updateable.py +0 -0
  100. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/mixins/__init__.py +0 -0
  101. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/mixins/jwt_provider.py +0 -0
  102. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/providers/api_key_provider.py +0 -0
  103. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/providers/database_provider.py +0 -0
  104. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/providers/ldap_provider.py +0 -0
  105. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/providers/local_provider.py +0 -0
  106. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/providers/models/__init__.py +0 -0
  107. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/providers/models/credentials.py +0 -0
  108. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/providers/models/identity.py +0 -0
  109. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/providers/models/token.py +0 -0
  110. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/providers/oidc_provider.py +0 -0
  111. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/py.typed +0 -0
  112. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/repositories/__init__.py +0 -0
  113. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/repositories/models/__init__.py +0 -0
  114. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/repositories/models/repository_model.py +0 -0
  115. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/repositories/sql_alchemy_repository.py +0 -0
  116. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/services/__init__.py +0 -0
  117. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/utils/__init__.py +0 -0
  118. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/utils/_http_codes.py +0 -0
  119. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/utils/is_attrs.py +0 -0
  120. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/utils/is_pydantic.py +0 -0
  121. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/utils/logging_configurator.py +0 -0
  122. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/utils/logging_level_checker.py +0 -0
  123. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/utils/response_object.py +0 -0
  124. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/utils/verify_identity.py +0 -0
  125. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha/utils/version_checker.py +0 -0
  126. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha_python.egg-info/SOURCES.txt +0 -0
  127. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha_python.egg-info/dependency_links.txt +0 -0
  128. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha_python.egg-info/entry_points.txt +0 -0
  129. {alpha_python-0.3.0 → alpha_python-0.3.2}/src/alpha_python.egg-info/top_level.txt +0 -0
  130. {alpha_python-0.3.0 → alpha_python-0.3.2}/tests/test_encoder.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: alpha-python
3
- Version: 0.3.0
3
+ Version: 0.3.2
4
4
  Summary: Alpha is intended to be the first dependency you need to add to your Python application. It is a Python library which contains standard building blocks that can be used in applications that are used as APIs and/or make use of database interaction.
5
5
  Author-email: Bart Reijling <bart@reijling.eu>
6
6
  Requires-Python: >=3.11
@@ -16,7 +16,7 @@ Requires-Dist: pyjwt>=2.10.1
16
16
  Requires-Dist: six>=1.17.0
17
17
  Requires-Dist: sqlalchemy>=2.0.44
18
18
  Requires-Dist: requests>=2.28.1
19
- Requires-Dist: dependency-injector<5.0.0,>=4.48.3
19
+ Requires-Dist: dependency-injector[yaml]<5.0.0,>=4.48.3
20
20
  Provides-Extra: api-generator
21
21
  Requires-Dist: openapi-generator-cli==7.14.0; (python_version >= "3.11" and python_version < "4.0") and extra == "api-generator"
22
22
  Requires-Dist: jdk4py; extra == "api-generator"
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "alpha-python"
3
- version = "0.3.0"
3
+ version = "0.3.2"
4
4
  description = "Alpha is intended to be the first dependency you need to add to your Python application. It is a Python library which contains standard building blocks that can be used in applications that are used as APIs and/or make use of database interaction."
5
5
  readme = "README.md"
6
6
  authors = [
@@ -18,7 +18,7 @@ dependencies = [
18
18
  "six>=1.17.0",
19
19
  "sqlalchemy>=2.0.44",
20
20
  "requests>=2.28.1",
21
- "dependency-injector (>=4.48.3,<5.0.0)",
21
+ "dependency-injector[yaml]>=4.48.3,<5.0.0",
22
22
  ]
23
23
 
24
24
  [project.scripts]
@@ -5,7 +5,6 @@ from alpha.factories.model_class_factory import ModelClassFactory
5
5
  from alpha.domain.models.user import User
6
6
  from alpha.domain.models.base_model import BaseDomainModel, DomainModel
7
7
  from alpha.domain.models.life_cycle_base import LifeCycleBase
8
- from alpha.infra.connectors.ldap_connector import LDAPConnector
9
8
  from alpha.infra.connectors.oidc_connector import (
10
9
  OIDCConnector,
11
10
  KeyCloakOIDCConnector,
@@ -43,7 +42,6 @@ from alpha.providers.models.identity import (
43
42
  )
44
43
  from alpha.providers.models.credentials import PasswordCredentials
45
44
  from alpha.providers.models.token import Token
46
- from alpha.providers.ldap_provider import LDAPProvider, ADProvider
47
45
  from alpha.providers.oidc_provider import OIDCProvider, KeyCloakProvider
48
46
  from alpha.repositories.models.repository_model import RepositoryModel
49
47
  from alpha.repositories.sql_alchemy_repository import SqlAlchemyRepository
@@ -58,10 +56,16 @@ from alpha.utils.logging_level_checker import logging_level_checker
58
56
  from alpha.utils.response_object import create_response_object
59
57
  from alpha.utils.verify_identity import verify_identity
60
58
  from alpha.utils.version_checker import minor_version_gte
61
-
62
-
63
59
  from alpha.encoder import JSONEncoder
64
60
 
61
+ # Optional LDAP support - only import if ldap3 is available
62
+ try:
63
+ from alpha.infra.connectors.ldap_connector import LDAPConnector # noqa: F401
64
+ from alpha.providers.ldap_provider import LDAPProvider, ADProvider # noqa: F401
65
+ _LDAP_AVAILABLE = True
66
+ except ImportError:
67
+ _LDAP_AVAILABLE = False # type: ignore
68
+
65
69
  __all__ = [
66
70
  "SqlAlchemyUnitOfWork",
67
71
  "JWTFactory",
@@ -71,7 +75,6 @@ __all__ = [
71
75
  "DomainModel",
72
76
  "LifeCycleBase",
73
77
  "User",
74
- "LDAPConnector",
75
78
  "OIDCConnector",
76
79
  "KeyCloakOIDCConnector",
77
80
  "SqlAlchemyDatabase",
@@ -106,8 +109,6 @@ __all__ = [
106
109
  "AD_SEARCH_ATTRIBUTES",
107
110
  "PasswordCredentials",
108
111
  "Token",
109
- "LDAPProvider",
110
- "ADProvider",
111
112
  "OIDCProvider",
112
113
  "KeyCloakProvider",
113
114
  "RepositoryModel",
@@ -123,3 +124,12 @@ __all__ = [
123
124
  "minor_version_gte",
124
125
  "JSONEncoder",
125
126
  ]
127
+
128
+
129
+ # Conditionally add LDAP-related exports if available
130
+ if _LDAP_AVAILABLE:
131
+ __all__.extend([
132
+ "LDAPConnector",
133
+ "LDAPProvider",
134
+ "ADProvider",
135
+ ])
@@ -5,8 +5,6 @@ import subprocess
5
5
  import time
6
6
  from typing import Any, Optional
7
7
 
8
- # import yaml
9
-
10
8
  from alpha.handlers.base_handler import BaseHandler
11
9
  from alpha.exceptions import InvalidArgumentsException
12
10
 
@@ -17,6 +15,19 @@ class ApiGenerateHandler(BaseHandler):
17
15
  """
18
16
 
19
17
  def __init__(self) -> None:
18
+ try:
19
+ import openapi_generator_cli # type: ignore # noqa: F401
20
+ except ImportError:
21
+ print(
22
+ "OpenAPI Generator CLI is not installed. Please install "
23
+ "the required packages first. \nThis can be done by installing "
24
+ "the \'api-generator\' extra: \n"
25
+ "- pip install alpha-python[api-generator]\n"
26
+ "- poetry add alpha-python --extras api-generator\n"
27
+ "- uv add alpha-python --extra api-generator"
28
+ )
29
+ exit(1)
30
+
20
31
  self.spec_file = None
21
32
  self.api_package = None
22
33
  self.service_package = None
@@ -173,29 +184,6 @@ class ApiGenerateHandler(BaseHandler):
173
184
  else:
174
185
  print(f'No post process file ({self.post_process_file}) found')
175
186
 
176
- # def _generate_configuration(self) -> None:
177
- # """Generate permission.yaml file for the /configuration endpoint."""
178
-
179
- # PERMISSION_FILE = (
180
- # f'{self.cwd}/api/{self.api_package}/config/permissions.yaml'
181
- # )
182
- # os.makedirs(os.path.dirname(PERMISSION_FILE), exist_ok=True)
183
-
184
- # permissions = {}
185
- # with open(str(self.spec_file), 'r') as stream:
186
- # try:
187
- # data = yaml.safe_load(stream)
188
- # parser = YamlParser()
189
- # permissions = { # type: ignore
190
- # 'version': data['info']['version'],
191
- # 'endpoints': parser.parse_endpoints(data),
192
- # }
193
- # except yaml.YAMLError as exc:
194
- # print(exc)
195
-
196
- # with open(PERMISSION_FILE, 'w+') as file:
197
- # yaml.dump(data=permissions, stream=file)
198
-
199
187
  def _copy_templates(self) -> None:
200
188
  """Copy mustache templates to the templates folder in the working
201
189
  directory
@@ -1,12 +1,17 @@
1
- from alpha.infra.connectors.ldap_connector import LDAPConnector
2
1
  from alpha.infra.databases.sql_alchemy import SqlAlchemyDatabase
3
2
  from alpha.infra.models.filter_operators import And, Or
4
3
  from alpha.infra.models.json_patch import JsonPatch
5
4
  from alpha.infra.models.order_by import OrderBy, Order
6
5
  from alpha.infra.models.search_filter import SearchFilter, Operator
7
6
 
7
+ # Optional LDAP support - only import if ldap3 is available
8
+ try:
9
+ from alpha.infra.connectors.ldap_connector import LDAPConnector # noqa: F401
10
+ _LDAP_AVAILABLE = True
11
+ except ImportError:
12
+ _LDAP_AVAILABLE = False # type: ignore
13
+
8
14
  __all__ = [
9
- "LDAPConnector",
10
15
  "SqlAlchemyDatabase",
11
16
  "And",
12
17
  "Or",
@@ -16,3 +21,9 @@ __all__ = [
16
21
  "SearchFilter",
17
22
  "Operator",
18
23
  ]
24
+
25
+ # Conditionally add LDAP-related exports if available
26
+ if _LDAP_AVAILABLE:
27
+ __all__.extend([
28
+ "LDAPConnector",
29
+ ])
@@ -0,0 +1,22 @@
1
+ from alpha.infra.connectors.oidc_connector import (
2
+ OIDCConnector,
3
+ KeyCloakOIDCConnector,
4
+ )
5
+
6
+ # Optional LDAP support - only import if ldap3 is available
7
+ try:
8
+ from alpha.infra.connectors.ldap_connector import LDAPConnector # noqa: F401
9
+ _LDAP_AVAILABLE = True
10
+ except ImportError:
11
+ _LDAP_AVAILABLE = False # type: ignore
12
+
13
+ __all__ = [
14
+ "OIDCConnector",
15
+ "KeyCloakOIDCConnector",
16
+ ]
17
+
18
+ # Conditionally add LDAP-related exports if available
19
+ if _LDAP_AVAILABLE:
20
+ __all__.extend([
21
+ "LDAPConnector",
22
+ ])
@@ -9,9 +9,15 @@ from alpha.providers.models.credentials import PasswordCredentials
9
9
  from alpha.providers.models.token import Token
10
10
 
11
11
  # Providers
12
- from alpha.providers.ldap_provider import LDAPProvider, ADProvider
13
12
  from alpha.providers.oidc_provider import OIDCProvider, KeyCloakProvider
14
13
 
14
+ # Optional LDAP support - only import if ldap3 is available
15
+ try:
16
+ from alpha.providers.ldap_provider import LDAPProvider, ADProvider # noqa: F401
17
+ _LDAP_AVAILABLE = True
18
+ except ImportError:
19
+ _LDAP_AVAILABLE = False # type: ignore
20
+
15
21
  __all__ = [
16
22
  "Identity",
17
23
  "DEFAULT_LDAP_MAPPINGS",
@@ -19,8 +25,13 @@ __all__ = [
19
25
  "AD_SEARCH_ATTRIBUTES",
20
26
  "PasswordCredentials",
21
27
  "Token",
22
- "LDAPProvider",
23
- "ADProvider",
24
28
  "OIDCProvider",
25
29
  "KeyCloakProvider",
26
30
  ]
31
+
32
+ # Conditionally add LDAP-related exports if available
33
+ if _LDAP_AVAILABLE:
34
+ __all__.extend([
35
+ "LDAPProvider",
36
+ "ADProvider",
37
+ ])
@@ -187,7 +187,8 @@ class AuthenticationService:
187
187
  self.uow, self._repository_name
188
188
  )
189
189
  user = users.get_by_id(
190
- value=identity.subject, attr=self._user_id_attribute
190
+ value=getattr(identity, self._user_id_attribute),
191
+ attr=self._user_id_attribute,
191
192
  )
192
193
  if user:
193
194
  identity.update_from_user(user)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: alpha-python
3
- Version: 0.3.0
3
+ Version: 0.3.2
4
4
  Summary: Alpha is intended to be the first dependency you need to add to your Python application. It is a Python library which contains standard building blocks that can be used in applications that are used as APIs and/or make use of database interaction.
5
5
  Author-email: Bart Reijling <bart@reijling.eu>
6
6
  Requires-Python: >=3.11
@@ -16,7 +16,7 @@ Requires-Dist: pyjwt>=2.10.1
16
16
  Requires-Dist: six>=1.17.0
17
17
  Requires-Dist: sqlalchemy>=2.0.44
18
18
  Requires-Dist: requests>=2.28.1
19
- Requires-Dist: dependency-injector<5.0.0,>=4.48.3
19
+ Requires-Dist: dependency-injector[yaml]<5.0.0,>=4.48.3
20
20
  Provides-Extra: api-generator
21
21
  Requires-Dist: openapi-generator-cli==7.14.0; (python_version >= "3.11" and python_version < "4.0") and extra == "api-generator"
22
22
  Requires-Dist: jdk4py; extra == "api-generator"
@@ -8,7 +8,7 @@ pyjwt>=2.10.1
8
8
  six>=1.17.0
9
9
  sqlalchemy>=2.0.44
10
10
  requests>=2.28.1
11
- dependency-injector<5.0.0,>=4.48.3
11
+ dependency-injector[yaml]<5.0.0,>=4.48.3
12
12
 
13
13
  [api-generator]
14
14
  jdk4py
@@ -1,11 +0,0 @@
1
- from alpha.infra.connectors.ldap_connector import LDAPConnector
2
- from alpha.infra.connectors.oidc_connector import (
3
- OIDCConnector,
4
- KeyCloakOIDCConnector,
5
- )
6
-
7
- __all__ = [
8
- "LDAPConnector",
9
- "OIDCConnector",
10
- "KeyCloakOIDCConnector",
11
- ]
File without changes
File without changes
File without changes