Skip to content
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

[REQ] Support for a oauth access token supplier in Java RestClient clients #20370

Open
RockyMM opened this issue Dec 23, 2024 · 0 comments
Open

Comments

@RockyMM
Copy link
Contributor

RockyMM commented Dec 23, 2024

Is your feature request related to a problem? Please describe.

It would be nice that, similarly to RestTemplate clients (thanks to work done in #19002), that RestClient clients also have a helper method to set the access token supplier, without interating through the authentications object.

Describe the solution you'd like

Continue work in #19943 and add

public void setAccessToken(Supplier<String> tokenSupplier) {
        for (Authentication auth : authentications.values()) {
            if (auth instanceof OAuth) {
                ((OAuth) auth).setAccessToken(tokenSupplier);
                return;
            }
        }
}

to modules/openapi-generator/src/main/resources/Java/libraries/restclient/ApiClient.mustache

Describe alternatives you've considered

Iterate through he authentications object.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant