-
Notifications
You must be signed in to change notification settings - Fork 329
[fit] Add comprehensive HTTP client authentication support #325
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
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
Implement @requestauth annotation with multi-level authentication support for HTTP client proxy interfaces. The new authentication system supports Bearer tokens, Basic auth, API keys, and custom authentication providers. Key Features: - @requestauth annotation with support for interface, method, and parameter levels - Multiple auth types: BEARER, BASIC, API_KEY, CUSTOM - Static configuration and dynamic AuthProvider support - Flexible parameter locations: HEADER, QUERY, COOKIE - Priority system: parameter > method > interface level - Seamless integration with existing Authorization system Implementation: - AuthType enum defining supported authentication types - AuthProvider interface for dynamic authentication - RequestAuthResolver for annotation parsing - AuthDestinationSetter for request building integration - StaticAuthApplier for class/method level static auth - Extended AnnotationParser to handle multi-level auth annotations Examples and Tests: - TestAuthClient demonstrating various auth scenarios - AuthProvider examples: DynamicTokenProvider, ApiKeyProvider, CustomSignatureProvider - Server-side TestAuthServerController for auth validation - Comprehensive unit tests for resolver and setter components - Updated TestClientController with auth testing endpoints 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Close all unclosed <p> tags in JavaDoc comments to ensure proper HTML validation and documentation rendering. This improves code documentation quality and maintains consistent JavaDoc formatting standards. Changes: - Fixed unclosed <p> tags in RequestAuth annotation - Fixed unclosed <p> tags in AuthType enum - Fixed unclosed <p> tags in AuthProvider interface - Fixed unclosed <p> tags in RequestAuthResolver class - Fixed unclosed <p> tags in StaticAuthApplier class - Fixed unclosed <p> tags in AuthDestinationSetter class - Fixed unclosed <p> tags in TestAuthServerController class - Removed OPTIMIZATION_SUMMARY.md file as requested 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Fix the server connectivity check in run_tests.sh to use an actual existing endpoint instead of the non-existent root path. The script was trying to access /http-server/auth which doesn't exist on the server, causing HttpHandlerNotFoundException errors. Changes: - Modified check_server() function to use /bearer-static endpoint for connectivity check - Added HEAD request (-I flag) to avoid unnecessary response body processing - Prevents false server connection failures during test execution 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Remove the complex server connectivity check that was causing HTTP handler not found errors. The script now directly proceeds to actual testing, which will naturally fail with clear error messages if the server is not running. Changes: - Replaced check_server() with simple show_server_info() function - Removed all network probing logic (nc, telnet, curl connectivity tests) - Simplified startup - script now shows server info and proceeds to tests - Tests themselves will indicate if server is unreachable with clearer errors This approach is more reliable and avoids accessing non-existent endpoints that trigger HttpHandlerNotFoundException in the server logs. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
🔗 相关问题 / Related Issue
Issue 链接 / Issue Link: #327 👈👈
📋 变更类型 / Type of Change
📝 变更目的 / Purpose of the Change
为 FIT Framework 的 HTTP 客户端添加全面的鉴权支持,通过注解方式提供多种鉴权方式的配置能力。
📋 主要变更 / Brief Changelog
核心功能
架构组件
AuthType枚举:定义支持的鉴权类型AuthProvider接口:支持动态鉴权逻辑RequestAuthResolver:注解解析器AuthDestinationSetter:请求鉴权信息设置器StaticAuthApplier:静态鉴权信息应用器特性亮点
📋 更新日志
新增
修复
<p>标签文档
AUTH_USAGE_GUIDE.md:完整使用指南CURL_TEST_EXAMPLES.md:详细测试用例run_tests.sh:功能测试脚本🧪 验证变更 / Verifying this Change
测试步骤 / Test Steps
cd examples/fit-example/07-http-client-proxy mvn clean install功能测试
启动测试服务器
./run_tests.sh
或分类测试
./run_tests.sh bearer # Bearer Token 测试
./run_tests.sh basic # Basic Auth 测试
./run_tests.sh apikey # API Key 测试
./run_tests.sh provider # Provider 测试
验证要点
测试覆盖 / Test Coverage
📸 截图 / Screenshots
✅ 贡献者检查清单 / Contributor Checklist
请确保你的 Pull Request 符合以下要求 / Please ensure your Pull Request meets the following requirements:
基本要求 / Basic Requirements:
代码质量 / Code Quality:
测试要求 / Testing Requirements:
mvn -B clean package -Dmaven.test.skip=true,elsa README 中的编译检查 / Basic checks passmvn clean install/ Unit tests pass文档和兼容性 / Documentation and Compatibility:
📋 附加信息 / Additional Notes
审查者注意事项 / Reviewer Notes: