forked from loafle/openapi-generator-original
[Java] [Kotlin] (#14876) fix use of isBasic conditions - do not use HttpBearerAuth (or HttpBasicAuth) for other http auth methods (such as http signature auth or custom schemes) (#15220)
* remove http signature from test yaml when not supported * do not use HttpBearerAuth for signature auth or other unsupported http auth method ignore unsupported http auth method unless generated code would not compile (in which case, an exception is thrown) * [Java] fix use of isBasic condition * [kotlin] fix use of isBasic condition
This commit is contained in:
@@ -275,12 +275,7 @@ Authentication schemes defined for the API:
|
||||
<a id="bearer_test"></a>
|
||||
### bearer_test
|
||||
|
||||
- **Type**: HTTP basic authentication
|
||||
|
||||
<a id="http_signature_test"></a>
|
||||
### http_signature_test
|
||||
|
||||
- **Type**: HTTP basic authentication
|
||||
- **Type**: HTTP Bearer Token authentication (JWT)
|
||||
|
||||
|
||||
## Recommendation
|
||||
|
||||
@@ -61,7 +61,6 @@ paths:
|
||||
"405":
|
||||
description: Invalid input
|
||||
security:
|
||||
- http_signature_test: []
|
||||
- petstore_auth:
|
||||
- write:pets
|
||||
- read:pets
|
||||
@@ -83,7 +82,6 @@ paths:
|
||||
"405":
|
||||
description: Validation exception
|
||||
security:
|
||||
- http_signature_test: []
|
||||
- petstore_auth:
|
||||
- write:pets
|
||||
- read:pets
|
||||
@@ -133,7 +131,6 @@ paths:
|
||||
"400":
|
||||
description: Invalid status value
|
||||
security:
|
||||
- http_signature_test: []
|
||||
- petstore_auth:
|
||||
- write:pets
|
||||
- read:pets
|
||||
@@ -175,7 +172,6 @@ paths:
|
||||
"400":
|
||||
description: Invalid tag value
|
||||
security:
|
||||
- http_signature_test: []
|
||||
- petstore_auth:
|
||||
- write:pets
|
||||
- read:pets
|
||||
@@ -2399,7 +2395,4 @@ components:
|
||||
bearerFormat: JWT
|
||||
scheme: bearer
|
||||
type: http
|
||||
http_signature_test:
|
||||
scheme: signature
|
||||
type: http
|
||||
|
||||
|
||||
@@ -42,7 +42,6 @@ public class Example {
|
||||
OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth");
|
||||
petstore_auth.setAccessToken("YOUR ACCESS TOKEN");
|
||||
|
||||
|
||||
PetApi apiInstance = new PetApi(defaultClient);
|
||||
Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store
|
||||
try {
|
||||
@@ -70,7 +69,7 @@ null (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test)
|
||||
[petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
@@ -177,7 +176,6 @@ public class Example {
|
||||
OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth");
|
||||
petstore_auth.setAccessToken("YOUR ACCESS TOKEN");
|
||||
|
||||
|
||||
PetApi apiInstance = new PetApi(defaultClient);
|
||||
List<String> status = Arrays.asList("available"); // List<String> | Status values that need to be considered for filter
|
||||
try {
|
||||
@@ -206,7 +204,7 @@ public class Example {
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test)
|
||||
[petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
@@ -246,7 +244,6 @@ public class Example {
|
||||
OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth");
|
||||
petstore_auth.setAccessToken("YOUR ACCESS TOKEN");
|
||||
|
||||
|
||||
PetApi apiInstance = new PetApi(defaultClient);
|
||||
List<String> tags = Arrays.asList(); // List<String> | Tags to filter by
|
||||
try {
|
||||
@@ -275,7 +272,7 @@ public class Example {
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test)
|
||||
[petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
@@ -386,7 +383,6 @@ public class Example {
|
||||
OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth");
|
||||
petstore_auth.setAccessToken("YOUR ACCESS TOKEN");
|
||||
|
||||
|
||||
PetApi apiInstance = new PetApi(defaultClient);
|
||||
Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store
|
||||
try {
|
||||
@@ -414,7 +410,7 @@ null (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test)
|
||||
[petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
|
||||
@@ -152,7 +152,6 @@ public class ApiClient {
|
||||
authentications.put("api_key_query", new ApiKeyAuth("query", "api_key_query"));
|
||||
authentications.put("http_basic_test", new HttpBasicAuth());
|
||||
authentications.put("bearer_test", new HttpBearerAuth("bearer"));
|
||||
authentications.put("http_signature_test", new HttpBearerAuth("signature"));
|
||||
// Prevent the authentications from being modified.
|
||||
authentications = Collections.unmodifiableMap(authentications);
|
||||
}
|
||||
@@ -173,7 +172,6 @@ public class ApiClient {
|
||||
authentications.put("api_key_query", new ApiKeyAuth("query", "api_key_query"));
|
||||
authentications.put("http_basic_test", new HttpBasicAuth());
|
||||
authentications.put("bearer_test", new HttpBearerAuth("bearer"));
|
||||
authentications.put("http_signature_test", new HttpBearerAuth("signature"));
|
||||
// Prevent the authentications from being modified.
|
||||
authentications = Collections.unmodifiableMap(authentications);
|
||||
}
|
||||
@@ -243,7 +241,6 @@ public class ApiClient {
|
||||
authentications.put("api_key_query", new ApiKeyAuth("query", "api_key_query"));
|
||||
authentications.put("http_basic_test", new HttpBasicAuth());
|
||||
authentications.put("bearer_test", new HttpBearerAuth("bearer"));
|
||||
authentications.put("http_signature_test", new HttpBearerAuth("signature"));
|
||||
|
||||
// Prevent the authentications from being modified.
|
||||
authentications = Collections.unmodifiableMap(authentications);
|
||||
|
||||
@@ -128,7 +128,7 @@ public class PetApi {
|
||||
localVarHeaderParams.put("Content-Type", localVarContentType);
|
||||
}
|
||||
|
||||
String[] localVarAuthNames = new String[] { "petstore_auth", "http_signature_test" };
|
||||
String[] localVarAuthNames = new String[] { "petstore_auth" };
|
||||
return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
|
||||
}
|
||||
|
||||
@@ -378,7 +378,7 @@ public class PetApi {
|
||||
localVarHeaderParams.put("Content-Type", localVarContentType);
|
||||
}
|
||||
|
||||
String[] localVarAuthNames = new String[] { "petstore_auth", "http_signature_test" };
|
||||
String[] localVarAuthNames = new String[] { "petstore_auth" };
|
||||
return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
|
||||
}
|
||||
|
||||
@@ -511,7 +511,7 @@ public class PetApi {
|
||||
localVarHeaderParams.put("Content-Type", localVarContentType);
|
||||
}
|
||||
|
||||
String[] localVarAuthNames = new String[] { "petstore_auth", "http_signature_test" };
|
||||
String[] localVarAuthNames = new String[] { "petstore_auth" };
|
||||
return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
|
||||
}
|
||||
|
||||
@@ -778,7 +778,7 @@ public class PetApi {
|
||||
localVarHeaderParams.put("Content-Type", localVarContentType);
|
||||
}
|
||||
|
||||
String[] localVarAuthNames = new String[] { "petstore_auth", "http_signature_test" };
|
||||
String[] localVarAuthNames = new String[] { "petstore_auth" };
|
||||
return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user