-
Notifications
You must be signed in to change notification settings - Fork 16
feat: add HTTP URL-connection support for Authlete API v3 #117
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
- Introduce AuthleteApiImplV3 using HttpURLConnection for API v3 - Introduce AuthleteApiBasicImpl to leverage URLConnection - Update AuthleteApiFactory to select v3 implementation - Migrate and streamline existing AuthleteApiImpl methods to align with v3 - Enhance RequestableScopes enum for new scope handling - Bump dependencies in pom.xml
…ception - Add deleteApiResponse helper in AuthleteApiBasicImpl to catch HTTP 403 and parse its JSON payload into an ApiResponse - Refactor communicate() to only throw on HTTP errors when responseClass != null (so DELETE calls return error bodies rather than exceptions) - Override deleteClient and deleteService in AuthleteApiImplV3 to use deleteApiResponse for delete operations - Remove the special-case 403 block from communicate(), consolidating error handling through the new helper
hidebike712
reviewed
Jun 12, 2025
src/main/java/com/authlete/common/api/AuthleteApiBasicImpl.java
Outdated
Show resolved
Hide resolved
src/main/java/com/authlete/common/api/AuthleteApiBasicImpl.java
Outdated
Show resolved
Hide resolved
src/main/java/com/authlete/common/api/AuthleteApiBasicImpl.java
Outdated
Show resolved
Hide resolved
src/main/java/com/authlete/common/api/AuthleteApiBasicImpl.java
Outdated
Show resolved
Hide resolved
src/main/java/com/authlete/common/api/AuthleteApiBasicImpl.java
Outdated
Show resolved
Hide resolved
- Organize imports in AuthleteApiBasicImpl - Fix method declaration spacing - Update copyright years to 2025 - Add newlines for better readability
- Remove callGetApiNullFor404 and callGetApiParse404 methods since their functionality is already covered by callApiWithNotFoundHandling. This simplifies the API by removing duplicate methods and encourages direct use of the more flexible callApiWithNotFoundHandling method.
hidebike712
reviewed
Jun 26, 2025
src/main/java/com/authlete/common/api/AuthleteApiBasicImpl.java
Outdated
Show resolved
Hide resolved
src/main/java/com/authlete/common/api/AuthleteApiBasicImpl.java
Outdated
Show resolved
Hide resolved
- Replace star imports with explicit imports in AuthleteApiImpl and AuthleteApiImplV3 - Fix local variable naming conventions (value_ → descriptive names) in MapUtils - Correct control flow issues: missing braces in Utils.java and fall-through in CLI.java - Fix whitespace after comma violations across assurance package and other files - Add Checkstyle and SpotBugs configuration with custom rules - Update README.md with code quality tools documentation - Configure maven-checkstyle-plugin and spotbugs-maven-plugin in pom.xml
- Update SpotBugs Maven plugin to version 4.9.3.2 - Move reporting configuration from maven-site-plugin to proper <reporting> section - Fix regex syntax error in Helper.java (remove space in quantifier {1, } → {1,}) - Add proper <reporting> section with maven-javadoc-plugin, maven-checkstyle-plugin, and spotbugs-maven-plugin - Configure SpotBugs to use XML filter files (mvn-config/spotbugs/spotbugs-include.xml and spotbugs-exclude.xml)
- Replace hypothetical API result codes with empty ApiResponse objects
hidebike712
reviewed
Jul 2, 2025
Thanks for your changes. I've reviewed the code. Would be great if can chenck them and an unresolved discussion. |
Thank you! I think it looks good. |
I’ve tested the authorization code flow and introspection—it’s working fine. |
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.
References
Context / Summary
Until now this library only offered JAX-RS and Jakarta-based clients for Authlete API v3, which adds extra dependencies and inconsistent error-handling. This PR introduces a pure-Java
HttpURLConnection
-based client for v3 and refactors the existing v2 client to share all connection, serialization, timeout, and DPoP logic in a newAuthleteApiBasicImpl
base class. Consumers can now switch between v2 and v3 clients simply by changingapiVersion
in their configuration, with zero behavioral change to v2 and full support for every v3 endpoint.Description / Changes Made
AuthleteApiBasicImpl
callService*Api
methods with a small hierarchy ofApiCaller
helper classes (ServiceGetApiCaller
,ServicePostApiCaller
,ServiceDeleteApiCaller
) and a singleexecuteApiCall(…)
entry pointAuthleteApiBasicImpl
PostApiCaller
,GetApiCaller
orDeleteApiCaller
for each endpoint for consistent invocation and error propagation/api/client/extension/requestable_scopes/*
APIs (GET, POST, DELETE)AuthleteApiImplV3
in the list of known v3 implementationsnimbus-jose-jwt
to 9.31 (propertynimbus.version
) to support latest JOSE/JWT features required for DPoPSchema Changes
None
Breaking Changes
None. All existing v2 behavior is preserved; v3 is opt-in via
AuthleteConfiguration.setApiVersion("V3")
.Testing Instructions
mvn clean verify
to exercise existing unit tests.authorization
→token
→introspection
→userinfo
) and verify theHttpURLConnection
-based client works end-to-end.apiVersion=V2
and rerun the same flows to confirm no regressions in the v2 client.Screenshots / Snippets
Added Tests?
No new tests in this PR.
Related PRs
None