mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-10 01:16:11 +00:00
[Java] Support cookie-based security schemas in Java clients (#4155)
* Adding cookie support and cookie-based AuthKeys to Java clients * Fix indentation * Revert accidental change * Updating samples * Fixing tests and regenerating samples
This commit is contained in:
@@ -84,6 +84,7 @@ public class ApiClient {
|
||||
private boolean debugging = false;
|
||||
|
||||
private HttpHeaders defaultHeaders = new HttpHeaders();
|
||||
private MultiValueMap<String, String> defaultCookies = new LinkedMultiValueMap<String, String>();
|
||||
|
||||
private String basePath = "http://petstore.swagger.io:80/v2";
|
||||
|
||||
@@ -270,6 +271,21 @@ public class ApiClient {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a default cookie.
|
||||
*
|
||||
* @param name The cookie's name
|
||||
* @param value The cookie's value
|
||||
* @return ApiClient this client
|
||||
*/
|
||||
public ApiClient addDefaultCookie(String name, String value) {
|
||||
if (defaultCookies.containsKey(name)) {
|
||||
defaultCookies.remove(name);
|
||||
}
|
||||
defaultCookies.add(name, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setDebugging(boolean debugging) {
|
||||
List<ClientHttpRequestInterceptor> currentInterceptors = this.restTemplate.getInterceptors();
|
||||
if(debugging) {
|
||||
@@ -544,6 +560,7 @@ public class ApiClient {
|
||||
* @param queryParams The query parameters
|
||||
* @param body The request body object
|
||||
* @param headerParams The header parameters
|
||||
* @param cookieParams The cookie parameters
|
||||
* @param formParams The form parameters
|
||||
* @param accept The request's Accept header
|
||||
* @param contentType The request's Content-Type header
|
||||
@@ -551,8 +568,8 @@ public class ApiClient {
|
||||
* @param returnType The return type into which to deserialize the response
|
||||
* @return ResponseEntity<T> The response of the chosen type
|
||||
*/
|
||||
public <T> ResponseEntity<T> invokeAPI(String path, HttpMethod method, MultiValueMap<String, String> queryParams, Object body, HttpHeaders headerParams, MultiValueMap<String, Object> formParams, List<MediaType> accept, MediaType contentType, String[] authNames, ParameterizedTypeReference<T> returnType) throws RestClientException {
|
||||
updateParamsForAuth(authNames, queryParams, headerParams);
|
||||
public <T> ResponseEntity<T> invokeAPI(String path, HttpMethod method, MultiValueMap<String, String> queryParams, Object body, HttpHeaders headerParams, MultiValueMap<String, String> cookieParams, MultiValueMap<String, Object> formParams, List<MediaType> accept, MediaType contentType, String[] authNames, ParameterizedTypeReference<T> returnType) throws RestClientException {
|
||||
updateParamsForAuth(authNames, queryParams, headerParams, cookieParams);
|
||||
|
||||
final UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(basePath).path(path);
|
||||
if (queryParams != null) {
|
||||
@@ -588,6 +605,8 @@ public class ApiClient {
|
||||
|
||||
addHeadersToRequest(headerParams, requestBuilder);
|
||||
addHeadersToRequest(defaultHeaders, requestBuilder);
|
||||
addCookiesToRequest(cookieParams, requestBuilder);
|
||||
addCookiesToRequest(defaultCookies, requestBuilder);
|
||||
|
||||
RequestEntity<Object> requestEntity = requestBuilder.body(selectBody(body, formParams, contentType));
|
||||
|
||||
@@ -617,6 +636,29 @@ public class ApiClient {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add cookies to the request that is being built
|
||||
* @param cookies The cookies to add
|
||||
* @param requestBuilder The current request
|
||||
*/
|
||||
protected void addCookiesToRequest(MultiValueMap<String, String> cookies, BodyBuilder requestBuilder) {
|
||||
if (!cookies.isEmpty()) {
|
||||
requestBuilder.header("Cookie", buildCookieHeader(cookies));
|
||||
}
|
||||
}
|
||||
|
||||
private String buildCookieHeader(MultiValueMap<String, String> cookies) {
|
||||
final StringBuilder cookieValue = new StringBuilder();
|
||||
String delimiter = "";
|
||||
for (final Map.Entry<String, List<String>> entry : cookies.entrySet()) {
|
||||
for (String value : entry.getValue()) {
|
||||
cookieValue.append(String.format("%s%s=%s", delimiter, entry.getKey(), entry.getValue()));
|
||||
delimiter = "; ";
|
||||
}
|
||||
}
|
||||
return cookieValue.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the RestTemplate used to make HTTP requests.
|
||||
* @return RestTemplate
|
||||
@@ -654,13 +696,13 @@ public class ApiClient {
|
||||
* @param queryParams The query parameters
|
||||
* @param headerParams The header parameters
|
||||
*/
|
||||
private void updateParamsForAuth(String[] authNames, MultiValueMap<String, String> queryParams, HttpHeaders headerParams) {
|
||||
private void updateParamsForAuth(String[] authNames, MultiValueMap<String, String> queryParams, HttpHeaders headerParams, MultiValueMap<String, String> cookieParams) {
|
||||
for (String authName : authNames) {
|
||||
Authentication auth = authentications.get(authName);
|
||||
if (auth == null) {
|
||||
throw new RestClientException("Authentication undefined: " + authName);
|
||||
}
|
||||
auth.applyToParams(queryParams, headerParams);
|
||||
auth.applyToParams(queryParams, headerParams, cookieParams);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -80,6 +80,7 @@ public class AnotherFakeApi {
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
final String[] accepts = {
|
||||
@@ -94,6 +95,6 @@ public class AnotherFakeApi {
|
||||
String[] authNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<Client> returnType = new ParameterizedTypeReference<Client>() {};
|
||||
return apiClient.invokeAPI(path, HttpMethod.PATCH, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
return apiClient.invokeAPI(path, HttpMethod.PATCH, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,6 +87,7 @@ public class FakeApi {
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
final String[] accepts = { };
|
||||
@@ -99,7 +100,7 @@ public class FakeApi {
|
||||
String[] authNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
|
||||
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
/**
|
||||
*
|
||||
@@ -128,6 +129,7 @@ public class FakeApi {
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
final String[] accepts = {
|
||||
@@ -140,7 +142,7 @@ public class FakeApi {
|
||||
String[] authNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<Boolean> returnType = new ParameterizedTypeReference<Boolean>() {};
|
||||
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
/**
|
||||
*
|
||||
@@ -169,6 +171,7 @@ public class FakeApi {
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
final String[] accepts = {
|
||||
@@ -181,7 +184,7 @@ public class FakeApi {
|
||||
String[] authNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<OuterComposite> returnType = new ParameterizedTypeReference<OuterComposite>() {};
|
||||
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
/**
|
||||
*
|
||||
@@ -210,6 +213,7 @@ public class FakeApi {
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
final String[] accepts = {
|
||||
@@ -222,7 +226,7 @@ public class FakeApi {
|
||||
String[] authNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<BigDecimal> returnType = new ParameterizedTypeReference<BigDecimal>() {};
|
||||
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
/**
|
||||
*
|
||||
@@ -251,6 +255,7 @@ public class FakeApi {
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
final String[] accepts = {
|
||||
@@ -263,7 +268,7 @@ public class FakeApi {
|
||||
String[] authNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<String> returnType = new ParameterizedTypeReference<String>() {};
|
||||
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
/**
|
||||
*
|
||||
@@ -296,6 +301,7 @@ public class FakeApi {
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
final String[] accepts = { };
|
||||
@@ -308,7 +314,7 @@ public class FakeApi {
|
||||
String[] authNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
|
||||
return apiClient.invokeAPI(path, HttpMethod.PUT, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
return apiClient.invokeAPI(path, HttpMethod.PUT, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
/**
|
||||
*
|
||||
@@ -348,6 +354,7 @@ public class FakeApi {
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
queryParams.putAll(apiClient.parameterToMultiValueMap(null, "query", query));
|
||||
@@ -362,7 +369,7 @@ public class FakeApi {
|
||||
String[] authNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
|
||||
return apiClient.invokeAPI(path, HttpMethod.PUT, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
return apiClient.invokeAPI(path, HttpMethod.PUT, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
/**
|
||||
* To test \"client\" model
|
||||
@@ -396,6 +403,7 @@ public class FakeApi {
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
final String[] accepts = {
|
||||
@@ -410,7 +418,7 @@ public class FakeApi {
|
||||
String[] authNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<Client> returnType = new ParameterizedTypeReference<Client>() {};
|
||||
return apiClient.invokeAPI(path, HttpMethod.PATCH, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
return apiClient.invokeAPI(path, HttpMethod.PATCH, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
/**
|
||||
* Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
@@ -486,6 +494,7 @@ public class FakeApi {
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
if (integer != null)
|
||||
@@ -527,7 +536,7 @@ public class FakeApi {
|
||||
String[] authNames = new String[] { "http_basic_test" };
|
||||
|
||||
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
|
||||
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
/**
|
||||
* To test enum parameters
|
||||
@@ -571,6 +580,7 @@ public class FakeApi {
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
queryParams.putAll(apiClient.parameterToMultiValueMap(ApiClient.CollectionFormat.valueOf("csv".toUpperCase(Locale.ROOT)), "enum_query_string_array", enumQueryStringArray));
|
||||
@@ -598,7 +608,7 @@ public class FakeApi {
|
||||
String[] authNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
|
||||
return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
/**
|
||||
* Fake endpoint to test group parameters (optional)
|
||||
@@ -651,6 +661,7 @@ public class FakeApi {
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
queryParams.putAll(apiClient.parameterToMultiValueMap(null, "required_string_group", requiredStringGroup));
|
||||
@@ -671,7 +682,7 @@ public class FakeApi {
|
||||
String[] authNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
|
||||
return apiClient.invokeAPI(path, HttpMethod.DELETE, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
return apiClient.invokeAPI(path, HttpMethod.DELETE, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
/**
|
||||
* test inline additionalProperties
|
||||
@@ -704,6 +715,7 @@ public class FakeApi {
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
final String[] accepts = { };
|
||||
@@ -716,7 +728,7 @@ public class FakeApi {
|
||||
String[] authNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
|
||||
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
/**
|
||||
* test json serialization of form data
|
||||
@@ -756,6 +768,7 @@ public class FakeApi {
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
if (param != null)
|
||||
@@ -773,7 +786,7 @@ public class FakeApi {
|
||||
String[] authNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
|
||||
return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
/**
|
||||
*
|
||||
@@ -834,6 +847,7 @@ public class FakeApi {
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
queryParams.putAll(apiClient.parameterToMultiValueMap(ApiClient.CollectionFormat.valueOf("csv".toUpperCase(Locale.ROOT)), "pipe", pipe));
|
||||
@@ -850,6 +864,6 @@ public class FakeApi {
|
||||
String[] authNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
|
||||
return apiClient.invokeAPI(path, HttpMethod.PUT, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
return apiClient.invokeAPI(path, HttpMethod.PUT, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,6 +80,7 @@ public class FakeClassnameTags123Api {
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
final String[] accepts = {
|
||||
@@ -94,6 +95,6 @@ public class FakeClassnameTags123Api {
|
||||
String[] authNames = new String[] { "api_key_query" };
|
||||
|
||||
ParameterizedTypeReference<Client> returnType = new ParameterizedTypeReference<Client>() {};
|
||||
return apiClient.invokeAPI(path, HttpMethod.PATCH, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
return apiClient.invokeAPI(path, HttpMethod.PATCH, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,6 +83,7 @@ public class PetApi {
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
final String[] accepts = { };
|
||||
@@ -95,7 +96,7 @@ public class PetApi {
|
||||
String[] authNames = new String[] { "petstore_auth" };
|
||||
|
||||
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
|
||||
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
/**
|
||||
* Deletes a pet
|
||||
@@ -135,6 +136,7 @@ public class PetApi {
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
if (apiKey != null)
|
||||
@@ -148,7 +150,7 @@ public class PetApi {
|
||||
String[] authNames = new String[] { "petstore_auth" };
|
||||
|
||||
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
|
||||
return apiClient.invokeAPI(path, HttpMethod.DELETE, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
return apiClient.invokeAPI(path, HttpMethod.DELETE, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
/**
|
||||
* Finds Pets by status
|
||||
@@ -184,6 +186,7 @@ public class PetApi {
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
queryParams.putAll(apiClient.parameterToMultiValueMap(ApiClient.CollectionFormat.valueOf("csv".toUpperCase(Locale.ROOT)), "status", status));
|
||||
@@ -198,7 +201,7 @@ public class PetApi {
|
||||
String[] authNames = new String[] { "petstore_auth" };
|
||||
|
||||
ParameterizedTypeReference<List<Pet>> returnType = new ParameterizedTypeReference<List<Pet>>() {};
|
||||
return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
/**
|
||||
* Finds Pets by tags
|
||||
@@ -236,6 +239,7 @@ public class PetApi {
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
queryParams.putAll(apiClient.parameterToMultiValueMap(ApiClient.CollectionFormat.valueOf("csv".toUpperCase(Locale.ROOT)), "tags", tags));
|
||||
@@ -250,7 +254,7 @@ public class PetApi {
|
||||
String[] authNames = new String[] { "petstore_auth" };
|
||||
|
||||
ParameterizedTypeReference<List<Pet>> returnType = new ParameterizedTypeReference<List<Pet>>() {};
|
||||
return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
/**
|
||||
* Find pet by ID
|
||||
@@ -291,6 +295,7 @@ public class PetApi {
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
final String[] accepts = {
|
||||
@@ -303,7 +308,7 @@ public class PetApi {
|
||||
String[] authNames = new String[] { "api_key" };
|
||||
|
||||
ParameterizedTypeReference<Pet> returnType = new ParameterizedTypeReference<Pet>() {};
|
||||
return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
/**
|
||||
* Update an existing pet
|
||||
@@ -342,6 +347,7 @@ public class PetApi {
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
final String[] accepts = { };
|
||||
@@ -354,7 +360,7 @@ public class PetApi {
|
||||
String[] authNames = new String[] { "petstore_auth" };
|
||||
|
||||
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
|
||||
return apiClient.invokeAPI(path, HttpMethod.PUT, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
return apiClient.invokeAPI(path, HttpMethod.PUT, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
/**
|
||||
* Updates a pet in the store with form data
|
||||
@@ -394,6 +400,7 @@ public class PetApi {
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
if (name != null)
|
||||
@@ -411,7 +418,7 @@ public class PetApi {
|
||||
String[] authNames = new String[] { "petstore_auth" };
|
||||
|
||||
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
|
||||
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
/**
|
||||
* uploads an image
|
||||
@@ -452,6 +459,7 @@ public class PetApi {
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
if (additionalMetadata != null)
|
||||
@@ -471,7 +479,7 @@ public class PetApi {
|
||||
String[] authNames = new String[] { "petstore_auth" };
|
||||
|
||||
ParameterizedTypeReference<ModelApiResponse> returnType = new ParameterizedTypeReference<ModelApiResponse>() {};
|
||||
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
/**
|
||||
* uploads an image (required)
|
||||
@@ -517,6 +525,7 @@ public class PetApi {
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
if (additionalMetadata != null)
|
||||
@@ -536,6 +545,6 @@ public class PetApi {
|
||||
String[] authNames = new String[] { "petstore_auth" };
|
||||
|
||||
ParameterizedTypeReference<ModelApiResponse> returnType = new ParameterizedTypeReference<ModelApiResponse>() {};
|
||||
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,6 +84,7 @@ public class StoreApi {
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
final String[] accepts = { };
|
||||
@@ -94,7 +95,7 @@ public class StoreApi {
|
||||
String[] authNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
|
||||
return apiClient.invokeAPI(path, HttpMethod.DELETE, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
return apiClient.invokeAPI(path, HttpMethod.DELETE, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
/**
|
||||
* Returns pet inventories by status
|
||||
@@ -121,6 +122,7 @@ public class StoreApi {
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
final String[] accepts = {
|
||||
@@ -133,7 +135,7 @@ public class StoreApi {
|
||||
String[] authNames = new String[] { "api_key" };
|
||||
|
||||
ParameterizedTypeReference<Map<String, Integer>> returnType = new ParameterizedTypeReference<Map<String, Integer>>() {};
|
||||
return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
/**
|
||||
* Find purchase order by ID
|
||||
@@ -174,6 +176,7 @@ public class StoreApi {
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
final String[] accepts = {
|
||||
@@ -186,7 +189,7 @@ public class StoreApi {
|
||||
String[] authNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<Order> returnType = new ParameterizedTypeReference<Order>() {};
|
||||
return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
/**
|
||||
* Place an order for a pet
|
||||
@@ -222,6 +225,7 @@ public class StoreApi {
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
final String[] accepts = {
|
||||
@@ -234,6 +238,6 @@ public class StoreApi {
|
||||
String[] authNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<Order> returnType = new ParameterizedTypeReference<Order>() {};
|
||||
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,6 +79,7 @@ public class UserApi {
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
final String[] accepts = { };
|
||||
@@ -89,7 +90,7 @@ public class UserApi {
|
||||
String[] authNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
|
||||
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
/**
|
||||
* Creates list of users with given input array
|
||||
@@ -122,6 +123,7 @@ public class UserApi {
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
final String[] accepts = { };
|
||||
@@ -132,7 +134,7 @@ public class UserApi {
|
||||
String[] authNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
|
||||
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
/**
|
||||
* Creates list of users with given input array
|
||||
@@ -165,6 +167,7 @@ public class UserApi {
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
final String[] accepts = { };
|
||||
@@ -175,7 +178,7 @@ public class UserApi {
|
||||
String[] authNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
|
||||
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
/**
|
||||
* Delete user
|
||||
@@ -213,6 +216,7 @@ public class UserApi {
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
final String[] accepts = { };
|
||||
@@ -223,7 +227,7 @@ public class UserApi {
|
||||
String[] authNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
|
||||
return apiClient.invokeAPI(path, HttpMethod.DELETE, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
return apiClient.invokeAPI(path, HttpMethod.DELETE, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
/**
|
||||
* Get user by user name
|
||||
@@ -264,6 +268,7 @@ public class UserApi {
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
final String[] accepts = {
|
||||
@@ -276,7 +281,7 @@ public class UserApi {
|
||||
String[] authNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<User> returnType = new ParameterizedTypeReference<User>() {};
|
||||
return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
/**
|
||||
* Logs user into the system
|
||||
@@ -319,6 +324,7 @@ public class UserApi {
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
queryParams.putAll(apiClient.parameterToMultiValueMap(null, "username", username));
|
||||
@@ -334,7 +340,7 @@ public class UserApi {
|
||||
String[] authNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<String> returnType = new ParameterizedTypeReference<String>() {};
|
||||
return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
/**
|
||||
* Logs out current logged in user session
|
||||
@@ -360,6 +366,7 @@ public class UserApi {
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
final String[] accepts = { };
|
||||
@@ -370,7 +377,7 @@ public class UserApi {
|
||||
String[] authNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
|
||||
return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
/**
|
||||
* Updated user
|
||||
@@ -415,6 +422,7 @@ public class UserApi {
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
final String[] accepts = { };
|
||||
@@ -425,6 +433,6 @@ public class UserApi {
|
||||
String[] authNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
|
||||
return apiClient.invokeAPI(path, HttpMethod.PUT, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
return apiClient.invokeAPI(path, HttpMethod.PUT, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ public class ApiKeyAuth implements Authentication {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyToParams(MultiValueMap<String, String> queryParams, HttpHeaders headerParams) {
|
||||
public void applyToParams(MultiValueMap<String, String> queryParams, HttpHeaders headerParams, MultiValueMap<String, String> cookieParams) {
|
||||
if (apiKey == null) {
|
||||
return;
|
||||
}
|
||||
@@ -55,6 +55,8 @@ public class ApiKeyAuth implements Authentication {
|
||||
queryParams.add(paramName, value);
|
||||
} else if (location.equals("header")) {
|
||||
headerParams.add(paramName, value);
|
||||
}
|
||||
} else if (location.equals("cookie")) {
|
||||
cookieParams.add(paramName, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,10 +4,11 @@ import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
|
||||
public interface Authentication {
|
||||
/**
|
||||
/**
|
||||
* Apply authentication settings to header and / or query parameters.
|
||||
* @param queryParams The query parameters for the request
|
||||
* @param queryParams The query parameters for the request
|
||||
* @param headerParams The header parameters for the request
|
||||
* @param cookieParams The cookie parameters for the request
|
||||
*/
|
||||
public void applyToParams(MultiValueMap<String, String> queryParams, HttpHeaders headerParams);
|
||||
public void applyToParams(MultiValueMap<String, String> queryParams, HttpHeaders headerParams, MultiValueMap<String, String> cookieParams);
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ public class HttpBasicAuth implements Authentication {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyToParams(MultiValueMap<String, String> queryParams, HttpHeaders headerParams) {
|
||||
public void applyToParams(MultiValueMap<String, String> queryParams, HttpHeaders headerParams, MultiValueMap<String, String> cookieParams) {
|
||||
if (username == null && password == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ public class HttpBearerAuth implements Authentication {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyToParams(MultiValueMap<String, String> queryParams, HttpHeaders headerParams) {
|
||||
public void applyToParams(MultiValueMap<String, String> queryParams, HttpHeaders headerParams, MultiValueMap<String, String> cookieParams) {
|
||||
if (bearerToken == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ public class OAuth implements Authentication {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyToParams(MultiValueMap<String, String> queryParams, HttpHeaders headerParams) {
|
||||
public void applyToParams(MultiValueMap<String, String> queryParams, HttpHeaders headerParams, MultiValueMap<String, String> cookieParams) {
|
||||
if (accessToken != null) {
|
||||
headerParams.add(HttpHeaders.AUTHORIZATION, "Bearer " + accessToken);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user