square-authentication 1.0.0__tar.gz → 3.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.
Files changed (27) hide show
  1. square_authentication-3.0.0/PKG-INFO +68 -0
  2. square_authentication-3.0.0/README.md +51 -0
  3. {square_authentication-1.0.0 → square_authentication-3.0.0}/setup.py +4 -4
  4. {square_authentication-1.0.0 → square_authentication-3.0.0}/square_authentication/configuration.py +5 -5
  5. {square_authentication-1.0.0 → square_authentication-3.0.0}/square_authentication/main.py +4 -4
  6. square_authentication-3.0.0/square_authentication/messages.py +17 -0
  7. square_authentication-3.0.0/square_authentication/pydantic_models/core.py +24 -0
  8. square_authentication-3.0.0/square_authentication/routes/__init__.py +0 -0
  9. square_authentication-3.0.0/square_authentication/routes/core.py +1170 -0
  10. square_authentication-3.0.0/square_authentication/routes/utility.py +5 -0
  11. square_authentication-3.0.0/square_authentication.egg-info/PKG-INFO +68 -0
  12. {square_authentication-1.0.0 → square_authentication-3.0.0}/square_authentication.egg-info/SOURCES.txt +3 -0
  13. {square_authentication-1.0.0 → square_authentication-3.0.0}/square_authentication.egg-info/requires.txt +3 -3
  14. square_authentication-1.0.0/PKG-INFO +0 -40
  15. square_authentication-1.0.0/README.md +0 -23
  16. square_authentication-1.0.0/square_authentication/routes/core.py +0 -464
  17. square_authentication-1.0.0/square_authentication/routes/utility.py +0 -3
  18. square_authentication-1.0.0/square_authentication.egg-info/PKG-INFO +0 -40
  19. {square_authentication-1.0.0 → square_authentication-3.0.0}/setup.cfg +0 -0
  20. {square_authentication-1.0.0 → square_authentication-3.0.0}/square_authentication/__init__.py +0 -0
  21. {square_authentication-1.0.0 → square_authentication-3.0.0}/square_authentication/data/config.ini +0 -0
  22. {square_authentication-1.0.0/square_authentication/routes → square_authentication-3.0.0/square_authentication/pydantic_models}/__init__.py +0 -0
  23. {square_authentication-1.0.0 → square_authentication-3.0.0}/square_authentication/utils/__init__.py +0 -0
  24. {square_authentication-1.0.0 → square_authentication-3.0.0}/square_authentication/utils/encryption.py +0 -0
  25. {square_authentication-1.0.0 → square_authentication-3.0.0}/square_authentication/utils/token.py +0 -0
  26. {square_authentication-1.0.0 → square_authentication-3.0.0}/square_authentication.egg-info/dependency_links.txt +0 -0
  27. {square_authentication-1.0.0 → square_authentication-3.0.0}/square_authentication.egg-info/top_level.txt +0 -0
