Commit graph

4,391 commits

Author SHA1 Message Date
Gabriel Luiz Freitas Almeida
a4aeff6d79 🔧 fix(api_key.py): import missing dependencies and fix type annotations in api_key.py
🔧 fix(api_key.py): fix type annotations and import in api_key.py
🔧 fix(api_key.py): fix type annotations and
2023-08-25 12:21:14 -03:00
Gabriel Luiz Freitas Almeida
950b9d179b 🔥 refactor(user/utils.py): remove unused code and imports from user/utils.py module
 feat(test_api_key.py): add tests for API key creation, retrieval, and deletion
 feat(test_user.py): remove unused fixtures and imports from test_user.py module
2023-08-25 12:05:54 -03:00
Gabriel Luiz Freitas Almeida
ba081e81b6 🔀 chore(user.py): add type hinting for ApiKey import to improve code readability
🔀 chore(user.py): add relationship between User and ApiKey models to establish a one-to-many relationship
2023-08-25 12:05:20 -03:00
Gabriel Luiz Freitas Almeida
7783f4532e 📦 chore(user/crud.py): add CRUD operations for User model in database
🔒 fix(user/crud.py): add validation to prevent duplicate usernames during user update
🔄 refactor(user/crud.py): update user attributes and last_login_at timestamp during user update
🐛 fix(user/crud.py): handle IntegrityError during user update and rollback transaction
2023-08-25 12:04:51 -03:00
Gabriel Luiz Freitas Almeida
e42686738c 📦 chore(api_key/crud.py): add CRUD functions for managing API keys in the database
This commit adds the following functions to the `api_key/crud.py` file:
- `get_api_keys`: Retrieves a list of API keys associated with a specific user ID from the database.
- `create_api_key`: Generates a random API key, hashes it, and creates a new `ApiKey` object in the database.
- `delete_api_key`: Deletes an API key from the database based on its ID.

These functions provide the necessary functionality for managing API keys in the application's database.
2023-08-25 12:04:20 -03:00
Gabriel Luiz Freitas Almeida
82fbeace06 🔀 chore(api_key): update import and export names in __init__.py for better clarity and consistency
🔀 chore(api_key): add UnmaskedApiKeyRead model to represent an unmasked API key

🔀 chore(api_key): add user relationship to ApiKey model for easier access to associated user

🔀 chore(api_key): add user_id field to ApiKeyBase and ApiKeyCreate models for easier user association

🔀 chore(api_key): add mask_api_key validator to ApiKeyRead model to mask the API key for security reasons
2023-08-25 12:03:51 -03:00
Gabriel Luiz Freitas Almeida
edd58705e4 🔨 refactor(schemas.py): update import statement for ApiKeyRead to reflect new file structure
🔨 refactor(schemas.py): update import statement for ApiKeyRead to reflect
2023-08-25 12:03:03 -03:00
Gabriel Luiz Freitas Almeida
eb02220aad feat(api_key.py): add GET and POST routes for retrieving and creating API keys
🐛 fix(api_key.py): fix delete_api_key route to use correct dependencies and handle exceptions properly
2023-08-25 12:02:32 -03:00
Gabriel Luiz Freitas Almeida
8d1e1b8710 🔒 chore(api_key.py): update hardcoded API key value to improve security
🔒 chore(api_key.py): update hardcoded API key value to improve security by removing the actual key from the code and adding a placeholder comment
2023-08-25 10:25:28 -03:00
Gabriel Luiz Freitas Almeida
fc93e4ced0 🔀 chore(test_database.py): update import statement for Session from sqlalchemy.orm to sqlmodel to match the library being used 2023-08-25 10:24:33 -03:00
Gabriel Luiz Freitas Almeida
81816baada 🔧 fix(login.py): update import statement from sqlalchemy.orm to sqlmodel.Session for Session class
🔧 fix(users.py): update type annotation for current_user parameter from Session to User
🔧 fix(utils.py): update import statement from sqlalchemy.orm to sqlmodel.Session
🔧 fix(utils.py): update type annotation for token parameter from Annotated to Union[Coroutine, str]
🔧 fix(utils.py): update type annotation for get_user_by_username function return type from User to Union[User, None]
🔧 fix(utils.py): update type annotation for get_user_by_id function return type from User to Union[User, None]
🔧 fix(manager.py): update type annotation for dependencies parameter in register_factory method from List to Optional[List]
2023-08-25 10:24:01 -03:00
Gabriel Luiz Freitas Almeida
8411922a07 feat(test_user.py): add tests for user-related functionalities
🐛 fix(test_user.py): fix typo in test_user_waiting_for_approval function name
🐛 fix(test_user.py): fix typo in test_deactivated_user_cannot_access function name
🐛 fix(test_user.py): fix typo in test_data_consistency_after_update function name
🐛 fix(test_user.py): fix typo in test_data_consistency_after_delete function name
🐛 fix(test_user.py): fix typo in test_inactive_user function name
🐛 fix(test_user.py): fix typo in test_normal_user_cant_read_all_users function name
🐛 fix(test_user.py): fix typo in test_patch_user_wrong_id function name
🐛 fix(test_user.py): fix typo in test_delete_user_wrong_id function name
🐛 fix(test_user.py): fix typo in test_normal_user_cant_delete_user function name
 feat(test_user.py): add test_add_super_user_for_testing_purposes_delete_me_before_merge_into_dev function
