[java] Add setBearerToken method in okhttp-gson (#8200)

* Add setBearerToken method in okhttp-gson

* Update generated files
This commit is contained in:
agilob 2020-12-18 04:08:30 +00:00 committed by GitHub
parent 49f55b0d8e
commit 13042b76ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 19 additions and 0 deletions

View File

@ -413,6 +413,22 @@ public class ApiClient {
return authentications.get(authName);
}
{{#hasHttpBearerMethods}}
/**
* Helper method to set access token for the first Bearer authentication.
* @param bearerToken Bearer token
*/
public void setBearerToken(String bearerToken) {
for (Authentication auth : authentications.values()) {
if (auth instanceof HttpBearerAuth) {
((HttpBearerAuth) auth).setBearerToken(bearerToken);
return;
}
}
throw new RuntimeException("No Bearer authentication configured!");
}
{{/hasHttpBearerMethods}}
/**
* Helper method to set username for the first HTTP basic authentication.
*

0
samples/client/petstore/java/okhttp-gson-dynamicOperations/gradlew vendored Normal file → Executable file
View File

View File

@ -376,6 +376,7 @@ public class ApiClient {
return authentications.get(authName);
}
/**
* Helper method to set username for the first HTTP basic authentication.
*

View File

@ -365,6 +365,7 @@ public class ApiClient {
return authentications.get(authName);
}
/**
* Helper method to set username for the first HTTP basic authentication.
*

View File

@ -365,6 +365,7 @@ public class ApiClient {
return authentications.get(authName);
}
/**
* Helper method to set username for the first HTTP basic authentication.
*