forked from loafle/openapi-generator-original
[java] Add setBearerToken method in okhttp-gson (#8200)
* Add setBearerToken method in okhttp-gson * Update generated files
This commit is contained in:
parent
49f55b0d8e
commit
13042b76ea
@ -413,6 +413,22 @@ public class ApiClient {
|
|||||||
return authentications.get(authName);
|
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.
|
* 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
0
samples/client/petstore/java/okhttp-gson-dynamicOperations/gradlew
vendored
Normal file → Executable file
@ -376,6 +376,7 @@ public class ApiClient {
|
|||||||
return authentications.get(authName);
|
return authentications.get(authName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper method to set username for the first HTTP basic authentication.
|
* Helper method to set username for the first HTTP basic authentication.
|
||||||
*
|
*
|
||||||
|
@ -365,6 +365,7 @@ public class ApiClient {
|
|||||||
return authentications.get(authName);
|
return authentications.get(authName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper method to set username for the first HTTP basic authentication.
|
* Helper method to set username for the first HTTP basic authentication.
|
||||||
*
|
*
|
||||||
|
@ -365,6 +365,7 @@ public class ApiClient {
|
|||||||
return authentications.get(authName);
|
return authentications.get(authName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper method to set username for the first HTTP basic authentication.
|
* Helper method to set username for the first HTTP basic authentication.
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user