2023-08-25 10:17:46 -03:00
Gabriel Luiz Freitas Almeida
7b897906b9 feat(test_login.py): add tests for login functionality
🐛 fix(test_login.py): fix typo in test_login_unsuccessful_wrong_username test

🐛 fix(test_login.py): fix typo in test_login_unsuccessful_wrong_password test
2023-08-25 10:17:36 -03:00
Gabriel Luiz Freitas Almeida
7e3d329df9 🔧 chore(auth.py): add API_V1_STR constant to improve code readability and maintainability
🐛 fix(auth.py): update tokenUrl in oauth2_scheme to use API_V1_STR constant for consistency
2023-08-25 10:17:25 -03:00
Gabriel Luiz Freitas Almeida
92a7ae6be7 🐛 fix(utils.py): remove unnecessary type casting in get_user_by_username and get_user_by_id functions
🐛 fix(utils.py): fix update_user function to correctly update user attributes and handle username conflicts
2023-08-25 10:16:04 -03:00
Gabriel Luiz Freitas Almeida
4517f8ad5c 🔧 fix(service.py): add request parameter to run_oauth2_scheme method in AuthManager class to handle FastAPI request object
🔧 fix(utils.py): add request parameter to auth_scheme_dependency function to handle FastAPI request object
🔧 fix(utils.py): change get_current_active_user function to synchronous and remove async keyword
 feat(utils.py): add get_current_active_superuser function to check if the current user is an active superuser
2023-08-25 10:11:24 -03:00
Gabriel Luiz Freitas Almeida
e4cbc0a07f 🐛 fix(users.py): change router tag from "Login" to "Users" for better categorization
 feat(users.py): add status code 201 to the response of the add_user endpoint to indicate successful creation of a new user
🐛 fix(users.py): update the usage of UserCreate model to create a new User instance using User.from_orm(user) for better compatibility
 feat(users.py): add current_user parameter to the read_current_user endpoint to enforce authentication and authorization
 feat(users.py): add current_user parameter to the read_all_users endpoint to enforce authentication and authorization
 feat(users.py): add current_user parameter to the delete_user endpoint to enforce authentication and authorization. Also, add validation checks to prevent deleting own user account and unauthorized deletion of users.
2023-08-25 10:10:57 -03:00
Gabriel Luiz Freitas Almeida
43b2d62661 🔀 chore(router.py): add login_router to the APIRouter to include login functionality
🔀 chore(__init__.py): import and include login_router in the APIRouter to enable login functionality
🔀 chore(login.py): add tags to the login router to categorize it as "Login" in the API documentation
2023-08-25 10:10:19 -03:00
Gabriel Luiz Freitas Almeida
6b82b730cd 🔥 refactor(auth): remove unused code and dependencies in auth module
🔥 refactor(routers): remove unused code and dependencies in routers module
2023-08-25 10:09:37 -03:00
Gabriel Luiz Freitas Almeida
41ef2fd2f7 🔧 fix(alembic): fix indentation and formatting issues in add_apikey_table migration script
 feat(alembic): add support for creating apikey and user tables in the database
🔥 chore(alembic): remove flowstyle and component tables from the database schema
2023-08-24 17:42:53 -03:00
Gabriel Luiz Freitas Almeida
58121cc6ca 🔥 refactor(main.py): remove unused routers from the app to improve code cleanliness and reduce unnecessary imports 2023-08-24 17:42:33 -03:00
Gabriel Luiz Freitas Almeida
d9cbf17b1a 🔄 chore(router.py): add users_router and api_key_router to the APIRouter to include the new routes for users and api keys
🔄 chore(__init__.py): add users_router and api_key_router to the __all__ list to include the new routes for users and api keys
🆕 feat(api_key.py): add new routes for retrieving, creating, and deleting API keys
🆕 feat(login.py): add new routes for user login, auto login, and token refresh
🆕 feat(schemas.py): add new schemas for API key response and users response
🆕 feat(users.py): add new routes for adding, reading, updating, and deleting users
🗑️ chore(health.py): remove health router as it is no longer needed
🔄 chore(utils.py): update import statements for User model and update_user_last_login_at function
2023-08-24 17:41:41 -03:00
Gabriel Luiz Freitas Almeida
1a51cc0848 📦 feat(api_key): add ApiKey model and related classes for database operations
📦 feat(component): add Component model and related classes for database operations

📦 feat(flow): add Flow model and related classes for database operations

📦 feat(token): add Token model for authentication

📦 feat(user): add User model and related classes for database operations

📦 feat(user): add utility functions for user operations
2023-08-24 17:32:26 -03:00
Gabriel Luiz Freitas Almeida
fd6ef1815b format 2023-08-23 21:43:23 -03:00
Gabriel Luiz Freitas Almeida
63ca408506 🔧 chore(alembic): add ApiKey table and remove FlowStyle and Component tables
🔄 refactor(alembic): downgrade migration to recreate FlowStyle and Component tables and remove User and ApiKey tables
2023-08-23 21:43:14 -03:00
Gabriel Luiz Freitas Almeida
130dc7ead6 🔧 fix(schemas.py): import ApiKeyRead from api_key module to fix missing import error
🔧 fix(models/__init__.py): add ApiKey to __all__ list to fix missing import error
 feat(models/api_key.py): add ApiKey model and its related classes to support API key functionality
2023-08-23 21:12:11 -03:00
Gabriel Luiz Freitas Almeida
48965a8ba8 🐛 fix(endpoints.py): add check for empty custom_component_dict to prevent errors
🐛 fix(login.py): update import statement for auth utils module
🐛 fix(users.py): update import statement for auth utils module
🐛 fix(factory.py): remove unnecessary argument from create method
🐛 fix(test_cli.py): convert temp_dir to string before checking if it's in COMPONENTS_PATH
2023-08-21 19:14:58 -03:00
Gabriel Luiz Freitas Almeida
0a235ef8d5 🔀 refactor(manager.py): refactor service initialization in manager.py for better organization and readability
🔀 refactor(schema.py): add AUTH_MANAGER service type to the ServiceType enum for better organization and consistency
2023-08-21 16:58:22 -03:00
Gabriel Luiz Freitas Almeida
031ab7e4b7 📦 chore(factory.py): add AuthManagerFactory class to handle creation of AuthManager service
🐛 fix(service.py): add type hints and import for SettingsManager in AuthManager class
2023-08-21 16:58:09 -03:00
Gabriel Luiz Freitas Almeida
5d9e631ddf 🔨 refactor(factory.py): remove unused parameter 'settings_service' from create method in CacheManagerFactory class 2023-08-21 16:56:20 -03:00
Gabriel Luiz Freitas Almeida
712d57be53 🔄 refactor(factory.py): rename settings_service parameter to settings_manager for better clarity and consistency
🐛 fix(factory.py): update variable name in if condition from settings_service.settings.DATABASE_URL to settings_manager.settings.DATABASE_URL to fix incorrect variable reference
2023-08-21 16:56:07 -03:00
Gabriel Luiz Freitas Almeida
fa9ecd0039 🚀 feat(models/__init__.py): add User and Token models to __all__ list for better module importability 2023-08-21 16:55:45 -03:00
Gabriel Luiz Freitas Almeida
181620e538 🔧 fix(manager.py): import List from typing module to fix type hinting error
 feat(manager.py): add support for registering factories with dependencies to handle service creation
🔧 fix(manager.py): fix service creation logic to handle dependencies and create services in the correct order
 feat(manager.py): add support for initializing session manager with dependencies
2023-08-21 16:37:56 -03:00
Gabriel Luiz Freitas Almeida
b309d8be0e 🔒 chore(auth.py): import necessary modules and add password context and OAuth2 password bearer scheme for authentication
🔒 chore(auth.py): add password context using bcrypt scheme and OAuth2 password bearer scheme for authentication
2023-08-21 16:34:23 -03:00
Gabriel Luiz Freitas Almeida
244a967517 🔨 refactor(service.py): remove unused imports and unused functions in the AuthManager class
🔧 chore(service.py): refactor the AuthManager class to accept a settings_manager parameter in the constructor for better dependency injection
🔧 chore(service.py): refactor the run_oauth2_scheme method in the AuthManager class to use the oauth2_scheme from the settings_manager instead of a hardcoded value

 feat(auth/utils.py): add authentication and authorization utilities for user authentication and token generation
