Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
import com.linecorp.armeria.common.auth.oauth2.GrantedOAuth2AccessToken;
import com.linecorp.armeria.common.util.Exceptions;

final class AccessTokenClient implements TokenClient {
public final class AccessTokenClient implements TokenClient {
Copy link
Copy Markdown
Contributor

@ikhoon ikhoon Nov 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding the public keyword doesn’t necessarily mean the user can use it right away.

  • TokenClient client is still in private.
  • There are no public constructors or builder methods to create AccessTokenClient or `RoleTokenClient.

Suggestion:

  • Should we only make TokenClient public class? Let's keep AccessTokenClient and RoleTokenClient package-private.
  • Override as method to obtain an instance of TokenClient in AthenzClient?

Copy link
Copy Markdown
Contributor

@ikhoon ikhoon Nov 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);
        }
    }

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for review ! I completely misunderstood.


private final AtomicBoolean tlsKeyPairUpdated = new AtomicBoolean();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import com.linecorp.armeria.common.util.Exceptions;
import com.linecorp.armeria.common.util.UnmodifiableFuture;

final class RoleTokenClient implements TokenClient {
public final class RoleTokenClient implements TokenClient {

static final Joiner ROLE_JOINER = Joiner.on(",");

Expand Down
Loading