square-authentication 7.0.0__tar.gz → 8.0.1__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 (32) hide show
  1. {square_authentication-7.0.0 → square_authentication-8.0.1}/PKG-INFO +37 -2
  2. {square_authentication-7.0.0 → square_authentication-8.0.1}/README.md +34 -0
  3. {square_authentication-7.0.0 → square_authentication-8.0.1}/setup.py +3 -2
  4. {square_authentication-7.0.0 → square_authentication-8.0.1}/square_authentication/configuration.py +31 -0
  5. {square_authentication-7.0.0 → square_authentication-8.0.1}/square_authentication/data/config.sample.ini +11 -1
  6. {square_authentication-7.0.0 → square_authentication-8.0.1}/square_authentication/data/config.testing.sample.ini +11 -1
  7. {square_authentication-7.0.0 → square_authentication-8.0.1}/square_authentication/messages.py +2 -0
  8. {square_authentication-7.0.0 → square_authentication-8.0.1}/square_authentication/pydantic_models/core.py +16 -0
  9. {square_authentication-7.0.0 → square_authentication-8.0.1}/square_authentication/routes/core.py +970 -33
  10. {square_authentication-7.0.0 → square_authentication-8.0.1}/square_authentication/routes/profile.py +10 -5
  11. square_authentication-8.0.1/square_authentication/utils/core.py +37 -0
  12. {square_authentication-7.0.0 → square_authentication-8.0.1}/square_authentication.egg-info/PKG-INFO +37 -2
  13. {square_authentication-7.0.0 → square_authentication-8.0.1}/square_authentication.egg-info/SOURCES.txt +1 -0
  14. {square_authentication-7.0.0 → square_authentication-8.0.1}/square_authentication.egg-info/requires.txt +2 -1
  15. {square_authentication-7.0.0 → square_authentication-8.0.1}/tests/test_login.py +12 -0
  16. {square_authentication-7.0.0 → square_authentication-8.0.1}/pyproject.toml +0 -0
  17. {square_authentication-7.0.0 → square_authentication-8.0.1}/setup.cfg +0 -0
  18. {square_authentication-7.0.0 → square_authentication-8.0.1}/square_authentication/__init__.py +0 -0
  19. {square_authentication-7.0.0 → square_authentication-8.0.1}/square_authentication/main.py +0 -0
  20. {square_authentication-7.0.0 → square_authentication-8.0.1}/square_authentication/pydantic_models/__init__.py +0 -0
  21. {square_authentication-7.0.0 → square_authentication-8.0.1}/square_authentication/pydantic_models/profile.py +0 -0
  22. {square_authentication-7.0.0 → square_authentication-8.0.1}/square_authentication/routes/__init__.py +0 -0
  23. {square_authentication-7.0.0 → square_authentication-8.0.1}/square_authentication/routes/utility.py +0 -0
  24. {square_authentication-7.0.0 → square_authentication-8.0.1}/square_authentication/utils/__init__.py +0 -0
  25. {square_authentication-7.0.0 → square_authentication-8.0.1}/square_authentication/utils/encryption.py +0 -0
  26. {square_authentication-7.0.0 → square_authentication-8.0.1}/square_authentication/utils/token.py +0 -0
  27. {square_authentication-7.0.0 → square_authentication-8.0.1}/square_authentication.egg-info/dependency_links.txt +0 -0
  28. {square_authentication-7.0.0 → square_authentication-8.0.1}/square_authentication.egg-info/top_level.txt +0 -0
  29. {square_authentication-7.0.0 → square_authentication-8.0.1}/tests/test_1.py +0 -0
  30. {square_authentication-7.0.0 → square_authentication-8.0.1}/tests/test_delete_user.py +0 -0
  31. {square_authentication-7.0.0 → square_authentication-8.0.1}/tests/test_update_profile.py +0 -0
  32. {square_authentication-7.0.0 → square_authentication-8.0.1}/tests/test_username.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: square_authentication
