Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,22 @@ public ApiClient setOauthCredentials(String clientId, String clientSecret) {
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.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,19 @@ public OAuth setCredentials(String clientId, String clientSecret, Boolean debug)
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,22 @@ public ApiClient setOauthCredentials(String clientId, String clientSecret) {
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.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,19 @@ public OAuth setCredentials(String clientId, String clientSecret, Boolean debug)
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,22 @@ public ApiClient setOauthCredentials(String clientId, String clientSecret) {
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.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,19 @@ public OAuth setCredentials(String clientId, String clientSecret, Boolean debug)
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,22 @@ public ApiClient setOauthCredentials(String clientId, String clientSecret) {
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.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,19 @@ public OAuth setCredentials(String clientId, String clientSecret, Boolean debug)
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;
Expand Down