Skip to content

Commit

Permalink
Avoid breaking change
Browse files Browse the repository at this point in the history
  • Loading branch information
rtitle committed May 8, 2024
1 parent 024b9f9 commit ad72c8b
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions codegen_java_old/templates/ApiClient.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -629,15 +629,12 @@ public class ApiClient {
* @param accessToken Access token
*/
public void setAccessToken(String accessToken) {
{{#hasOAuthMethods}}
for (Authentication auth : authentications.values()) {
if (auth instanceof OAuth) {
((OAuth) auth).setAccessToken(accessToken);
return;
}
}
{{/hasOAuthMethods}}
throw new RuntimeException("No OAuth2 authentication configured!");
/*
* Terra addition: delegate setAccessToken to setBearerToken to avoid a backwards-incompatible
* change. Many Terra services and libraries use setAccessToken, which was removed when we
* moved from oauth to oidc in our OpenAPI specs.
*/
return setBearerToken(accessToken);
}

/**
Expand Down

0 comments on commit ad72c8b

Please sign in to comment.