3
- Version: 7.0.0
3
+ Version: 8.0.1
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>=2.1.0
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,40 @@ pip install square_authentication
53
54
 
54
55
  ## changelog
55
56
 
57
+ ### v8.0.1
58
+
59
+ - core
60
+ - add make recovery_methods_to_add and recovery_methods_to_remove parameters optional in
61
+ update_user_recovery_methods_v0.
62
+
63
+ ### v8.0.0
64
+
65
+ - env
66
+ - add GOOGLE section and GOOGLE_AUTH_PLATFORM_CLIENT_ID variable.
67
+ - add LOGIC section with NUMBER_OF_RECOVERY_CODES, EXPIRY_TIME_FOR_EMAIL_VERIFICATION_CODE_IN_SECONDS,
68
+ NUMBER_OF_DIGITS_IN_EMAIL_VERIFICATION_CODE, EXPIRY_TIME_FOR_EMAIL_PASSWORD_RESET_CODE_IN_SECONDS,
69
+ NUMBER_OF_DIGITS_IN_EMAIL_PASSWORD_RESET_CODE variables.
70
+ - dependencies
71
+ - add google-auth>=2.40.3.
72
+ - update square_commons to >=3.0.0.
73
+ - core
74
+ - add reset_password_and_login_using_reset_email_code_v0.
75
+ - **breaking change**: remove app_id from send_reset_password_email_v0.
76
+ - implement deletion of existing backup codes before generating new ones (generate_account_backup_codes_v0).
77
+ - implement deletion of existing backup codes before removing recovery method (update_user_recovery_methods_v0).
78
+ - implement logout_other_sessions in update_password_v0, reset_password_and_login_using_backup_code_v0 and
79
+ reset_password_and_login_using_reset_email_code_v0
80
+ - in update_password_v0, it will log out all other sessions except the current one if valid (optional)
81
+ refresh_token is passed in.
82
+ - add register_login_google_v0, **finally**.
83
+ - add validation in update_password_v0, reset_password_and_login_using_backup_code_v0, send_reset_password_email_v0,
84
+ reset_password_and_login_using_reset_email_code_v0 to check if user has credentials and has self as auth provider.
85
+ - remove profile_photo from file_store when user is deleted in delete_user_v0.
86
+ - utils
87
+ - add new core file with generate_default_username_for_google_users function.
88
+ - tests
89
+ - add test_login_fail_v0.
90
+
56
91
  ### v7.0.0
57
92
 
58
93
  - internal support for UserAuthProvider.
@@ -16,6 +16,40 @@ pip install square_authentication
16
16
 
17
17
  ## changelog
18
18
 
19
+ ### v8.0.1
20
+
21
+ - core
22
+ - add make recovery_methods_to_add and recovery_methods_to_remove parameters optional in
23
+ update_user_recovery_methods_v0.
24
+
25
+ ### v8.0.0
26
+
27
+ - env
28
+ - add GOOGLE section and GOOGLE_AUTH_PLATFORM_CLIENT_ID variable.
29
+ - add LOGIC section with NUMBER_OF_RECOVERY_CODES, EXPIRY_TIME_FOR_EMAIL_VERIFICATION_CODE_IN_SECONDS,
30
+ NUMBER_OF_DIGITS_IN_EMAIL_VERIFICATION_CODE, EXPIRY_TIME_FOR_EMAIL_PASSWORD_RESET_CODE_IN_SECONDS,
31
+ NUMBER_OF_DIGITS_IN_EMAIL_PASSWORD_RESET_CODE variables.
32
+ - dependencies
33
+ - add google-auth>=2.40.3.
34
+ - update square_commons to >=3.0.0.
35
+ - core
36
+ - add reset_password_and_login_using_reset_email_code_v0.
37
+ - **breaking change**: remove app_id from send_reset_password_email_v0.
38
+ - implement deletion of existing backup codes before generating new ones (generate_account_backup_codes_v0).
39
+ - implement deletion of existing backup codes before removing recovery method (update_user_recovery_methods_v0).
40
+ - implement logout_other_sessions in update_password_v0, reset_password_and_login_using_backup_code_v0 and
41
+ reset_password_and_login_using_reset_email_code_v0
42
+ - in update_password_v0, it will log out all other sessions except the current one if valid (optional)
43
+ refresh_token is passed in.
44
+ - add register_login_google_v0, **finally**.
45
+ - add validation in update_password_v0, reset_password_and_login_using_backup_code_v0, send_reset_password_email_v0,
46
+ reset_password_and_login_using_reset_email_code_v0 to check if user has credentials and has self as auth provider.
47
+ - remove profile_photo from file_store when user is deleted in delete_user_v0.
48
+ - utils
49
+ - add new core file with generate_default_username_for_google_users function.
50
+ - tests
51
+ - add test_login_fail_v0.
52
+
19
53
  ### v7.0.0
20
54
 
21
55
  - internal support for UserAuthProvider.
@@ -4,7 +4,7 @@ package_name = "square_authentication"
4
4
 
5
5
  setup(
6
6
  name=package_name,
7
- version="7.0.0",
7
+ version="8.0.1",
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>=2.1.0",
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",
@@ -100,6 +100,37 @@ try:
100
100
 
101
101
  MAIL_GUN_API_KEY = ldict_configuration["EMAIL"]["MAIL_GUN_API_KEY"]
102
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
+
103
134
  # Initialize logger
104
135
  global_object_square_logger = SquareLogger(
105
136
  pstr_log_file_name=config_str_log_file_name,
@@ -54,4 +54,14 @@ SQUARE_FILE_STORE_IP = localhost
54
54
  SQUARE_FILE_STORE_PORT = 10100
55
55
 
56
56
  [EMAIL]
57
- MAIL_GUN_API_KEY = dummy_mailgun_api_key
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
@@ -54,4 +54,14 @@ SQUARE_FILE_STORE_IP = raspi.thepmsquare.com
54
54
  SQUARE_FILE_STORE_PORT = 20010
55
55
 
56
56
  [EMAIL]
57
- MAIL_GUN_API_KEY = dummy_mailgun_api_key
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
@@ -27,4 +27,6 @@ messages = {
27
27
  "EMAIL_ALREADY_VERIFIED": "your email address has already been verified.",
28
28
  "INCORRECT_VERIFICATION_CODE": "the verification code you entered is incorrect or has expired. please request a new code.",
29
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.",
30
32
  }
@@ -10,6 +10,12 @@ class RegisterUsernameV0(BaseModel):
10
10
  app_id: Optional[int] = None
11
11
 
12
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
+
13
19
  class LoginUsernameV0(BaseModel):
14
20
  username: str
15
21
  password: str
@@ -24,6 +30,8 @@ class DeleteUserV0(BaseModel):
24
30
  class UpdatePasswordV0(BaseModel):
25
31
  old_password: str
26
32
  new_password: str
33
+ logout_other_sessions: bool = False
34
+ preserve_session_refresh_token: Optional[str] = None
27
35
 
28
36
 
29
37
  class TokenType(Enum):
@@ -40,8 +48,16 @@ class ResetPasswordAndLoginUsingBackupCodeV0(BaseModel):
40
48
  username: str
41
49
  new_password: str
42
50
  app_id: int
51
+ logout_other_sessions: bool = False
43
52
 
44
53
 
45
54
  class SendResetPasswordEmailV0(BaseModel):
46
55
  username: str
56
+
57
+
58
+ class ResetPasswordAndLoginUsingResetEmailCodeV0(BaseModel):
59
+ reset_email_code: str
60
+ username: str
61
+ new_password: str
47
62
  app_id: int
63
+ logout_other_sessions: bool = False