🔒 chore(auth/utils.py): add auth_scheme_dependency function to handle authentication scheme dependency
🔒 chore(auth/utils.py): add get_current_user function to retrieve the current authenticated user
🔒 chore(auth/utils.py): add get_current_active_user function to retrieve the current active authenticated user
🔒 chore(auth/utils.py): add verify_password function to verify the password
🔒 chore(auth/utils.py): add get_password_hash function to get the hashed password
🔒 chore(auth/utils.py): add create_token function to create a JWT token
🔒 chore(auth/utils.py): add create_super_user function to create a super user
🔒 chore(auth/utils.py): add create_user_longterm_token function to create a long-term token for a user
🔒 chore(auth/utils.py): add create_user_api_key function to create an API key for a user
🔒 chore(auth/utils.py): add get_user_id_from_token function to get the user ID from a token
🔒 chore(auth/utils.py): add create_user_tokens function to create access and refresh tokens for a user
🔒 chore(auth/utils.py): add create_refresh_token function to create new access and refresh tokens using a refresh token
🔒 chore(auth/utils.py): add authenticate_user function to authenticate a user with username and password
2023-08-21 16:33:56 -03:00
Gabriel Luiz Freitas Almeida
e6bd9a07d5 🔧 fix(auth.py): update import statements for User model and related functions to match new file structure
🔧 fix(auth.py): update import statements for settings_manager and related settings to match new file structure
🔧 fix(auth.py): update references to settings_manager.settings to settings_manager.auth_settings to match new file structure
🔧 fix(auth.py): update references to settings_manager.settings to settings_manager.auth_settings to match new file structure
🔧 fix(auth.py): update references to settings_manager.settings to settings_manager.auth_settings to match new file structure
🔧 fix(auth.py): update references to settings_manager.settings to settings_manager.auth_settings to match new file structure
🔧 fix(auth.py): update references to settings_manager.settings to settings_manager.auth_settings to match new file structure
🔧 fix(auth.py): update references to settings_manager.settings to settings_manager.auth_settings to match new file structure
🔧 fix(auth.py): update references to settings_manager.settings to settings_manager.auth_settings to match new file structure
🔧 fix(auth.py): update references to settings_manager.settings to settings_manager.auth_settings to match new file structure
🔧 fix(auth.py): update references to settings_manager.settings to settings_manager.auth_settings to match new file structure
🔧 fix(auth.py): update references to settings_manager.settings to settings_manager.auth_settings to match new file structure
🔧 fix(auth.py): update references to settings_manager.settings to settings_manager.auth_settings to match new file structure
🔧 fix(auth.py): update references to settings_manager.settings to settings_manager.auth_settings to match new file structure
🔧 fix(auth.py): update references to settings_manager.settings to settings_manager.auth_settings to match new file structure
🔧 fix(auth.py): update references to settings_manager.settings to settings_manager.auth_settings to match new file structure
🔧 fix(auth.py): update references to settings_manager.settings to settings_manager.auth_settings to match new file structure
🔧 fix(auth.py): update references to settings_manager.settings to settings_manager.auth_settings to match new file structure
🔧 fix(auth.py): update references to settings_manager.settings to settings_manager.auth_settings to match new file structure
🔧 fix(auth.py): update references to settings_manager.settings to settings_manager.auth_settings to match new file structure
🔧 fix(auth.py): update references to settings_manager.settings to settings_manager.auth_settings to match new file structure
2023-08-21 16:33:27 -03:00
Gabriel Luiz Freitas Almeida
a84b5a119b Merge remote-tracking branch 'origin/dev' into authentication 2023-08-21 16:32:28 -03:00
Gabriel Luiz Freitas Almeida
f4d12f27e6 Adds new AuthSettings 2023-08-21 16:12:49 -03:00
Gabriel Luiz Freitas Almeida
3d5cf84095 📦 feat(models): add Token model to represent access and refresh tokens
📦 feat(models): add User model to represent user data

📦 feat(models): add UserAddModel, UserListModel, UserPatchModel, and UsersResponse models for user CRUD operations

📦 feat(models): add get_user_by_username and get_user_by_id functions to retrieve user data from the database

