forked from loafle/openapi-generator-original
[Java][jersey2] Fix RuntimeException when HTTP signature parameters are not configured (#6457)
* Mustache template should use invokerPackage tag to generate import * fix runtime exception when HttpSignatureAuth is not set * fix runtime exception when HttpSignatureAuth is not set
This commit is contained in:
@@ -200,8 +200,6 @@ public class ApiClient {
|
||||
{{#isHttpSignature}}
|
||||
if (auth instanceof HttpSignatureAuth) {
|
||||
authentications.put("{{name}}", auth);
|
||||
} else {
|
||||
authentications.put("{{name}}", null);
|
||||
}
|
||||
{{/isHttpSignature}}
|
||||
{{/isBasic}}
|
||||
@@ -246,10 +244,20 @@ public class ApiClient {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the base URL to the location where the OpenAPI document is being served.
|
||||
*
|
||||
* @return The base URL to the target host.
|
||||
*/
|
||||
public String getBasePath() {
|
||||
return basePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the base URL to the location where the OpenAPI document is being served.
|
||||
*
|
||||
* @param basePath The base URL to the target host.
|
||||
*/
|
||||
public ApiClient setBasePath(String basePath) {
|
||||
this.basePath = basePath;
|
||||
{{#hasOAuthMethods}}
|
||||
@@ -1281,7 +1289,7 @@ public class ApiClient {
|
||||
for (String authName : authNames) {
|
||||
Authentication auth = authentications.get(authName);
|
||||
if (auth == null) {
|
||||
throw new RuntimeException("Authentication undefined: " + authName);
|
||||
continue;
|
||||
}
|
||||
auth.applyToParams(queryParams, headerParams, cookieParams, payload, method, uri);
|
||||
}
|
||||
|
||||
@@ -167,10 +167,20 @@ public class ApiClient {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the base URL to the location where the OpenAPI document is being served.
|
||||
*
|
||||
* @return The base URL to the target host.
|
||||
*/
|
||||
public String getBasePath() {
|
||||
return basePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the base URL to the location where the OpenAPI document is being served.
|
||||
*
|
||||
* @param basePath The base URL to the target host.
|
||||
*/
|
||||
public ApiClient setBasePath(String basePath) {
|
||||
this.basePath = basePath;
|
||||
setOauthBasePath(basePath);
|
||||
@@ -1183,7 +1193,7 @@ public class ApiClient {
|
||||
for (String authName : authNames) {
|
||||
Authentication auth = authentications.get(authName);
|
||||
if (auth == null) {
|
||||
throw new RuntimeException("Authentication undefined: " + authName);
|
||||
continue;
|
||||
}
|
||||
auth.applyToParams(queryParams, headerParams, cookieParams, payload, method, uri);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user