Open
Conversation
Contributor
ikhoon
reviewed
Nov 4, 2025
| import com.linecorp.armeria.common.util.Exceptions; | ||
|
|
||
| final class AccessTokenClient implements TokenClient { | ||
| public final class AccessTokenClient implements TokenClient { |
Contributor
There was a problem hiding this comment.
Adding the public keyword doesn’t necessarily mean the user can use it right away.
TokenClientclient is still in private.- There are no public constructors or builder methods to create
AccessTokenClientor `RoleTokenClient.
Suggestion:
- Should we only make
TokenClientpublic class? Let's keepAccessTokenClientandRoleTokenClientpackage-private. Overrideasmethod to obtain an instance ofTokenClientinAthenzClient?
Contributor
There was a problem hiding this comment.
I realized that overriding as is not a feasible solution as AthenzClient.newDecorator() returns a function. Instead, let's add a factory method TokenClient.
public interface TokenClient {
TokenClient of(....) {
if (tokenType.isRoleToken()) {
return new RoleTokenClient(ztsBaseClient, domainName, roleNames, refreshBefore);
} else {
return new AccessTokenClient(ztsBaseClient, domainName, roleNames, refreshBefore);
}
}
Contributor
Author
There was a problem hiding this comment.
Thanks for review ! I completely misunderstood.
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 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.
Motivation:
AccessTokenClient and RoleTokenClient are currently declared as package-private, preventing users of the Armeria library from directly instantiating or using these classes.
As wrote in #6431, some users may want to obtain only the Athenz token for use with non-Armeria clients.
This PR provides flexibility by exposing these classes as public API, allowing users to fetch tokens directly.
Modifications:
armeria/athenz/src/main/java/com/linecorp/armeria/client/athenz/AccessTokenClient.javaChanged final class AccessTokenClient to public final class AccessTokenClient.
armeria/athenz/src/main/java/com/linecorp/armeria/client/athenz/RoleTokenClient.javaChanged final class RoleTokenClient to public final class RoleTokenClient.
Result:
Closes #6431
After this PR is merged, users will be able to directly import and instantiate
com.linecorp.armeria.client.athenz.AccessTokenClientandcom.linecorp.armeria.client.athenz.RoleTokenClient.