📦 feat(models): add update_user function to update user data in the database

📦 feat(models): add update_user_last_login_at function to update the last login timestamp of a user
2023-08-21 15:59:51 -03:00
Gabriel Luiz Freitas Almeida
4d3b12aff8 📝 chore(tasks.json): add tasks.json file to configure build tasks for the project
The tasks.json file is added to configure build tasks for the project. It includes tasks for initializing the project, building the backend and frontend, running tests, linting, formatting, and installing dependencies.
2023-08-21 15:09:36 -03:00
Gabriel Luiz Freitas Almeida
0679fb8754 🔧 chore(devcontainer.json): update postCreateCommand to install frontend and backend dependencies after container creation for easier development setup 2023-08-21 14:53:37 -03:00
Gabriel Luiz Freitas Almeida
20cf3e0346 🔧 chore(devcontainer.json): update devcontainer.json for Langflow Demo Container
🔧 chore(devcontainer.json): update devcontainer.json for Langflow Dev Container
2023-08-21 14:31:12 -03:00
gustavoschaedler
463831e8df Merge remote-tracking branch 'origin/dev' into authentication 2023-08-17 19:50:27 +01:00
anovazzi1
2078778976
update make frontendc (#783)
chore(Makefile): update 'install_frontendc' target to remove existing
node_modules and package-lock.json before running 'npm install' to
ensure a clean installation
2023-08-17 15:39:35 -03:00
anovazzi1
e362dc0bed Merge remote-tracking branch 'origin/dev' into fixmakeFrontendC 2023-08-17 15:37:21 -03:00
gustavoschaedler
3c4db074e4 🔧 fix(base.py): update BASE_COMPONENTS_PATH to point to the correct directory
🔧 fix(base.py): improve readability by removing commented out code and adding line breaks
🔧 fix(base.py): improve readability by adding line breaks and indentation
🔧 fix(base.py): improve readability by adding line breaks and indentation
🔧 fix(base.py): improve readability by adding line breaks and indentation
🔧 fix(base.py): improve readability by adding line breaks and indentation
🔧 fix(base.py): improve readability by adding line breaks and indentation
🔧 fix(base.py): improve readability by adding line breaks and indentation
🔧 fix(base.py): improve readability by adding line breaks and indentation
🔧 fix(base.py): improve readability by adding line breaks and indentation
🔧 fix(base.py): improve readability by adding line breaks and indentation
🔧 fix(base.py): improve readability by adding line breaks and indentation
🔧 fix(base.py): improve readability by adding line breaks and indentation
🔧 fix(base.py): improve readability by adding line breaks and indentation
🔧 fix(base.py): improve readability by adding line breaks and indentation
🔧 fix(base.py): improve readability by adding line breaks and indentation
🔧 fix(base.py): improve readability by adding line breaks and indentation
🔧 fix(base.py): improve readability by adding line breaks and indentation
🔧 fix(base.py): improve readability by adding line breaks and indentation
🔧 fix(base.py): improve readability by adding line breaks and indentation
🔧 fix(base.py): improve readability by adding line breaks and indentation
🔧 fix(base.py): improve readability by adding line breaks and indentation
🔧 fix(base.py): improve readability by adding line breaks and indentation
🔧 fix(base.py): improve readability by adding line breaks and indentation
🔧 fix(base.py): improve readability by adding line breaks and indentation
🔧 fix(base.py): improve readability by adding line breaks and indentation
🔧 fix(base.py): improve readability by adding line breaks and indentation
🔧 fix(base.py): improve readability by adding line breaks and indentation
🔧 fix(base.py): improve readability by adding line breaks and indentation
🔧 fix(base.py): improve readability by adding line breaks and indentation
🔧 fix(base.py): improve readability by adding line breaks and
2023-08-17 19:30:46 +01:00
anovazzi1
ab81c604a1 chore(Makefile): update 'install_frontendc' target to remove existing node_modules and package-lock.json before running 'npm install' to ensure a clean installation 2023-08-17 15:30:24 -03:00
Diógenes Betat Roos
50112c51d3
Update Devcontainer (#781)
Update Devcontainer to install and configure the development
environment.

- Add "setup_devcontainer" task to the makefile
- Add .gitattributes
2023-08-17 12:54:47 -03:00
Diógenes Betat Roos
6bb7fef28a Add .gitattributes 2023-08-17 14:59:20 +00:00
Diógenes Betat Roos
7907912af0 Correct the NewLine character 2023-08-17 14:51:54 +00:00