square-authentication 10.0.4__tar.gz → 10.0.6__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 (41) hide show
  1. {square_authentication-10.0.4 → square_authentication-10.0.6}/PKG-INFO +22 -19
  2. {square_authentication-10.0.4 → square_authentication-10.0.6}/pyproject.toml +8 -7
  3. square_authentication-10.0.4/.github/workflows/docker-build-publish.yaml +0 -61
  4. square_authentication-10.0.4/.github/workflows/pypi-publish.yaml +0 -34
  5. square_authentication-10.0.4/.github/workflows/pytest.yaml +0 -29
  6. square_authentication-10.0.4/.gitignore +0 -8
  7. square_authentication-10.0.4/CHANGELOG.md +0 -284
  8. square_authentication-10.0.4/Dockerfile +0 -12
  9. square_authentication-10.0.4/LICENSE +0 -674
  10. square_authentication-10.0.4/tests/conftest.py +0 -89
  11. square_authentication-10.0.4/tests/test_1.py +0 -10
  12. square_authentication-10.0.4/tests/test_authentication.py +0 -40
  13. square_authentication-10.0.4/tests/test_delete_user.py +0 -14
  14. square_authentication-10.0.4/tests/test_email_verification.py +0 -11
  15. square_authentication-10.0.4/tests/test_login.py +0 -34
  16. square_authentication-10.0.4/tests/test_profile_management.py +0 -99
  17. square_authentication-10.0.4/tests/test_token_management.py +0 -67
  18. square_authentication-10.0.4/tests/test_update_profile.py +0 -14
  19. square_authentication-10.0.4/tests/test_username.py +0 -111
  20. {square_authentication-10.0.4 → square_authentication-10.0.6}/README.md +0 -0
  21. {square_authentication-10.0.4 → square_authentication-10.0.6}/square_authentication/__init__.py +0 -0
  22. {square_authentication-10.0.4 → square_authentication-10.0.6}/square_authentication/configuration.py +0 -0
  23. {square_authentication-10.0.4 → square_authentication-10.0.6}/square_authentication/data/config.sample.ini +0 -0
  24. {square_authentication-10.0.4 → square_authentication-10.0.6}/square_authentication/data/config.testing.sample.ini +0 -0
  25. {square_authentication-10.0.4 → square_authentication-10.0.6}/square_authentication/main.py +0 -0
  26. {square_authentication-10.0.4 → square_authentication-10.0.6}/square_authentication/messages.py +0 -0
  27. {square_authentication-10.0.4 → square_authentication-10.0.6}/square_authentication/pydantic_models/__init__.py +0 -0
  28. {square_authentication-10.0.4 → square_authentication-10.0.6}/square_authentication/pydantic_models/core.py +0 -0
  29. {square_authentication-10.0.4 → square_authentication-10.0.6}/square_authentication/pydantic_models/profile.py +0 -0
  30. {square_authentication-10.0.4 → square_authentication-10.0.6}/square_authentication/routes/__init__.py +0 -0
  31. {square_authentication-10.0.4 → square_authentication-10.0.6}/square_authentication/routes/core.py +0 -0
  32. {square_authentication-10.0.4 → square_authentication-10.0.6}/square_authentication/routes/profile.py +0 -0
  33. {square_authentication-10.0.4 → square_authentication-10.0.6}/square_authentication/routes/utility.py +0 -0
  34. {square_authentication-10.0.4 → square_authentication-10.0.6}/square_authentication/utils/__init__.py +0 -0
  35. {square_authentication-10.0.4 → square_authentication-10.0.6}/square_authentication/utils/core.py +0 -0
  36. {square_authentication-10.0.4 → square_authentication-10.0.6}/square_authentication/utils/encryption.py +0 -0
  37. {square_authentication-10.0.4 → square_authentication-10.0.6}/square_authentication/utils/routes/__init__.py +0 -0
  38. {square_authentication-10.0.4 → square_authentication-10.0.6}/square_authentication/utils/routes/core.py +0 -0
  39. {square_authentication-10.0.4 → square_authentication-10.0.6}/square_authentication/utils/routes/profile.py +0 -0
  40. {square_authentication-10.0.4 → square_authentication-10.0.6}/square_authentication/utils/routes/utility.py +0 -0
  41. {square_authentication-10.0.4 → square_authentication-10.0.6}/square_authentication/utils/token.py +0 -0
@@ -1,40 +1,43 @@
1
- Metadata-Version: 2.4
2
- Name: square_authentication
3
- Version: 10.0.4
1
+ Metadata-Version: 2.3
2
+ Name: square-authentication
3
+ Version: 10.0.6
4
4
  Summary: authentication layer for my personal server.
5
- Project-URL: homepage, https://github.com/thepmsquare/square_authentication
5
+ Keywords: authentication,fastapi,server,utilities
6
+ Author: Parth Mukesh Mangtani
6
7
  Author-email: Parth Mukesh Mangtani <thepmsquare@gmail.com>
7
8
  License: GPLv3
8
- License-File: LICENSE
9
- Keywords: authentication,fastapi,server,utilities
10
9
  Classifier: Development Status :: 3 - Alpha
11
- Classifier: Framework :: FastAPI
12
10
  Classifier: Intended Audience :: Developers
13
11
  Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
14
12
  Classifier: Operating System :: OS Independent
15
13
  Classifier: Programming Language :: Python :: 3
16
- Classifier: Programming Language :: Python :: 3 :: Only
17
14
  Classifier: Programming Language :: Python :: 3.12
18
- Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
19
- Classifier: Topic :: Internet :: WWW/HTTP :: HTTP Servers
15
+ Classifier: Programming Language :: Python :: 3 :: Only
20
16
  Classifier: Topic :: Security
21
- Requires-Python: >=3.12
22
- Requires-Dist: bcrypt>=4.1.2
23
- Requires-Dist: cryptography>=42.0.7
17
+ Classifier: Topic :: Internet :: WWW/HTTP :: HTTP Servers
18
+ Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
19
+ Classifier: Framework :: FastAPI
20
+ Requires-Dist: uvicorn>=0.24.0.post1
24
21
  Requires-Dist: fastapi>=0.104.1
25
- Requires-Dist: google-auth>=2.40.3
26
- Requires-Dist: httpx>=0.27.2
22
+ Requires-Dist: python-multipart>=0.0.6
27
23
  Requires-Dist: pydantic>=2.5.3
24
+ Requires-Dist: bcrypt>=4.1.2
28
25
  Requires-Dist: pyjwt>=2.8.0
29
- Requires-Dist: pytest>=8.0.0
30
- Requires-Dist: python-multipart>=0.0.6
31
26
  Requires-Dist: requests>=2.32.3
27
+ Requires-Dist: cryptography>=42.0.7
32
28
  Requires-Dist: square-commons>=3.0.0
29
+ Requires-Dist: square-logger>=3.0.0
33
30
  Requires-Dist: square-database-helper>=2.6.1
34
31
  Requires-Dist: square-database-structure>=2.6.0
35
32
  Requires-Dist: square-file-store-helper>=3.0.0
36
- Requires-Dist: square-logger>=3.0.0
37
- Requires-Dist: uvicorn>=0.24.0.post1
33
+ Requires-Dist: httpx>=0.27.2
34
+ Requires-Dist: google-auth>=2.40.3
35
+ Requires-Dist: pytest>=8.3.3 ; extra == 'all'
36
+ Requires-Dist: pytest>=8.3.3 ; extra == 'dev'
37
+ Requires-Python: >=3.12
38
+ Project-URL: homepage, https://github.com/thepmsquare/square_authentication
39
+ Provides-Extra: all
40
+ Provides-Extra: dev
38
41
  Description-Content-Type: text/markdown
39
42
 
40
43
  # square_authentication
@@ -1,10 +1,10 @@
1
1
  [build-system]
2
- requires = ["hatchling"]
3
- build-backend = "hatchling.build"
2
+ requires = ["uv-build"]
3
+ build-backend = "uv_build"
4
4
 
5
5
  [project]
6
6
  name = "square_authentication"
7
- version = "10.0.4"
7
+ version = "10.0.6"
8
8
  description = "authentication layer for my personal server."
9
9
  readme = "README.md"
10
10
  readme-content-type = "text/markdown"
