square-authentication 1.0.0__tar.gz → 2.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 (23) hide show
  1. {square_authentication-1.0.0 → square_authentication-2.0.0}/PKG-INFO +16 -1
  2. square_authentication-2.0.0/README.md +38 -0
  3. {square_authentication-1.0.0 → square_authentication-2.0.0}/setup.py +4 -4
  4. {square_authentication-1.0.0 → square_authentication-2.0.0}/square_authentication/configuration.py +5 -5
  5. {square_authentication-1.0.0 → square_authentication-2.0.0}/square_authentication/main.py +4 -4
  6. square_authentication-2.0.0/square_authentication/messages.py +16 -0
  7. square_authentication-2.0.0/square_authentication/routes/core.py +871 -0
  8. square_authentication-2.0.0/square_authentication/routes/utility.py +5 -0
  9. {square_authentication-1.0.0 → square_authentication-2.0.0}/square_authentication.egg-info/PKG-INFO +16 -1
  10. {square_authentication-1.0.0 → square_authentication-2.0.0}/square_authentication.egg-info/SOURCES.txt +1 -0
  11. {square_authentication-1.0.0 → square_authentication-2.0.0}/square_authentication.egg-info/requires.txt +3 -3
  12. square_authentication-1.0.0/README.md +0 -23
  13. square_authentication-1.0.0/square_authentication/routes/core.py +0 -464
  14. square_authentication-1.0.0/square_authentication/routes/utility.py +0 -3
  15. {square_authentication-1.0.0 → square_authentication-2.0.0}/setup.cfg +0 -0
  16. {square_authentication-1.0.0 → square_authentication-2.0.0}/square_authentication/__init__.py +0 -0
  17. {square_authentication-1.0.0 → square_authentication-2.0.0}/square_authentication/data/config.ini +0 -0
  18. {square_authentication-1.0.0 → square_authentication-2.0.0}/square_authentication/routes/__init__.py +0 -0
  19. {square_authentication-1.0.0 → square_authentication-2.0.0}/square_authentication/utils/__init__.py +0 -0
  20. {square_authentication-1.0.0 → square_authentication-2.0.0}/square_authentication/utils/encryption.py +0 -0
  21. {square_authentication-1.0.0 → square_authentication-2.0.0}/square_authentication/utils/token.py +0 -0
  22. {square_authentication-1.0.0 → square_authentication-2.0.0}/square_authentication.egg-info/dependency_links.txt +0 -0
  23. {square_authentication-1.0.0 → square_authentication-2.0.0}/square_authentication.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: square_authentication
3
- Version: 1.0.0
3
+ Version: 2.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
@@ -32,6 +32,21 @@ pip install square_authentication
32
32
 
33
33
  ## changelog
34
34
 
35
+ ### v2.0.0
36
+
37
+ - authentication module needs to be used across applications so
38
+ - register_username: will not create sessions and therefore will not auto login.
39
+ - login: added validation if app is assigned to user before assigning it and added app_id in session row.
40
+ - logout: added app_id as new parameter and validation for that.
41
+ - generate_access_token: added app_id as new parameter and validation for that.
42
+ - added 2 new endpoints
43
+ - get user app ids: **access token validation pending**.
44
+ - change user app ids: **access token validation pending**.
45
+ - add versions for all endpoint paths.
46
+ - make it compatible with square_database_helper 2.x.
47
+ - username in database will always be lowercase.
48
+ - standardise output formats for all api.
49
+
35
50
  ### v1.0.0
36
51
 
37
52
  - initial implementation.
@@ -0,0 +1,38 @@
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
+ ### v2.0.0
20
+
21
+ - authentication module needs to be used across applications so
22
+ - register_username: will not create sessions and therefore will not auto login.
23
+ - login: added validation if app is assigned to user before assigning it and added app_id in session row.
24
+ - logout: added app_id as new parameter and validation for that.
25
+ - generate_access_token: added app_id as new parameter and validation for that.
26
+ - added 2 new endpoints
27
+ - get user app ids: **access token validation pending**.
28
+ - change user app ids: **access token validation pending**.
29
+ - add versions for all endpoint paths.
30
+ - make it compatible with square_database_helper 2.x.
31
+ - username in database will always be lowercase.
32
+ - standardise output formats for all api.
33
+
34
+ ### v1.0.0
35
+
36
+ - initial implementation.
37
+
38
+ ## 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="2.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,16 @@
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_READ_SUCCESSFUL": "data retrieved successfully.",
12
+ "GENERIC_CREATION_SUCCESSFUL": "records created successfully.",
13
+ "GENERIC_UPDATE_SUCCESSFUL": "your information has been updated successfully.",
14
+ "GENERIC_400": "the request is invalid or cannot be processed.",
15
+ "GENERIC_500": "an internal server error occurred. please try again later.",
16
+ }