Merge remote-tracking branch 'origin/master' into 7.0.x

This commit is contained in:
William Cheng
2022-11-01 21:01:06 +08:00
1977 changed files with 36993 additions and 6648 deletions

View File

@@ -99,9 +99,9 @@ if(hasProperty('target') && target == 'android') {
ext {
swagger_annotations_version = "1.6.5"
jackson_version = "2.13.2"
jackson_databind_version = "2.13.2.2"
jackson_databind_nullable_version = "0.2.3"
jackson_version = "2.13.4"
jackson_databind_version = "2.13.4.2"
jackson_databind_nullable_version = "0.2.4"
jakarta_annotation_version = "1.3.5"
jersey_version = "2.35"
junit_version = "5.8.2"

View File

@@ -18,9 +18,9 @@ lazy val root = (project in file(".")).
"org.glassfish.jersey.connectors" % "jersey-apache-connector" % "2.35",
"com.fasterxml.jackson.core" % "jackson-core" % "2.13.2" % "compile",
"com.fasterxml.jackson.core" % "jackson-annotations" % "2.13.2" % "compile",
"com.fasterxml.jackson.core" % "jackson-databind" % "2.13.2.2" % "compile",
"com.fasterxml.jackson.core" % "jackson-databind" % "2.13.4.1" % "compile",
"com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.13.2" % "compile",
"org.openapitools" % "jackson-databind-nullable" % "0.2.3" % "compile",
"org.openapitools" % "jackson-databind-nullable" % "0.2.4" % "compile",
"com.github.scribejava" % "scribejava-apis" % "8.3.1" % "compile",
"org.tomitribe" % "tomitribe-http-signatures" % "1.7" % "compile",
"jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile",

View File

@@ -345,9 +345,9 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<swagger-annotations-version>1.6.5</swagger-annotations-version>
<jersey-version>2.35</jersey-version>
<jackson-version>2.13.2</jackson-version>
<jackson-databind-version>2.13.2.2</jackson-databind-version>
<jackson-databind-nullable-version>0.2.3</jackson-databind-nullable-version>
<jackson-version>2.13.4</jackson-version>
<jackson-databind-version>2.13.4.2</jackson-databind-version>
<jackson-databind-nullable-version>0.2.4</jackson-databind-nullable-version>
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
<junit-version>5.8.2</junit-version>
<http-signature-version>1.7</http-signature-version>

View File

@@ -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.
*

View File

@@ -42,7 +42,7 @@ public class ServerConfiguration {
throw new IllegalArgumentException("The variable " + name + " in the server URL has invalid value " + value + ".");
}
}
url = url.replaceAll("\\{" + name + "\\}", value);
url = url.replace("{" + name + "}", value);
}
return url;
}

View File

@@ -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;