square-authentication 6.2.2__tar.gz → 8.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {square_authentication-6.2.2 → square_authentication-8.0.0}/PKG-INFO +56 -2
- {square_authentication-6.2.2 → square_authentication-8.0.0}/README.md +53 -0
- square_authentication-8.0.0/pyproject.toml +3 -0
- {square_authentication-6.2.2 → square_authentication-8.0.0}/setup.py +3 -2
- {square_authentication-6.2.2 → square_authentication-8.0.0}/square_authentication/configuration.py +37 -0
- {square_authentication-6.2.2 → square_authentication-8.0.0}/square_authentication/data/config.sample.ini +14 -1
- {square_authentication-6.2.2 → square_authentication-8.0.0}/square_authentication/data/config.testing.sample.ini +14 -1
- {square_authentication-6.2.2 → square_authentication-8.0.0}/square_authentication/messages.py +12 -0
- square_authentication-8.0.0/square_authentication/pydantic_models/core.py +63 -0
- square_authentication-8.0.0/square_authentication/pydantic_models/profile.py +5 -0
- square_authentication-8.0.0/square_authentication/routes/core.py +3247 -0
- square_authentication-8.0.0/square_authentication/routes/profile.py +615 -0
- square_authentication-8.0.0/square_authentication/utils/core.py +37 -0
- {square_authentication-6.2.2 → square_authentication-8.0.0}/square_authentication.egg-info/PKG-INFO +56 -2
- {square_authentication-6.2.2 → square_authentication-8.0.0}/square_authentication.egg-info/SOURCES.txt +6 -0
- {square_authentication-6.2.2 → square_authentication-8.0.0}/square_authentication.egg-info/requires.txt +2 -1
- square_authentication-8.0.0/tests/test_delete_user.py +14 -0
- square_authentication-8.0.0/tests/test_login.py +25 -0
- square_authentication-8.0.0/tests/test_update_profile.py +14 -0
- square_authentication-6.2.2/square_authentication/pydantic_models/core.py +0 -35
- square_authentication-6.2.2/square_authentication/routes/core.py +0 -1682
- square_authentication-6.2.2/square_authentication/routes/profile.py +0 -166
- {square_authentication-6.2.2 → square_authentication-8.0.0}/setup.cfg +0 -0
- {square_authentication-6.2.2 → square_authentication-8.0.0}/square_authentication/__init__.py +0 -0
- {square_authentication-6.2.2 → square_authentication-8.0.0}/square_authentication/main.py +0 -0
- {square_authentication-6.2.2 → square_authentication-8.0.0}/square_authentication/pydantic_models/__init__.py +0 -0
- {square_authentication-6.2.2 → square_authentication-8.0.0}/square_authentication/routes/__init__.py +0 -0
- {square_authentication-6.2.2 → square_authentication-8.0.0}/square_authentication/routes/utility.py +0 -0
- {square_authentication-6.2.2 → square_authentication-8.0.0}/square_authentication/utils/__init__.py +0 -0
- {square_authentication-6.2.2 → square_authentication-8.0.0}/square_authentication/utils/encryption.py +0 -0
- {square_authentication-6.2.2 → square_authentication-8.0.0}/square_authentication/utils/token.py +0 -0
- {square_authentication-6.2.2 → square_authentication-8.0.0}/square_authentication.egg-info/dependency_links.txt +0 -0
- {square_authentication-6.2.2 → square_authentication-8.0.0}/square_authentication.egg-info/top_level.txt +0 -0
- {square_authentication-6.2.2 → square_authentication-8.0.0}/tests/test_1.py +0 -0
- {square_authentication-6.2.2 → square_authentication-8.0.0}/tests/test_username.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: square_authentication
|
3
|
-
Version:
|
3
|
+
Version: 8.0.0
|
4
4
|
Summary: authentication layer for my personal server.
|
5
5
|
Home-page: https://github.com/thepmsquare/square_authentication
|
6
6
|
Author: thePmSquare
|
@@ -19,13 +19,14 @@ Requires-Dist: bcrypt>=4.1.2
|
|
19
19
|
Requires-Dist: pyjwt>=2.8.0
|
20
20
|
Requires-Dist: requests>=2.32.3
|
21
21
|
Requires-Dist: cryptography>=42.0.7
|
22
|
-
Requires-Dist: square_commons>=
|
22
|
+
Requires-Dist: square_commons>=3.0.0
|
23
23
|
Requires-Dist: square_logger>=2.0.0
|
24
24
|
Requires-Dist: square_database_helper>=2.0.0
|
25
25
|
Requires-Dist: square_database_structure>=2.3.1
|
26
26
|
Requires-Dist: square_file_store_helper>=3.0.0
|
27
27
|
Requires-Dist: pytest>=8.0.0
|
28
28
|
Requires-Dist: httpx>=0.27.2
|
29
|
+
Requires-Dist: google-auth>=2.40.3
|
29
30
|
Dynamic: author
|
30
31
|
Dynamic: author-email
|
31
32
|
Dynamic: classifier
|
@@ -53,6 +54,59 @@ pip install square_authentication
|
|
53
54
|
|
54
55
|
## changelog
|
55
56
|
|
57
|
+
### v8.0.0
|
58
|
+
|
59
|
+
- env
|
60
|
+
- add GOOGLE section and GOOGLE_AUTH_PLATFORM_CLIENT_ID variable.
|
61
|
+
- add LOGIC section with NUMBER_OF_RECOVERY_CODES, EXPIRY_TIME_FOR_EMAIL_VERIFICATION_CODE_IN_SECONDS,
|
62
|
+
NUMBER_OF_DIGITS_IN_EMAIL_VERIFICATION_CODE, EXPIRY_TIME_FOR_EMAIL_PASSWORD_RESET_CODE_IN_SECONDS,
|
63
|
+
NUMBER_OF_DIGITS_IN_EMAIL_PASSWORD_RESET_CODE variables.
|
64
|
+
- dependencies
|
65
|
+
- add google-auth>=2.40.3.
|
66
|
+
- update square_commons to >=3.0.0.
|
67
|
+
- core
|
68
|
+
- add reset_password_and_login_using_reset_email_code_v0.
|
69
|
+
- **breaking change**: remove app_id from send_reset_password_email_v0.
|
70
|
+
- implement deletion of existing backup codes before generating new ones (generate_account_backup_codes_v0).
|
71
|
+
- implement deletion of existing backup codes before removing recovery method (update_user_recovery_methods_v0).
|
72
|
+
- implement logout_other_sessions in update_password_v0, reset_password_and_login_using_backup_code_v0 and
|
73
|
+
reset_password_and_login_using_reset_email_code_v0
|
74
|
+
- in update_password_v0, it will log out all other sessions except the current one if valid (optional)
|
75
|
+
refresh_token is passed in.
|
76
|
+
- add register_login_google_v0, **finally**.
|
77
|
+
- add validation in update_password_v0, reset_password_and_login_using_backup_code_v0, send_reset_password_email_v0,
|
78
|
+
reset_password_and_login_using_reset_email_code_v0 to check if user has credentials and has self as auth provider.
|
79
|
+
- remove profile_photo from file_store when user is deleted in delete_user_v0.
|
80
|
+
- utils
|
81
|
+
- add new core file with generate_default_username_for_google_users function.
|
82
|
+
- tests
|
83
|
+
- add test_login_fail_v0.
|
84
|
+
|
85
|
+
### v7.0.0
|
86
|
+
|
87
|
+
- internal support for UserAuthProvider.
|
88
|
+
- internal support for username shifted from UserProfile to User.
|
89
|
+
- internal support for phone number country code in UserProfile.
|
90
|
+
- core
|
91
|
+
- register_username_v0 fixed to account for changes mentioned above and creates empty profile.
|
92
|
+
- login_username_v0 fixed to account for changes mentioned above.
|
93
|
+
- update_username_v0 fixed to account for changes mentioned above.
|
94
|
+
- **breaking change**: delete_user_v0 is now a POST method instead of DELETE.
|
95
|
+
- add generate_account_backup_codes_v0.
|
96
|
+
- add reset_password_and_login_using_backup_code_v0.
|
97
|
+
- add validation for email verification when adding email as recovery method in update_user_recovery_methods_v0.
|
98
|
+
- add send_reset_password_email_v0.
|
99
|
+
- profile
|
100
|
+
- add update_profile_details_v0.
|
101
|
+
- add send_verification_email_v0.
|
102
|
+
- add validate_email_verification_code_v0.
|
103
|
+
- tests
|
104
|
+
- add test cases and fixtures for login_username_v0.
|
105
|
+
- add test cases and fixtures for delete_user_v0.
|
106
|
+
- add test cases and fixtures for update_profile_details_v0.
|
107
|
+
- env
|
108
|
+
- add EMAIL section and MAIL_GUN_API_KEY variable.
|
109
|
+
|
56
110
|
### v6.2.2
|
57
111
|
|
58
112
|
- remove config.ini and config.testing.ini from version control.
|
@@ -16,6 +16,59 @@ pip install square_authentication
|
|
16
16
|
|
17
17
|
## changelog
|
18
18
|
|
19
|
+
### v8.0.0
|
20
|
+
|
21
|
+
- env
|
22
|
+
- add GOOGLE section and GOOGLE_AUTH_PLATFORM_CLIENT_ID variable.
|
23
|
+
- add LOGIC section with NUMBER_OF_RECOVERY_CODES, EXPIRY_TIME_FOR_EMAIL_VERIFICATION_CODE_IN_SECONDS,
|
24
|
+
NUMBER_OF_DIGITS_IN_EMAIL_VERIFICATION_CODE, EXPIRY_TIME_FOR_EMAIL_PASSWORD_RESET_CODE_IN_SECONDS,
|
25
|
+
NUMBER_OF_DIGITS_IN_EMAIL_PASSWORD_RESET_CODE variables.
|
26
|
+
- dependencies
|
27
|
+
- add google-auth>=2.40.3.
|
28
|
+
- update square_commons to >=3.0.0.
|
29
|
+
- core
|
30
|
+
- add reset_password_and_login_using_reset_email_code_v0.
|
31
|
+
- **breaking change**: remove app_id from send_reset_password_email_v0.
|
32
|
+
- implement deletion of existing backup codes before generating new ones (generate_account_backup_codes_v0).
|
33
|
+
- implement deletion of existing backup codes before removing recovery method (update_user_recovery_methods_v0).
|
34
|
+
- implement logout_other_sessions in update_password_v0, reset_password_and_login_using_backup_code_v0 and
|
35
|
+
reset_password_and_login_using_reset_email_code_v0
|
36
|
+
- in update_password_v0, it will log out all other sessions except the current one if valid (optional)
|
37
|
+
refresh_token is passed in.
|
38
|
+
- add register_login_google_v0, **finally**.
|
39
|
+
- add validation in update_password_v0, reset_password_and_login_using_backup_code_v0, send_reset_password_email_v0,
|
40
|
+
reset_password_and_login_using_reset_email_code_v0 to check if user has credentials and has self as auth provider.
|
41
|
+
- remove profile_photo from file_store when user is deleted in delete_user_v0.
|
42
|
+
- utils
|
43
|
+
- add new core file with generate_default_username_for_google_users function.
|
44
|
+
- tests
|
45
|
+
- add test_login_fail_v0.
|
46
|
+
|
47
|
+
### v7.0.0
|
48
|
+
|
49
|
+
- internal support for UserAuthProvider.
|
50
|
+
- internal support for username shifted from UserProfile to User.
|
51
|
+
- internal support for phone number country code in UserProfile.
|
52
|
+
- core
|
53
|
+
- register_username_v0 fixed to account for changes mentioned above and creates empty profile.
|
54
|
+
- login_username_v0 fixed to account for changes mentioned above.
|
55
|
+
- update_username_v0 fixed to account for changes mentioned above.
|
56
|
+
- **breaking change**: delete_user_v0 is now a POST method instead of DELETE.
|
57
|
+
- add generate_account_backup_codes_v0.
|
58
|
+
- add reset_password_and_login_using_backup_code_v0.
|
59
|
+
- add validation for email verification when adding email as recovery method in update_user_recovery_methods_v0.
|
60
|
+
- add send_reset_password_email_v0.
|
61
|
+
- profile
|
62
|
+
- add update_profile_details_v0.
|
63
|
+
- add send_verification_email_v0.
|
64
|
+
- add validate_email_verification_code_v0.
|
65
|
+
- tests
|
66
|
+
- add test cases and fixtures for login_username_v0.
|
67
|
+
- add test cases and fixtures for delete_user_v0.
|
68
|
+
- add test cases and fixtures for update_profile_details_v0.
|
69
|
+
- env
|
70
|
+
- add EMAIL section and MAIL_GUN_API_KEY variable.
|
71
|
+
|
19
72
|
### v6.2.2
|
20
73
|
|
21
74
|
- remove config.ini and config.testing.ini from version control.
|
@@ -4,7 +4,7 @@ package_name = "square_authentication"
|
|
4
4
|
|
5
5
|
setup(
|
6
6
|
name=package_name,
|
7
|
-
version="
|
7
|
+
version="8.0.0",
|
8
8
|
packages=find_packages(),
|
9
9
|
package_data={
|
10
10
|
package_name: ["data/*"],
|
@@ -18,13 +18,14 @@ setup(
|
|
18
18
|
"pyjwt>=2.8.0",
|
19
19
|
"requests>=2.32.3",
|
20
20
|
"cryptography>=42.0.7",
|
21
|
-
"square_commons>=
|
21
|
+
"square_commons>=3.0.0",
|
22
22
|
"square_logger>=2.0.0",
|
23
23
|
"square_database_helper>=2.0.0",
|
24
24
|
"square_database_structure>=2.3.1",
|
25
25
|
"square_file_store_helper>=3.0.0",
|
26
26
|
"pytest>=8.0.0",
|
27
27
|
"httpx>=0.27.2",
|
28
|
+
"google-auth>=2.40.3",
|
28
29
|
],
|
29
30
|
extras_require={},
|
30
31
|
author="thePmSquare",
|
{square_authentication-6.2.2 → square_authentication-8.0.0}/square_authentication/configuration.py
RENAMED
@@ -94,6 +94,43 @@ try:
|
|
94
94
|
ldict_configuration["SQUARE_FILE_STORE_HELPER"]["SQUARE_FILE_STORE_PORT"]
|
95
95
|
)
|
96
96
|
# ===========================================
|
97
|
+
|
98
|
+
# ===========================================
|
99
|
+
# EMAIL
|
100
|
+
|
101
|
+
MAIL_GUN_API_KEY = ldict_configuration["EMAIL"]["MAIL_GUN_API_KEY"]
|
102
|
+
# ===========================================
|
103
|
+
# ===========================================
|
104
|
+
# GOOGLE
|
105
|
+
|
106
|
+
GOOGLE_AUTH_PLATFORM_CLIENT_ID = ldict_configuration["GOOGLE"][
|
107
|
+
"GOOGLE_AUTH_PLATFORM_CLIENT_ID"
|
108
|
+
]
|
109
|
+
# ===========================================
|
110
|
+
# ===========================================
|
111
|
+
# GOOGLE
|
112
|
+
|
113
|
+
NUMBER_OF_RECOVERY_CODES = int(
|
114
|
+
ldict_configuration["LOGIC"]["NUMBER_OF_RECOVERY_CODES"]
|
115
|
+
)
|
116
|
+
EXPIRY_TIME_FOR_EMAIL_VERIFICATION_CODE_IN_SECONDS = int(
|
117
|
+
ldict_configuration["LOGIC"][
|
118
|
+
"EXPIRY_TIME_FOR_EMAIL_VERIFICATION_CODE_IN_SECONDS"
|
119
|
+
]
|
120
|
+
)
|
121
|
+
NUMBER_OF_DIGITS_IN_EMAIL_VERIFICATION_CODE = int(
|
122
|
+
ldict_configuration["LOGIC"]["NUMBER_OF_DIGITS_IN_EMAIL_VERIFICATION_CODE"]
|
123
|
+
)
|
124
|
+
EXPIRY_TIME_FOR_EMAIL_PASSWORD_RESET_CODE_IN_SECONDS = int(
|
125
|
+
ldict_configuration["LOGIC"][
|
126
|
+
"EXPIRY_TIME_FOR_EMAIL_PASSWORD_RESET_CODE_IN_SECONDS"
|
127
|
+
]
|
128
|
+
)
|
129
|
+
NUMBER_OF_DIGITS_IN_EMAIL_PASSWORD_RESET_CODE = int(
|
130
|
+
ldict_configuration["LOGIC"]["NUMBER_OF_DIGITS_IN_EMAIL_PASSWORD_RESET_CODE"]
|
131
|
+
)
|
132
|
+
# ===========================================
|
133
|
+
|
97
134
|
# Initialize logger
|
98
135
|
global_object_square_logger = SquareLogger(
|
99
136
|
pstr_log_file_name=config_str_log_file_name,
|
@@ -51,4 +51,17 @@ SQUARE_DATABASE_PORT = 10010
|
|
51
51
|
|
52
52
|
SQUARE_FILE_STORE_PROTOCOL = http
|
53
53
|
SQUARE_FILE_STORE_IP = localhost
|
54
|
-
SQUARE_FILE_STORE_PORT = 10100
|
54
|
+
SQUARE_FILE_STORE_PORT = 10100
|
55
|
+
|
56
|
+
[EMAIL]
|
57
|
+
MAIL_GUN_API_KEY = dummy_mailgun_api_key
|
58
|
+
|
59
|
+
[GOOGLE]
|
60
|
+
GOOGLE_AUTH_PLATFORM_CLIENT_ID = dummy_google_client_id
|
61
|
+
|
62
|
+
[LOGIC]
|
63
|
+
NUMBER_OF_RECOVERY_CODES = 10
|
64
|
+
EXPIRY_TIME_FOR_EMAIL_VERIFICATION_CODE_IN_SECONDS = 600
|
65
|
+
NUMBER_OF_DIGITS_IN_EMAIL_VERIFICATION_CODE = 6
|
66
|
+
EXPIRY_TIME_FOR_EMAIL_PASSWORD_RESET_CODE_IN_SECONDS = 600
|
67
|
+
NUMBER_OF_DIGITS_IN_EMAIL_PASSWORD_RESET_CODE = 6
|
@@ -51,4 +51,17 @@ SQUARE_DATABASE_PORT = 20010
|
|
51
51
|
|
52
52
|
SQUARE_FILE_STORE_PROTOCOL = http
|
53
53
|
SQUARE_FILE_STORE_IP = raspi.thepmsquare.com
|
54
|
-
SQUARE_FILE_STORE_PORT = 20010
|
54
|
+
SQUARE_FILE_STORE_PORT = 20010
|
55
|
+
|
56
|
+
[EMAIL]
|
57
|
+
MAIL_GUN_API_KEY = dummy_mailgun_api_key
|
58
|
+
|
59
|
+
[GOOGLE]
|
60
|
+
GOOGLE_AUTH_PLATFORM_CLIENT_ID = dummy_google_client_id
|
61
|
+
|
62
|
+
[LOGIC]
|
63
|
+
NUMBER_OF_RECOVERY_CODES = 10
|
64
|
+
EXPIRY_TIME_FOR_EMAIL_VERIFICATION_CODE_IN_SECONDS = 600
|
65
|
+
NUMBER_OF_DIGITS_IN_EMAIL_VERIFICATION_CODE = 6
|
66
|
+
EXPIRY_TIME_FOR_EMAIL_PASSWORD_RESET_CODE_IN_SECONDS = 600
|
67
|
+
NUMBER_OF_DIGITS_IN_EMAIL_PASSWORD_RESET_CODE = 6
|
{square_authentication-6.2.2 → square_authentication-8.0.0}/square_authentication/messages.py
RENAMED
@@ -13,8 +13,20 @@ messages = {
|
|
13
13
|
"GENERIC_READ_SUCCESSFUL": "data retrieved successfully.",
|
14
14
|
"GENERIC_UPDATE_SUCCESSFUL": "your information has been updated successfully.",
|
15
15
|
"GENERIC_DELETE_SUCCESSFUL": "your records have been deleted successfully.",
|
16
|
+
"GENERIC_ACTION_SUCCESSFUL": "the action was completed successfully.",
|
16
17
|
"GENERIC_400": "the request is invalid or cannot be processed.",
|
17
18
|
"GENERIC_500": "an internal server error occurred. please try again later.",
|
18
19
|
"INVALID_FILE_FORMAT": "the file format is not supported. please upload a valid file.",
|
19
20
|
"FILE_SIZE_EXCEEDS_LIMIT": "the file size exceeds the limit. please upload a smaller file.",
|
21
|
+
"INCORRECT_AUTH_PROVIDER": "you have not linked this authentication provider to your account. please link it first.",
|
22
|
+
"INVALID_EMAIL_FORMAT": "the email address is invalid. please provide a valid email address.",
|
23
|
+
"INVALID_PHONE_NUMBER_FORMAT": "the phone number is invalid. please provide a valid phone number.",
|
24
|
+
"GENERIC_MISSING_REQUIRED_FIELD": "a required field is missing. please check your input and try again.",
|
25
|
+
"RECOVERY_METHOD_NOT_ENABLED": "the recovery method you are trying to use is not enabled for your account.",
|
26
|
+
"INCORRECT_BACKUP_CODE": "the backup code you provided is incorrect or has already been used. please try again with a valid code.",
|
27
|
+
"EMAIL_ALREADY_VERIFIED": "your email address has already been verified.",
|
28
|
+
"INCORRECT_VERIFICATION_CODE": "the verification code you entered is incorrect or has expired. please request a new code.",
|
29
|
+
"EMAIL_NOT_VERIFIED": "your email address has not been verified. please verify your email to continue.",
|
30
|
+
"ACCOUNT_WITH_EMAIL_ALREADY_EXISTS": "an account with this email address already exists.",
|
31
|
+
"MALFORMED_USER": " the user data is malformed or incomplete.",
|
20
32
|
}
|
@@ -0,0 +1,63 @@
|
|
1
|
+
from enum import Enum
|
2
|
+
from typing import Optional, List
|
3
|
+
|
4
|
+
from pydantic import BaseModel
|
5
|
+
|
6
|
+
|
7
|
+
class RegisterUsernameV0(BaseModel):
|
8
|
+
username: str
|
9
|
+
password: str
|
10
|
+
app_id: Optional[int] = None
|
11
|
+
|
12
|
+
|
13
|
+
class RegisterLoginGoogleV0(BaseModel):
|
14
|
+
google_id: str
|
15
|
+
app_id: Optional[int] = None
|
16
|
+
assign_app_id_if_missing: bool = False
|
17
|
+
|
18
|
+
|
19
|
+
class LoginUsernameV0(BaseModel):
|
20
|
+
username: str
|
21
|
+
password: str
|
22
|
+
app_id: int
|
23
|
+
assign_app_id_if_missing: bool = False
|
24
|
+
|
25
|
+
|
26
|
+
class DeleteUserV0(BaseModel):
|
27
|
+
password: str
|
28
|
+
|
29
|
+
|
30
|
+
class UpdatePasswordV0(BaseModel):
|
31
|
+
old_password: str
|
32
|
+
new_password: str
|
33
|
+
logout_other_sessions: bool = False
|
34
|
+
preserve_session_refresh_token: Optional[str] = None
|
35
|
+
|
36
|
+
|
37
|
+
class TokenType(Enum):
|
38
|
+
access_token = "access_token"
|
39
|
+
refresh_token = "refresh_token"
|
40
|
+
|
41
|
+
|
42
|
+
class LogoutAppsV0(BaseModel):
|
43
|
+
app_ids: List[int]
|
44
|
+
|
45
|
+
|
46
|
+
class ResetPasswordAndLoginUsingBackupCodeV0(BaseModel):
|
47
|
+
backup_code: str
|
48
|
+
username: str
|
49
|
+
new_password: str
|
50
|
+
app_id: int
|
51
|
+
logout_other_sessions: bool = False
|
52
|
+
|
53
|
+
|
54
|
+
class SendResetPasswordEmailV0(BaseModel):
|
55
|
+
username: str
|
56
|
+
|
57
|
+
|
58
|
+
class ResetPasswordAndLoginUsingResetEmailCodeV0(BaseModel):
|
59
|
+
reset_email_code: str
|
60
|
+
username: str
|
61
|
+
new_password: str
|
62
|
+
app_id: int
|
63
|
+
logout_other_sessions: bool = False
|