@@ -0,0 +1,68 @@
1
+ Metadata-Version: 2.1
2
+ Name: square_authentication
3
+ Version: 3.0.0
4
+ Summary: authentication layer for my personal server.
5
+ Home-page: https://github.com/thepmsquare/square_authentication
6
+ Author: thePmSquare
7
+ Author-email: thepmsquare@gmail.com
8
+ License: UNKNOWN
9
+ Platform: UNKNOWN
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.9
15
+ Description-Content-Type: text/markdown
16
+
17
+ # square_authentication
18
+
19
+ ## about
20
+
21
+ authentication layer for my personal server.
22
+
23
+ ## Installation
24
+
25
+ ```shell
26
+ pip install square_authentication
27
+ ```
28
+
29
+ ## env
30
+
31
+ - python>=3.12.0
32
+
33
+ ## changelog
34
+
35
+ ### v3.0.0
36
+
37
+ - added new endpoints
38
+ - /update_username/v0
39
+ - /delete_user/v0
40
+ - /update_password/v0
41
+ - move data in password related endpoints to request body from params.
42
+ - /register_username/v0 now takes in app_id as optional parameter to assign user to that app and create session for it.
43
+ - /generate_access_token/v0 now only needs refresh token (removed validation).
44
+ - /logout/v0 now only needs refresh token (removed validation).
45
+ - /update_user_app_ids/v0 now only updates ids for self (user). added access token as input param and removed user_id.
46
+ - /get_user_app_ids/v0 is now /get_user_details/v0 with access token as the only input param.
47
+
48
+ ### v2.0.0
49
+
50
+ - authentication module needs to be used across applications so
51
+ - register_username: will not create sessions and therefore will not auto login.
52
+ - login: added validation if app is assigned to user before assigning it and added app_id in session row.
53
+ - logout: added app_id as new parameter and validation for that.
54
+ - generate_access_token: added app_id as new parameter and validation for that.
55
+ - added 2 new endpoints
56
+ - get user app ids: **access token validation pending**.
57
+ - change user app ids: **access token validation pending**.
58
+ - add versions for all endpoint paths.
59
+ - make it compatible with square_database_helper 2.x.
60
+ - username in database will always be lowercase.
61
+ - standardise output formats for all api.
62
+
63
+ ### v1.0.0
64
+
65
+ - initial implementation.
66
+
67
+ ## Feedback is appreciated. Thank you!
68
+
@@ -0,0 +1,51 @@
1
+ # square_authentication
2
+
3
+ ## about
4
+
5
+ authentication layer for my personal server.
6
+
7
+ ## Installation
8
+
9
+ ```shell
10
+ pip install square_authentication
11
+ ```
12
+
13
+ ## env
14
+
15
+ - python>=3.12.0
16
+
17
+ ## changelog
18
+
19
+ ### v3.0.0
20
+
21
+ - added new endpoints
22
+ - /update_username/v0
23
+ - /delete_user/v0
24
+ - /update_password/v0
25
+ - move data in password related endpoints to request body from params.
26
+ - /register_username/v0 now takes in app_id as optional parameter to assign user to that app and create session for it.
27
+ - /generate_access_token/v0 now only needs refresh token (removed validation).
28
+ - /logout/v0 now only needs refresh token (removed validation).
29
+ - /update_user_app_ids/v0 now only updates ids for self (user). added access token as input param and removed user_id.
30
+ - /get_user_app_ids/v0 is now /get_user_details/v0 with access token as the only input param.
31
+
32
+ ### v2.0.0
33
+
34
+ - authentication module needs to be used across applications so
35
+ - register_username: will not create sessions and therefore will not auto login.
36
+ - login: added validation if app is assigned to user before assigning it and added app_id in session row.
37
+ - logout: added app_id as new parameter and validation for that.
38
+ - generate_access_token: added app_id as new parameter and validation for that.
39
+ - added 2 new endpoints
40
+ - get user app ids: **access token validation pending**.
41
+ - change user app ids: **access token validation pending**.
42
+ - add versions for all endpoint paths.
43
+ - make it compatible with square_database_helper 2.x.
44
+ - username in database will always be lowercase.
45
+ - standardise output formats for all api.
46
+
47
+ ### v1.0.0
48
+
49
+ - initial implementation.
50
+
51
+ ## Feedback is appreciated. Thank you!
@@ -4,7 +4,7 @@ package_name = "square_authentication"
4
4
 
