This repository was archived by the owner on Nov 23, 2025. It is now read-only.
Merged
Conversation
Implement role-based authentication and authorization system
Modifies the auth service to work correctly behind the new API Gateway. This involves removing gateway-specific configurations and fixing a critical JWT signature mismatch.
Changes:
1. **Path Decoupling:**
- Removed class-level `@RequestMapping` prefixes (e.g., `/api/v1/auth`) from `AuthController` and `UserController`.
- Updated `SecurityConfig` to permit the stripped paths (e.g., `/login`, `/register`) that the service now receives from the gateway.
- This resolves the `401 Unauthorized` errors on public endpoints.
2. **JWT Signature Alignment:**
- Modified `JwtUtil` to generate the signing key using `jwtSecret.getBytes(StandardCharsets.UTF_8)` instead of `Decoders.BASE64.decode()`.
- This ensures the key generation logic matches the Go gateway's verification logic, fixing the `token signature is invalid` error.
3. **CORS Delegation:**
- Removed all `@CrossOrigin` annotations and the `CorsConfigurationSource` bean from `SecurityConfig`.
- Responsibility for CORS is now fully delegated to the API Gateway, resolving the 'multiple Access-Control-Allow-Origin headers' browser error."
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.