Commit graph

2605 commits

Author SHA1 Message Date
Max
b4de3f4e5e
Merge pull request #1086 from trheyi/main
Add OpenAPI OAuth handling in defaultGuard
2025-08-05 12:17:00 +08:00
Max
54bf6c1ed2 Add OpenAPI OAuth handling in defaultGuard
- Implemented guardOpenapiOauth function for OAuth token validation and session ID management.
- Enhanced defaultGuard to check for OpenAPI OAuth requests and process them accordingly.
- Added utility functions for access token and session ID retrieval from requests.
2025-08-05 12:16:14 +08:00
Max
dda37b93bd
Merge pull request #1085 from trheyi/main
Add OpenAPI OAuth support in guards
2025-08-05 11:37:47 +08:00
Max
f464638213 Add OpenAPI OAuth support in guards
- Introduced guardOpenapiOauth function to handle OAuth token validation and session ID retrieval.
- Updated guardCookieJWT and guardBearerJWT functions to integrate OpenAPI OAuth checks.
- Enhanced backward compatibility for existing cookie-based JWT handling.
- Added utility functions for access token and session ID extraction from requests.
2025-08-05 11:36:44 +08:00
Max
9e2ec76b11
Merge pull request #1084 from trheyi/main
Enhance hello world endpoints with query string and post payload logging
2025-08-05 09:28:54 +08:00
Max
4a2106371e Enhance hello world endpoints with query string and post payload logging
- Added functionality to capture and return the raw query string and post payload in the JSON response for both public and protected hello world endpoints.
- Improved response structure to include additional context for debugging and client-side processing.
2025-08-05 09:28:25 +08:00
Max
a7ec1d8573
Merge pull request #1083 from trheyi/main
Enhance refresh token functionality and response handling
2025-08-04 16:53:49 +08:00
Max
5657c75201 Enhance refresh token functionality and response handling
- Updated MakeRefreshToken and generateRefreshToken methods to accept an optional expiresIn parameter for customizable token expiration.
- Modified storeRefreshTokenWithScope to handle dynamic expiration times based on the provided parameter.
- Enhanced the authback function to send cookies with access and refresh tokens, including their respective expiration times.
- Updated LoginResponse structure to include RefreshTokenExpiresIn for better client-side management of token lifetimes.
- Adjusted client configuration to set default refresh token expiration duration.
2025-08-04 16:52:57 +08:00
Max
9f6ad4ab17
Merge pull request #1082 from trheyi/main
Add scope field to dynamic client registration tests
2025-08-04 11:20:11 +08:00
Max
c1b28f3b69 Add scope field to dynamic client registration tests
- Updated test cases for dynamic client registration to include a scope field with values "openid profile email".
- Ensured that tests reflect the expected behavior when scope is provided, enhancing validation coverage for client registration requests.
2025-08-04 11:19:45 +08:00
Max
4987a36f26
Merge pull request #1081 from trheyi/main
Update OAuth client configuration and ID generation methods
2025-08-04 11:06:14 +08:00
Max
4682c20903 Update OAuth client configuration and ID generation methods
- Added support for numeric ID generation in the OAuth service, replacing the previous NanoID approach for better compatibility.
- Refactored client ID and secret generation methods to be public and renamed them for consistency.
- Enhanced dynamic client registration to allow optional client ID usage.
- Updated client configuration loading to include validation and registration of clients if not found.
- Improved error handling and logging for client configuration processes.
- Adjusted tests to reflect changes in ID generation and client configuration handling.
2025-08-04 11:04:56 +08:00
Max
d55ecb06d7
Merge pull request #1080 from trheyi/main
Implement ID token signing and user fingerprint management in OAuth
2025-08-03 19:53:05 +08:00
Max
2b7040c834 Implement ID token signing and user fingerprint management in OAuth
- Added `SignIDToken` method to the OAuth service for signing ID tokens with user data and claims.
- Introduced `MakeAccessToken` and `MakeRefreshToken` methods for generating access and refresh tokens.
- Implemented user fingerprint management with `Subject` and `UserID` methods for mapping user IDs to unique NanoIDs.
- Enhanced `LoginByUserID` to generate and return OIDC tokens and access tokens during user login.
- Updated `OIDCUserInfo` mapping to include additional user attributes and improved handling of optional fields.
2025-08-03 19:51:35 +08:00
Max
06f19e0a52
Merge pull request #1079 from trheyi/main
Enhance user management functionality with IP tracking and scope retr…
2025-08-03 18:31:29 +08:00
Max
392b6bee1b Enhance user management functionality with IP tracking and scope retrieval
- Added `last_login_ip` field to the user model to track the IP address of the last login.
- Updated `UpdateUserLastLogin` method to accept an IP address parameter for logging.
- Introduced `GetUserWithScopes` method to retrieve user information along with associated scopes and permissions.
- Modified `LoginThirdParty` and `LoginByUserID` functions to include IP address handling during login processes.
- Improved user provider interface to reflect the new methods and parameters, enhancing overall user management capabilities.
2025-08-03 18:30:34 +08:00
Max
a2c4695a8c
Merge pull request #1078 from trheyi/main
Update model options to include permission field for user-related models
2025-08-03 16:00:04 +08:00
Max
8992cb9130 Update model options to include permission field for user-related models
- Added "permission": true to the option field in user, user_role, user_type, user_oauth_account, and dsl models, enhancing permission management capabilities.
- This change ensures consistency across user-related models and improves the overall functionality of the user management system.
2025-08-03 15:59:14 +08:00
Max
a93e689825
Merge pull request #1077 from trheyi/main
Refactor test data handling for improved isolation and cleanup
2025-08-03 11:17:13 +08:00
Max
757f040fd0 Refactor test data handling for improved isolation and cleanup
- Updated test cases to utilize unique client IDs and user emails with suffixes for better isolation during parallel test execution.
- Enhanced the setupTestData function to generate unique identifiers for test clients and users, preventing conflicts in concurrent test runs.
- Implemented comprehensive cleanup patterns to ensure all test data is removed after execution, improving test reliability and maintainability.
2025-08-03 11:16:46 +08:00
Max
d2d78ccb85
Merge pull request #1076 from trheyi/main
Update test data cleanup to use user_id instead of subject in oauth_t…
2025-08-03 10:35:56 +08:00
Max
1dbcdd47d4 Update test data cleanup to use user_id instead of subject in oauth_test.go
- Modified the cleanupTestData function to query by user_id, ensuring consistency with the updated user provider interface.
- This change enhances the accuracy of test data cleanup and aligns with recent refactoring efforts in user management.
2025-08-03 10:35:28 +08:00
Max
7fbfb58b78
Merge pull request #1075 from trheyi/main
Refactor user provider methods to return string IDs and update test d…
2025-08-03 10:26:17 +08:00
Max
5301023cf2 Refactor user provider methods to return string IDs and update test data handling
- Updated GetUserProvider to return an error alongside the user provider for better error handling.
- Modified CreateUser, CreateRole, and CreateType methods to return user and role IDs as strings instead of interfaces, enhancing type safety.
- Adjusted test data setup in oauth_test.go to reflect changes in user ID handling and ensure compatibility with the updated user provider interface.
- Removed unnecessary nil checks and improved assertions in tests for clarity and reliability.
2025-08-03 10:25:09 +08:00
Max
9c80dad6e1
Merge pull request #1074 from trheyi/main
Refactor provider retrieval and configuration loading for signin module
2025-08-03 08:51:25 +08:00
Max
97f053e41d Refactor provider retrieval and configuration loading for signin module
- Updated GetProvider function to retrieve providers using only the provider ID, removing locale dependency.
- Introduced a global providers map to decouple provider configurations from locale-specific settings.
- Enhanced Load function to prioritize loading provider configurations before signin configurations.
- Added new helper functions for loading providers and signin configurations, improving code organization and maintainability.
- Updated tests to reflect changes in provider handling and ensure proper functionality.
2025-08-03 08:51:03 +08:00
Max
fbd3e29ba1
Merge pull request #1073 from trheyi/main
Add lightweight existence check methods for OAuth accounts, roles, ty…
2025-08-03 07:14:39 +08:00
Max
21c7caed5d Add lightweight existence check methods for OAuth accounts, roles, types, and users
- Implemented methods to check the existence of OAuth accounts, roles, types, and users by their respective identifiers, enhancing the user provider's functionality.
- Added error handling for these methods to ensure robust feedback in case of failures.
- Updated the user provider interface to include the new existence check methods, improving overall usability and maintainability.
2025-08-03 07:14:09 +08:00
Max
1d5de18eb9
Merge pull request #1072 from trheyi/main
Implement MFA functionality in user management
2025-08-02 21:09:21 +08:00
Max
e3e4b1bb77 Implement MFA functionality in user management
- Added Multi-Factor Authentication (MFA) capabilities to the user provider, including methods for generating MFA secrets, enabling/disabling MFA, and verifying MFA codes.
- Introduced MFA configuration options, allowing customization of issuer, algorithm, digits, and recovery codes.
- Enhanced error handling for MFA operations, providing clear feedback for failures.
- Updated user model to include MFA-related fields and improved database interactions for MFA management.
- Refactored existing user provider methods to integrate MFA functionality seamlessly.
2025-08-02 21:08:37 +08:00
Max
7b5777e728
Merge pull request #1071 from trheyi/main
Implement user type and user role management
2025-08-02 19:57:36 +08:00
Max
5c96312eef Implement user type management methods and enhance user provider functionality
- Added methods for creating, retrieving, updating, and deleting user types, improving user type management capabilities.
- Introduced type field lists in DefaultUser and DefaultUserOptions for better type configuration.
- Implemented error handling for user type operations, ensuring robust feedback for failures.
- Enhanced user deletion process to clean up associated data before removing user accounts.
- Updated tests to cover new user type functionalities and ensure proper cleanup of test data.
2025-08-02 19:56:48 +08:00
Max
73846c9b9d Remove obsolete user provider implementation and associated test files
- Deleted the DefaultUser implementation and its related test file, streamlining the codebase by removing unused functionality.
- This cleanup enhances maintainability and focuses on the current user management architecture.
2025-08-02 19:28:43 +08:00
Max
d32b5e4eb6 Enhance user role management functionality and implement role-related methods
- Added role field lists to DefaultUser and DefaultUserOptions for better role configuration.
- Implemented methods for creating, retrieving, updating, and deleting user roles, improving role management capabilities.
- Enhanced error handling for role operations, ensuring robust feedback for failures.
- Introduced ClearUserRole method to remove role assignments from users, streamlining user-role management.
- Updated tests to ensure proper cleanup of role data and maintain a clean testing environment.
2025-08-02 19:27:09 +08:00
Max
1ee0bf9653
Merge pull request #1070 from trheyi/main
Refactor test user model and update subject references in tests
2025-08-02 18:58:49 +08:00
Max
80f10cd7e5 Refactor test user model and update subject references in tests
- Updated the TestUser model to align with the latest user structure, replacing the 'Subject' field with 'UserID' for consistency with the new user provider interface.
- Modified all relevant test cases to use 'UserID' instead of 'Subject' when storing tokens and refresh tokens, ensuring compatibility with the updated user model.
- Enhanced test data setup to reflect changes in user creation and management, improving overall test reliability and clarity.
2025-08-02 18:58:23 +08:00
Max
f965b32a94
Merge pull request #1069 from trheyi/main
Implement OAuth account management methods and enhance user provider …
2025-08-02 18:50:09 +08:00
Max
7442c942db Implement OAuth account management methods and enhance user provider functionality
- Added methods for creating, retrieving, updating, and deleting OAuth accounts, improving user authentication capabilities.
- Introduced default OAuth account fields and options for better configuration management.
- Enhanced error handling for OAuth account operations, ensuring robust feedback for failures.
- Updated tests to ensure unique identifiers and improved cleanup processes for test data, maintaining a clean testing environment.
2025-08-02 18:49:27 +08:00
Max
4476faf1f3
Merge pull request #1068 from trheyi/main
Update go-nanoid dependency and implement user retrieval methods
2025-08-02 18:10:33 +08:00
Max
11f69b8c38 Update go-nanoid dependency and implement user retrieval methods
- Replaced the jaevor/go-nanoid library with the updated matoous/go-nanoid/v2 for generating unique IDs.
- Implemented user retrieval methods in the user provider, including GetUsers, PaginateUsers, and CountUsers, enhancing user management capabilities.
- Improved error handling and ensured default select fields are set for user queries, streamlining the user data access process.
2025-08-02 18:10:04 +08:00
Max
bf6b1f0a60
Merge pull request #1067 from trheyi/main
Add go-nanoid dependency and refactor user provider methods
2025-08-02 17:49:36 +08:00
Max
7c332c6811 Add go-nanoid dependency and refactor user provider methods
- Added the go-nanoid library for generating unique IDs, enhancing user ID management.
- Refactored user provider methods to improve clarity and consistency, including updates to user retrieval and authentication processes.
- Adjusted user model fields to align with new ID generation strategy, ensuring compliance with best practices.
- Cleaned up code by removing obsolete test files and improving overall structure for better maintainability.
2025-08-02 17:49:03 +08:00
Max
d80b52dc22
Merge pull request #1066 from trheyi/main
Update asset metadata timestamps and remove obsolete index from user_…
2025-08-02 11:03:29 +08:00
Max
46c8fb7786 Update asset metadata timestamps and remove obsolete index from user_type model
- Updated timestamps for various asset metadata to reflect recent changes.
- Removed the obsolete index for role relationships from the user_type model, streamlining the database schema.
2025-08-02 11:02:59 +08:00
Max
4701f07c34
Merge pull request #1065 from trheyi/main
Add user_oauth_account, user_type, user_role
2025-08-02 10:54:52 +08:00
Max
6b53086e53 Add user role and type models, update user model fields
- Introduced user_role and user_type models to enhance user management capabilities.
- Updated user model fields to reference role and type identifiers, improving clarity and compliance with relational standards.
- Adjusted asset metadata timestamps and system/test model mappings to include new models, ensuring consistency across the application.
2025-08-02 10:53:59 +08:00
Max
ea4a492974 Add user_oauth_account model and update asset metadata
- Introduced the user_oauth_account model to enhance user authentication capabilities.
- Updated asset metadata timestamps for various files to reflect recent changes.
- Ensured consistency in the system and test models by including the new user_oauth_account model in both configurations.
2025-08-02 10:39:25 +08:00
Max
41e9bad9b0
Merge pull request #1064 from trheyi/main
Update user model and remove obsolete test file
2025-08-02 10:13:56 +08:00
Max
ae2b267aa1 Update user model and remove obsolete test file
- Refactored the user model to align with OIDC standards, including renaming fields for clarity and compliance.
- Updated field descriptions and added new fields for enhanced user profile management.
- Removed the obsolete test file for user-related functionality to streamline the codebase and eliminate redundancy.
2025-08-02 10:13:34 +08:00
Max
e1220f28b0
Merge pull request #1063 from trheyi/main
Implement global OAuth service and enhance cache management in Signin…
2025-08-02 08:34:52 +08:00