mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-11 08:22:45 +00:00
[Java] Generate OAuth related files only if OAuth security schema is used (#1907)
* optionally include oauth files in java client * fix java templates * fix tests * fix CI issues
This commit is contained in:
@@ -95,14 +95,14 @@ public class ApiClient {
|
||||
* @param username
|
||||
* @param password
|
||||
*/
|
||||
public ApiClient(String authName, String clientId, String secret, String username, String password) {
|
||||
this(authName);
|
||||
this.getTokenEndPoint()
|
||||
.setClientId(clientId)
|
||||
.setClientSecret(secret)
|
||||
.setUsername(username)
|
||||
.setPassword(password);
|
||||
}
|
||||
public ApiClient(String authName, String clientId, String secret, String username, String password) {
|
||||
this(authName);
|
||||
this.getTokenEndPoint()
|
||||
.setClientId(clientId)
|
||||
.setClientSecret(secret)
|
||||
.setUsername(username)
|
||||
.setPassword(password);
|
||||
}
|
||||
|
||||
public String getBasePath() {
|
||||
return basePath;
|
||||
|
||||
@@ -95,14 +95,14 @@ public class ApiClient {
|
||||
* @param username
|
||||
* @param password
|
||||
*/
|
||||
public ApiClient(String authName, String clientId, String secret, String username, String password) {
|
||||
this(authName);
|
||||
this.getTokenEndPoint()
|
||||
.setClientId(clientId)
|
||||
.setClientSecret(secret)
|
||||
.setUsername(username)
|
||||
.setPassword(password);
|
||||
}
|
||||
public ApiClient(String authName, String clientId, String secret, String username, String password) {
|
||||
this(authName);
|
||||
this.getTokenEndPoint()
|
||||
.setClientId(clientId)
|
||||
.setClientSecret(secret)
|
||||
.setUsername(username)
|
||||
.setPassword(password);
|
||||
}
|
||||
|
||||
public String getBasePath() {
|
||||
return basePath;
|
||||
|
||||
@@ -38,7 +38,6 @@ import org.openapitools.client.auth.OAuth;
|
||||
import org.openapitools.client.auth.OAuth.AccessTokenListener;
|
||||
import org.openapitools.client.auth.OAuthFlow;
|
||||
|
||||
|
||||
public class ApiClient {
|
||||
|
||||
private Map<String, Interceptor> apiAuthorizations;
|
||||
@@ -116,21 +115,21 @@ public class ApiClient {
|
||||
.setUsername(username)
|
||||
.setPassword(password);
|
||||
}
|
||||
|
||||
public void createDefaultAdapter() {
|
||||
Gson gson = new GsonBuilder()
|
||||
.setDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ")
|
||||
.registerTypeAdapter(DateTime.class, new DateTimeTypeAdapter())
|
||||
.registerTypeAdapter(LocalDate.class, new LocalDateTypeAdapter())
|
||||
.create();
|
||||
|
||||
okClient = new OkHttpClient();
|
||||
public void createDefaultAdapter() {
|
||||
Gson gson = new GsonBuilder()
|
||||
.setDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ")
|
||||
.registerTypeAdapter(DateTime.class, new DateTimeTypeAdapter())
|
||||
.registerTypeAdapter(LocalDate.class, new LocalDateTypeAdapter())
|
||||
.create();
|
||||
|
||||
adapterBuilder = new RestAdapter
|
||||
.Builder()
|
||||
.setEndpoint("http://petstore.swagger.io:80/v2")
|
||||
.setClient(new OkClient(okClient))
|
||||
.setConverter(new GsonConverterWrapper(gson));
|
||||
okClient = new OkHttpClient();
|
||||
|
||||
adapterBuilder = new RestAdapter
|
||||
.Builder()
|
||||
.setEndpoint("http://petstore.swagger.io:80/v2")
|
||||
.setClient(new OkClient(okClient))
|
||||
.setConverter(new GsonConverterWrapper(gson));
|
||||
}
|
||||
|
||||
public <S> S createService(Class<S> serviceClass) {
|
||||
|
||||
Reference in New Issue
Block a user