5
5
  setup(
6
6
  name=package_name,
7
- version="1.0.0",
7
+ version="3.0.0",
8
8
  packages=find_packages(),
9
9
  package_data={
10
10
  package_name: ["data/*"],
@@ -17,10 +17,10 @@ setup(
17
17
  "pyjwt>=2.8.0",
18
18
  "requests>=2.32.3",
19
19
  "cryptography>=42.0.7",
20
- "square_commons>=0.0.1",
20
+ "square_commons>=1.0.0",
21
21
  "square_logger>=1.0.0",
22
- "square_database_helper>=0.0.5",
23
- "square_database_structure>=0.0.11",
22
+ "square_database_helper>=2.0.0",
23
+ "square_database_structure>=1.0.0",
24
24
  ],
25
25
  extras_require={},
26
26
  author="thePmSquare",
@@ -6,11 +6,11 @@ from square_logger.main import SquareLogger
6
6
 
7
7
  try:
8
8
  config_file_path = (
9
- os.path.dirname(os.path.abspath(__file__))
10
- + os.sep
11
- + "data"
12
- + os.sep
13
- + "config.ini"
9
+ os.path.dirname(os.path.abspath(__file__))
10
+ + os.sep
11
+ + "data"
12
+ + os.sep
13
+ + "config.ini"
14
14
  )
15
15
  ldict_configuration = ConfigReader(config_file_path).read_configuration()
16
16
 
@@ -3,6 +3,7 @@ import os.path
3
3
  from fastapi import FastAPI, status
4
4
  from fastapi.middleware.cors import CORSMiddleware
5
5
  from fastapi.responses import JSONResponse
6
+ from square_commons import get_api_output_in_standard_format
6
7
  from uvicorn import run
7
8
 
8
9
  from square_authentication.configuration import (
@@ -31,15 +32,14 @@ app.include_router(utility.router)
31
32
  @app.get("/")
32
33
  @global_object_square_logger.async_auto_logger
33
34
  async def root():
34
- return JSONResponse(
35
- status_code=status.HTTP_200_OK, content={"text": config_str_module_name}
36
- )
35
+ output_content = get_api_output_in_standard_format(log=config_str_module_name)
36
+ return JSONResponse(status_code=status.HTTP_200_OK, content=output_content)
37
37
 
38
38
 
39
39
  if __name__ == "__main__":
40
40
  try:
41
41
  if os.path.exists(config_str_ssl_key_file_path) and os.path.exists(
42
- config_str_ssl_crt_file_path
42
+ config_str_ssl_crt_file_path
43
43
  ):
44
44
  run(
45
45
  app,
@@ -0,0 +1,17 @@
1
+ messages = {
2
+ "REGISTRATION_SUCCESSFUL": "registration was successful. welcome aboard!",
3
+ "LOGIN_SUCCESSFUL": "you have logged in successfully.",
4
+ "LOGOUT_SUCCESSFUL": "you have logged out successfully.",
5
+ "INCORRECT_USERNAME": "the username you entered does not exist.",
6
+ "INCORRECT_PASSWORD": "the password you entered is incorrect. please try again.",
7
+ "INCORRECT_USER_ID": "the user ID you provided does not exist or is invalid.",
8
+ "USERNAME_ALREADY_EXISTS": "the username you entered is already taken. please choose a different one.",
9
+ "INCORRECT_ACCESS_TOKEN": "the access token provided is invalid or expired.",
10
+ "INCORRECT_REFRESH_TOKEN": "the refresh token provided is invalid or expired.",
11
+ "GENERIC_CREATION_SUCCESSFUL": "records created successfully.",
12
+ "GENERIC_READ_SUCCESSFUL": "data retrieved successfully.",
13
+ "GENERIC_UPDATE_SUCCESSFUL": "your information has been updated successfully.",
14
+ "GENERIC_DELETE_SUCCESSFUL": "your records have been deleted successfully.",
15
+ "GENERIC_400": "the request is invalid or cannot be processed.",
16
+ "GENERIC_500": "an internal server error occurred. please try again later.",
17
+ }
@@ -0,0 +1,24 @@
1
+ from typing import Optional
2
+
3
+ from pydantic import BaseModel
4
+
5
+
6
+ class RegisterUsernameV0(BaseModel):
7
+ username: str
8
+ password: str
9
+ app_id: Optional[int] = None
10
+
11
+
12
+ class LoginUsernameV0(BaseModel):
13
+ username: str
14
+ password: str
15
+ app_id: int
16
+
17
+
18
+ class DeleteUserV0(BaseModel):
19
+ password: str
20
+
21
+
22
+ class UpdatePasswordV0(BaseModel):
23
+ old_password: str
24
+ new_password: str