mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-07-03 06:00:52 +00:00
parent
a04b2623b0
commit
fe5601ab9b
@ -524,6 +524,22 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
||||
throw new RuntimeException("No OAuth2 authentication configured!");
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to set the credentials of a public client for the first OAuth2 authentication.
|
||||
*
|
||||
* @param clientId the client ID
|
||||
* @return a {@link org.openapitools.client.ApiClient} object.
|
||||
*/
|
||||
public ApiClient setOauthCredentialsForPublicClient(String clientId) {
|
||||
for (Authentication auth : authentications.values()) {
|
||||
if (auth instanceof OAuth) {
|
||||
((OAuth) auth).setCredentialsForPublicClient(clientId, isDebugging());
|
||||
return this;
|
||||
}
|
||||
}
|
||||
throw new RuntimeException("No OAuth2 authentication configured!");
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to set the password flow for the first OAuth2 authentication.
|
||||
*
|
||||
|
@ -158,6 +158,19 @@ public class OAuth implements Authentication {
|
||||
return this;
|
||||
}
|
||||
|
||||
public OAuth setCredentialsForPublicClient(String clientId, Boolean debug) {
|
||||
if (Boolean.TRUE.equals(debug)) {
|
||||
service = new ServiceBuilder(clientId)
|
||||
.apiSecretIsEmptyStringUnsafe().debug()
|
||||
.build(authApi);
|
||||
} else {
|
||||
service = new ServiceBuilder(clientId)
|
||||
.apiSecretIsEmptyStringUnsafe()
|
||||
.build(authApi);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public OAuth usePasswordFlow(String username, String password) {
|
||||
this.flow = OAuthFlow.PASSWORD;
|
||||
this.username = username;
|
||||
|
@ -524,6 +524,22 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
||||
throw new RuntimeException("No OAuth2 authentication configured!");
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to set the credentials of a public client for the first OAuth2 authentication.
|
||||
*
|
||||
* @param clientId the client ID
|
||||
* @return a {@link org.openapitools.client.ApiClient} object.
|
||||
*/
|
||||
public ApiClient setOauthCredentialsForPublicClient(String clientId) {
|
||||
for (Authentication auth : authentications.values()) {
|
||||
if (auth instanceof OAuth) {
|
||||
((OAuth) auth).setCredentialsForPublicClient(clientId, isDebugging());
|
||||
return this;
|
||||
}
|
||||
}
|
||||
throw new RuntimeException("No OAuth2 authentication configured!");
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to set the password flow for the first OAuth2 authentication.
|
||||
*
|
||||
|
@ -158,6 +158,19 @@ public class OAuth implements Authentication {
|
||||
return this;
|
||||
}
|
||||
|
||||
public OAuth setCredentialsForPublicClient(String clientId, Boolean debug) {
|
||||
if (Boolean.TRUE.equals(debug)) {
|
||||
service = new ServiceBuilder(clientId)
|
||||
.apiSecretIsEmptyStringUnsafe().debug()
|
||||
.build(authApi);
|
||||
} else {
|
||||
service = new ServiceBuilder(clientId)
|
||||
.apiSecretIsEmptyStringUnsafe()
|
||||
.build(authApi);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public OAuth usePasswordFlow(String username, String password) {
|
||||
this.flow = OAuthFlow.PASSWORD;
|
||||
this.username = username;
|
||||
|
@ -446,6 +446,22 @@ public class ApiClient extends JavaTimeFormatter {
|
||||
throw new RuntimeException("No OAuth2 authentication configured!");
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to set the credentials of a public client for the first OAuth2 authentication.
|
||||
*
|
||||
* @param clientId the client ID
|
||||
* @return a {@link org.openapitools.client.ApiClient} object.
|
||||
*/
|
||||
public ApiClient setOauthCredentialsForPublicClient(String clientId) {
|
||||
for (Authentication auth : authentications.values()) {
|
||||
if (auth instanceof OAuth) {
|
||||
((OAuth) auth).setCredentialsForPublicClient(clientId, isDebugging());
|
||||
return this;
|
||||
}
|
||||
}
|
||||
throw new RuntimeException("No OAuth2 authentication configured!");
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to set the password flow for the first OAuth2 authentication.
|
||||
*
|
||||
|
@ -169,6 +169,19 @@ public class OAuth implements Authentication {
|
||||
return this;
|
||||
}
|
||||
|
||||
public OAuth setCredentialsForPublicClient(String clientId, Boolean debug) {
|
||||
if (Boolean.TRUE.equals(debug)) {
|
||||
service = new ServiceBuilder(clientId)
|
||||
.apiSecretIsEmptyStringUnsafe().debug()
|
||||
.build(authApi);
|
||||
} else {
|
||||
service = new ServiceBuilder(clientId)
|
||||
.apiSecretIsEmptyStringUnsafe()
|
||||
.build(authApi);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public OAuth usePasswordFlow(String username, String password) {
|
||||
this.flow = OAuthFlow.PASSWORD;
|
||||
this.username = username;
|
||||
|
@ -446,6 +446,22 @@ public class ApiClient extends JavaTimeFormatter {
|
||||
throw new RuntimeException("No OAuth2 authentication configured!");
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to set the credentials of a public client for the first OAuth2 authentication.
|
||||
*
|
||||
* @param clientId the client ID
|
||||
* @return a {@link org.openapitools.client.ApiClient} object.
|
||||
*/
|
||||
public ApiClient setOauthCredentialsForPublicClient(String clientId) {
|
||||
for (Authentication auth : authentications.values()) {
|
||||
if (auth instanceof OAuth) {
|
||||
((OAuth) auth).setCredentialsForPublicClient(clientId, isDebugging());
|
||||
return this;
|
||||
}
|
||||
}
|
||||
throw new RuntimeException("No OAuth2 authentication configured!");
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to set the password flow for the first OAuth2 authentication.
|
||||
*
|
||||
|
@ -169,6 +169,19 @@ public class OAuth implements Authentication {
|
||||
return this;
|
||||
}
|
||||
|
||||
public OAuth setCredentialsForPublicClient(String clientId, Boolean debug) {
|
||||
if (Boolean.TRUE.equals(debug)) {
|
||||
service = new ServiceBuilder(clientId)
|
||||
.apiSecretIsEmptyStringUnsafe().debug()
|
||||
.build(authApi);
|
||||
} else {
|
||||
service = new ServiceBuilder(clientId)
|
||||
.apiSecretIsEmptyStringUnsafe()
|
||||
.build(authApi);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public OAuth usePasswordFlow(String username, String password) {
|
||||
this.flow = OAuthFlow.PASSWORD;
|
||||
this.username = username;
|
||||
|
@ -530,6 +530,22 @@ public class ApiClient extends JavaTimeFormatter {
|
||||
throw new RuntimeException("No OAuth2 authentication configured!");
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to set the credentials of a public client for the first OAuth2 authentication.
|
||||
*
|
||||
* @param clientId the client ID
|
||||
* @return a {@link org.openapitools.client.ApiClient} object.
|
||||
*/
|
||||
public ApiClient setOauthCredentialsForPublicClient(String clientId) {
|
||||
for (Authentication auth : authentications.values()) {
|
||||
if (auth instanceof OAuth) {
|
||||
((OAuth) auth).setCredentialsForPublicClient(clientId, isDebugging());
|
||||
return this;
|
||||
}
|
||||
}
|
||||
throw new RuntimeException("No OAuth2 authentication configured!");
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to set the password flow for the first OAuth2 authentication.
|
||||
*
|
||||
|
@ -169,6 +169,19 @@ public class OAuth implements Authentication {
|
||||
return this;
|
||||
}
|
||||
|
||||
public OAuth setCredentialsForPublicClient(String clientId, Boolean debug) {
|
||||
if (Boolean.TRUE.equals(debug)) {
|
||||
service = new ServiceBuilder(clientId)
|
||||
.apiSecretIsEmptyStringUnsafe().debug()
|
||||
.build(authApi);
|
||||
} else {
|
||||
service = new ServiceBuilder(clientId)
|
||||
.apiSecretIsEmptyStringUnsafe()
|
||||
.build(authApi);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public OAuth usePasswordFlow(String username, String password) {
|
||||
this.flow = OAuthFlow.PASSWORD;
|
||||
this.username = username;
|
||||
|
@ -530,6 +530,22 @@ public class ApiClient extends JavaTimeFormatter {
|
||||
throw new RuntimeException("No OAuth2 authentication configured!");
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to set the credentials of a public client for the first OAuth2 authentication.
|
||||
*
|
||||
* @param clientId the client ID
|
||||
* @return a {@link org.openapitools.client.ApiClient} object.
|
||||
*/
|
||||
public ApiClient setOauthCredentialsForPublicClient(String clientId) {
|
||||
for (Authentication auth : authentications.values()) {
|
||||
if (auth instanceof OAuth) {
|
||||
((OAuth) auth).setCredentialsForPublicClient(clientId, isDebugging());
|
||||
return this;
|
||||
}
|
||||
}
|
||||
throw new RuntimeException("No OAuth2 authentication configured!");
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to set the password flow for the first OAuth2 authentication.
|
||||
*
|
||||
|
@ -169,6 +169,19 @@ public class OAuth implements Authentication {
|
||||
return this;
|
||||
}
|
||||
|
||||
public OAuth setCredentialsForPublicClient(String clientId, Boolean debug) {
|
||||
if (Boolean.TRUE.equals(debug)) {
|
||||
service = new ServiceBuilder(clientId)
|
||||
.apiSecretIsEmptyStringUnsafe().debug()
|
||||
.build(authApi);
|
||||
} else {
|
||||
service = new ServiceBuilder(clientId)
|
||||
.apiSecretIsEmptyStringUnsafe()
|
||||
.build(authApi);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public OAuth usePasswordFlow(String username, String password) {
|
||||
this.flow = OAuthFlow.PASSWORD;
|
||||
this.username = username;
|
||||
|
Loading…
x
Reference in New Issue
Block a user