@@ -29,10 +29,10 @@ dependencies = [
29
29
  "square_database_helper>=2.6.1",
30
30
  "square_database_structure>=2.6.0",
31
31
  "square_file_store_helper>=3.0.0",
32
- "pytest>=8.0.0",
33
32
  "httpx>=0.27.2",
34
33
  "google-auth>=2.40.3",
35
34
  ]
35
+ optional-dependencies = { all = ["pytest>=8.3.3"], dev = ["pytest>=8.3.3"] }
36
36
  classifiers = [
37
37
  "Development Status :: 3 - Alpha",
38
38
  "Intended Audience :: Developers",
@@ -47,6 +47,7 @@ classifiers = [
47
47
  "Framework :: FastAPI"
48
48
  ]
49
49
 
50
- [tool.hatch.build.targets.wheel]
51
- packages = ["square_authentication"]
52
- include = ["square_authentication/data/*"]
50
+ [tool.uv.build-backend]
51
+ module-name = "square_authentication"
52
+ module-root = ""
53
+ source-include = ["square_authentication/data/*"]
@@ -1,61 +0,0 @@
1
- name: Build and Deploy Docker Image
2
-
3
- on:
4
- release:
5
- types: [ published ]
6
- workflow_dispatch:
7
- inputs:
8
- release_tag:
9
- description: "Release Tag"
10
- required: true
11
- is_latest:
12
- description: "Tag as latest"
13
- required: true
14
- type: boolean
15
-
16
- jobs:
17
- build:
18
- runs-on: ubuntu-latest
19
-
20
- steps:
21
- - name: Checkout code
22
- uses: actions/checkout@v4
23
-
24
- - name: Set Release Tag
25
- id: set-tag
26
- run: |
27
- if [[ "${{ github.event_name }}" == "release" ]]; then
28
- echo "Release triggered with tag: ${{ github.event.release.tag_name }}"
29
- echo "RELEASE_TAG=${{ github.event.release.tag_name }}" >> $GITHUB_ENV
30
- # Automatically tag as latest during a release event if needed
31
- LATEST_TAG=$(curl -s https://api.github.com/repos/${{ github.repository }}/releases/latest | jq -r .tag_name)
32
- if [[ "${{ github.event.release.tag_name }}" == "$LATEST_TAG" ]]; then
33
- echo "IS_LATEST=true" >> $GITHUB_ENV
34
- else
35
- echo "IS_LATEST=false" >> $GITHUB_ENV
36
- fi
37
- else
38
- echo "Manual trigger with user input tag: ${{ github.event.inputs.release_tag }}"
39
- echo "RELEASE_TAG=${{ github.event.inputs.release_tag }}" >> $GITHUB_ENV
40
- echo "IS_LATEST=${{ github.event.inputs.is_latest }}" >> $GITHUB_ENV
41
- fi
42
-
43
- - name: Set up Docker Buildx
44
- uses: docker/setup-buildx-action@v3.3.0
45
-
46
- - name: Set up QEMU
47
- uses: docker/setup-qemu-action@v3
48
-
49
- - name: Log in to Docker Hub
50
- uses: docker/login-action@v3
51
- with:
52
- username: ${{ secrets.DOCKERHUB_USERNAME }}
53
- password: ${{ secrets.DOCKERHUB_TOKEN }}
54
-
55
- - name: Build and push multi-arch Docker image
56
- run: |
57
- docker buildx build \
58
- --platform linux/amd64,linux/arm64 \
59
- -t ${{ secrets.DOCKERHUB_USERNAME }}/$(basename ${{ github.repository }}):${{ env.RELEASE_TAG }} \
60
- $([ "${{ env.IS_LATEST }}" == "true" ] && echo "-t ${{ secrets.DOCKERHUB_USERNAME }}/$(basename ${{ github.repository }}):latest") \
61
- --push .
@@ -1,34 +0,0 @@
1
- name: Publish to PyPI
2
-
3
- on:
4
- release:
5
- types:
6
- - created
7
- workflow_dispatch:
8
-
9
- jobs:
10
- build:
11
- runs-on: ubuntu-latest
12
-
13
- steps:
14
- - name: Checkout code
15
- uses: actions/checkout@v4
16
-
17
- - name: Set up Python
18
- uses: actions/setup-python@v5
19
- with:
20
- python-version: 3.12
21
-
22
- - name: Install dependencies
23
- run: |
24
- python -m pip install --upgrade pip
25
- python -m pip install build twine
26
-
27
- - name: Build and publish
28
- run: |
29
- python -m build
30
-
31
- - name: Publish package to PyPI
32
- uses: pypa/gh-action-pypi-publish@release/v1
33
- with:
34
- password: ${{ secrets.PYPI_TOKEN }}
@@ -1,29 +0,0 @@
1
- name: Run Tests
2
-
3
- on:
4
- push:
5
- branches:
6
- - main
7
- workflow_dispatch:
8
-
9
- jobs:
10
- test:
11
- runs-on: ubuntu-latest
12
- env:
13
- DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
14
- steps:
15
- - name: Checkout code
16
- uses: actions/checkout@v4
17
-
18
- - name: Set up Python
19
- uses: actions/setup-python@v5
20
- with:
21
- python-version: 3.12
22
-
23
- - name: Install dependencies
24
- run: |
25
- python -m pip install --upgrade pip
26
- pip install .
27
-
28
- - name: Run tests
29
- run: pytest
@@ -1,8 +0,0 @@
1
- __pycache__/
2
- .idea/
3
- build/
4
- *.egg-info/
5
- logs
6
- temp
7
- config.ini
8
- config.testing.ini
@@ -1,284 +0,0 @@
1
- # changelog
2
-
3
- ## v10.0.4
4
-
5
- - remove setup.py and switch to pyproject.toml
6
-
7
- ## v10.0.3
8
-
9
- - env
10
- - SQUARE_LOGGER -> FORMATTER_CHOICE + ENABLE_REDACTION
11
- - dependencies
12
- - square_logger>=3.0.0.
13
-
14
- ## v10.0.2
15
-
16
- - move application logic from route to utils.
17
-
18
- ## v10.0.1
19
-
20
- - core
21
- - add username in get_user_details_v0 output.
22
-
23
- ## v10.0.0
24
-
25
- - core
26
- - **breaking change**: logout_apps_v0 is now a POST method instead of DELETE.
27
- - docs
28
- - add GNU license v3.0.
29
- - update README.md.
30
- - move CHANGELOG to a separate file.
31
- - tests
32
- - fix bugs in test cases.
33
- - dependencies
34
- - square_database_structure >= 2.6.0.
35
- - square_database_helper>=2.6.1.
36
-
37
- ## v9.0.1
38
-
39
- - env
40
- - add RESEND_COOL_DOWN_TIME_FOR_EMAIL_VERIFICATION_CODE_IN_SECONDS and
41
- RESEND_COOL_DOWN_TIME_FOR_EMAIL_PASSWORD_RESET_CODE_IN_SECONDS in LOGIC section.
42
- - profile
43
- - add validation for email verification code already sent in send_verification_email_v0.
44
- - add cooldown_reset_at in send_verification_email_v0 output.
45
- - core
46
- - add validation for email password reset code already sent in send_reset_password_email_v0.
47
- - add cooldown_reset_at in send_reset_password_email_v0 output.
48
-
49
- ## v9.0.0
50
-
51
- - core
52
- - **breaking change**: new mandatory parameter `app_id` in validate_and_get_payload_from_token_v0.
53
-
54
- ## v8.0.2
55
-
56
- - core
57
- - add refresh_token_expiry_time in output for reset_password_and_login_using_backup_code_v0 and
58
- reset_password_and_login_using_reset_email_code_v0.
59
-
60
- ## v8.0.1
61
-
62
- - core
63
- - add make recovery_methods_to_add and recovery_methods_to_remove parameters optional in
64
- update_user_recovery_methods_v0.
65
-
66
- ## v8.0.0
67
-
68
- - env
69
- - add GOOGLE section and GOOGLE_AUTH_PLATFORM_CLIENT_ID variable.
70
- - add LOGIC section with NUMBER_OF_RECOVERY_CODES, EXPIRY_TIME_FOR_EMAIL_VERIFICATION_CODE_IN_SECONDS,
71
- NUMBER_OF_DIGITS_IN_EMAIL_VERIFICATION_CODE, EXPIRY_TIME_FOR_EMAIL_PASSWORD_RESET_CODE_IN_SECONDS,
72
- NUMBER_OF_DIGITS_IN_EMAIL_PASSWORD_RESET_CODE variables.
73
- - dependencies
74
- - add google-auth>=2.40.3.
75
- - update square_commons to >=3.0.0.
76
- - core
77
- - add reset_password_and_login_using_reset_email_code_v0.
78
- - **breaking change**: remove app_id from send_reset_password_email_v0.
79
- - implement deletion of existing backup codes before generating new ones (generate_account_backup_codes_v0).
80
- - implement deletion of existing backup codes before removing recovery method (update_user_recovery_methods_v0).
81
- - implement logout_other_sessions in update_password_v0, reset_password_and_login_using_backup_code_v0 and
82
- reset_password_and_login_using_reset_email_code_v0
83
- - in update_password_v0, it will log out all other sessions except the current one if valid (optional)
84
- refresh_token is passed in.
85
- - add register_login_google_v0, **finally**.
86
- - add validation in update_password_v0, reset_password_and_login_using_backup_code_v0, send_reset_password_email_v0,
87
- reset_password_and_login_using_reset_email_code_v0 to check if user has credentials and has self as auth provider.
88
- - remove profile_photo from file_store when user is deleted in delete_user_v0.
89
- - utils
90
- - add new core file with generate_default_username_for_google_users function.
91
- - tests
92
- - add test_login_fail_v0.
93
-
94
- ## v7.0.0
95
-
96
- - internal support for UserAuthProvider.
97
- - internal support for username shifted from UserProfile to User.
98
- - internal support for phone number country code in UserProfile.
99
- - core
100
- - register_username_v0 fixed to account for changes mentioned above and creates empty profile.
101
- - login_username_v0 fixed to account for changes mentioned above.
102
- - update_username_v0 fixed to account for changes mentioned above.
103
- - **breaking change**: delete_user_v0 is now a POST method instead of DELETE.
104
- - add generate_account_backup_codes_v0.
105
- - add reset_password_and_login_using_backup_code_v0.
106
- - add validation for email verification when adding email as recovery method in update_user_recovery_methods_v0.
107
- - add send_reset_password_email_v0.
108
- - profile
109
- - add update_profile_details_v0.
110
- - add send_verification_email_v0.
111
- - add validate_email_verification_code_v0.
112
- - tests
113
- - add test cases and fixtures for login_username_v0.
114
- - add test cases and fixtures for delete_user_v0.
115
- - add test cases and fixtures for update_profile_details_v0.
116
- - env
117
- - add EMAIL section and MAIL_GUN_API_KEY variable.
118
-
119
- ## v6.2.2
120
-
121
- - remove config.ini and config.testing.ini from version control.
122
-
123
- ## v6.2.1
124
-
125
- - core
126
- - tweak validation for username in register_username_v0 and update_username_v0.
127
-
128
- ## v6.2.0
129
-
130
- - core
131
- - add update_user_recovery_methods_v0.
132
-
133
- ## v6.1.0
134
-
135
- - add validation to username in register_username_v0 and update_username_v0.
136
- - add test cases for register_username_v0.
137
-
138
- ## v6.0.5
139
-
140
- - env
141
- - add ALLOW_ORIGINS
142
-
143
- ## v6.0.4
144
-
145
- - mock ini file for pytest.
146
-
147
- ## v6.0.3
148
-
149
- - make profile photo upload optional in update_profile_photo/v0, to enable users to remove their profile photo.
150
-
151
- ## v6.0.2
152
-
153
- - bump square_file_store_helper to >=3.0.0.
154
- - use upload_file_using_tuple_v0 instead of upload_file_using_path_v0 in update_profile_photo/v0.
155
-
156
- ## v6.0.1
157
-
158
- - delete previous profile photo from file store after successfully updating profile photo.
159
-
160
- ## v6.0.0
161
-
162
- - add profile details in get_user_details_v0 instead of credentials keyword.
163
-
164
- ## v5.2.0
165
-
166
- - add temp folder to .gitignore.
167
- - add square_file_store_helper as a dependency.
168
- - config
169
- - add config section for file store helper.
170
- - initialise file store helper and database helper in config.py
171
- - add profile router
172
- - profile
173
- - add update_profile_photo/v0
174
- - update messages.
175
-
176
- ## v5.1.5
177
-
178
- - bump square_logger to >=2.0.0.
179
-
180
- ## v5.1.4
181
-
182
- - re bug fix v5.1.3
183
-
184
- ## v5.1.3
185
-
186
- - bugfix in login_username/v0 (getting creds from correct table).
187
-
188
- ## v5.1.2
189
-
190
- - bump square_database_structure>=2.3.1.
191
- - change logic to read username from profile instead of credentials table.
192
-
193
- ## v5.1.1
194
-
195
- - add logger decorator in all functions.
196
- - add error logs in all endpoints.
197
-
198
- ## v5.1.0
199
-
200
- - Core
201
- - add logout/apps/v0.
202
- - add logout/all/v0.
203
-
204
- ## v5.0.1
205
-
206
- - fix typo in return value of get_user_details_v0.
207
-
208
- ## v5.0.0
209
-
210
- - change get_user_details_v0 to return app name instead of app ids.
211
-
212
- ## v4.5.1
213
-
214
- - fix auto docker image build github action.
215
-
216
- ## v4.5.0
217
-
218
- - add pytest dependency and dummy test.
219
- - add https dependency.
220
- - github actions for CI/CD for testing and auto build and push.
221
-
222
- ## v4.4.0
223
-
224
- - core
225
- - add refresh_token_expiry_time in register_username_v0, login_username_v0.
226
-
227
- ## v4.3.0
228
-
229
- - set allow_credentials=True.
230
-
231
- ## v4.2.1
232
-
233
- - fix output format in validate_and_get_payload_from_token/v0.
234
- - add db check refresh token validation in validate_and_get_payload_from_token/v0.
235
-
236
- ## v4.2.0
237
-
238
- - add validate_and_get_payload_from_token/v0 in core.
239
-
240
- ## v4.1.0
241
-
242
- - add get_text_hash/v0 in utils.
243
-
244
- ## v4.0.1
245
-
246
- - bugfix in pydantic model import.
247
-
248
- ## v4.0.0
249
-
250
- - /login_username/v0 is now POST method.
251
- - new flag in /login_username/v0 assign_app_id_if_missing.
252
- - bugfix: /get_user_details/v0 now only returns number of active sessions.
253
-
254
- ## v3.0.0
255
-
256
- - added new endpoints
257
- - /update_username/v0
258
- - /delete_user/v0
259
- - /update_password/v0
260
- - move data in password related endpoints to request body from params.
261
- - /register_username/v0 now takes in app_id as optional parameter to assign user to that app and create session for it.
262
- - /generate_access_token/v0 now only needs refresh token (removed validation).
263
- - /logout/v0 now only needs refresh token (removed validation).
264
- - /update_user_app_ids/v0 now only updates ids for self (user). added access token as input param and removed user_id.
265
- - /get_user_app_ids/v0 is now /get_user_details/v0 with access token as the only input param.
266
-
267
- ## v2.0.0
268
-
269
- - authentication module needs to be used across applications so
270
- - register_username: will not create sessions and therefore will not auto login.
271
- - login: added validation if app is assigned to user before assigning it and added app_id in session row.
272
- - logout: added app_id as new parameter and validation for that.
273
- - generate_access_token: added app_id as new parameter and validation for that.
274
- - added 2 new endpoints
275
- - get user app ids: **access token validation pending**.
276
- - change user app ids: **access token validation pending**.
277
- - add versions for all endpoint paths.
278
- - make it compatible with square_database_helper 2.x.
279
- - username in database will always be lowercase.
280
- - standardise output formats for all api.
281
-
282
- ## v1.0.0
283
-
284
- - initial implementation.
@@ -1,12 +0,0 @@
1
- FROM python:3.12-slim
2
-
3
- COPY . /app
4
-
5
- WORKDIR /app
6
-
7
- RUN pip install .
8
-
9
- CMD ["python3", "/usr/local/lib/python3.12/site-packages/square_authentication/main.py"]
10
-
11
- # Uncomment for debugging
12
- # CMD ["bash", "-c", "while true; do sleep 60; done"]