[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:
Tiffany Marrel 2023-05-22 10:08:08 +02:00 committed by GitHub
parent 216e2c45ff
commit cbcf3d36f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
55 changed files with 292 additions and 256 deletions

View File

@ -1,7 +1,7 @@
generatorName: java generatorName: java
outputDir: samples/client/petstore/java/okhttp-gson outputDir: samples/client/petstore/java/okhttp-gson
library: okhttp-gson library: okhttp-gson
inputSpec: modules/openapi-generator/src/test/resources/3_0/java/petstore-with-fake-endpoints-models-for-testing-with-http-signature-okhttp-gson.yaml inputSpec: modules/openapi-generator/src/test/resources/3_0/java/petstore-with-fake-endpoints-models-for-testing-okhttp-gson.yaml
templateDir: modules/openapi-generator/src/main/resources/Java templateDir: modules/openapi-generator/src/main/resources/Java
additionalProperties: additionalProperties:
artifactId: petstore-okhttp-gson artifactId: petstore-okhttp-gson

View File

@ -124,8 +124,8 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
// Setup authentications (key: authentication name, value: authentication). // Setup authentications (key: authentication name, value: authentication).
authentications = new HashMap<String, Authentication>();{{#authMethods}}{{#isBasic}}{{#isBasicBasic}} authentications = new HashMap<String, Authentication>();{{#authMethods}}{{#isBasic}}{{#isBasicBasic}}
authentications.put("{{name}}", new HttpBasicAuth());{{/isBasicBasic}}{{^isBasicBasic}} authentications.put("{{name}}", new HttpBasicAuth());{{/isBasicBasic}}{{#isBasicBearer}}
authentications.put("{{name}}", new HttpBearerAuth("{{scheme}}"));{{/isBasicBasic}}{{/isBasic}}{{#isApiKey}} authentications.put("{{name}}", new HttpBearerAuth("{{scheme}}"));{{/isBasicBearer}}{{/isBasic}}{{#isApiKey}}
authentications.put("{{name}}", new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{^isKeyInHeader}}"query"{{/isKeyInHeader}}, "{{keyParamName}}"));{{/isApiKey}}{{#isOAuth}} authentications.put("{{name}}", new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{^isKeyInHeader}}"query"{{/isKeyInHeader}}, "{{keyParamName}}"));{{/isApiKey}}{{#isOAuth}}
authentications.put("{{name}}", new OAuth());{{/isOAuth}}{{/authMethods}} authentications.put("{{name}}", new OAuth());{{/isOAuth}}{{/authMethods}}
// Prevent the authentications from being modified. // Prevent the authentications from being modified.

View File

@ -212,10 +212,18 @@ Class | Method | HTTP request | Description
- **API key parameter name**: {{keyParamName}} - **API key parameter name**: {{keyParamName}}
- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}} - **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}}
{{/isApiKey}} {{/isApiKey}}
{{#isBasic}} {{#isBasicBasic}}
- **Type**: HTTP basic authentication - **Type**: HTTP basic authentication
{{/isBasic}} {{/isBasicBasic}}
{{#isBasicBearer}}
- **Type**: HTTP Bearer Token authentication{{#bearerFormat}} ({{{.}}}){{/bearerFormat}}
{{/isBasicBearer}}
{{#isHttpSignature}}
- **Type**: HTTP signature authentication
{{/isHttpSignature}}
{{#isOAuth}} {{#isOAuth}}
- **Type**: OAuth - **Type**: OAuth

View File

@ -156,8 +156,8 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
// Setup authentications (key: authentication name, value: authentication). // Setup authentications (key: authentication name, value: authentication).
authentications = new HashMap<String, Authentication>();{{#authMethods}}{{#isBasic}}{{#isBasicBasic}} authentications = new HashMap<String, Authentication>();{{#authMethods}}{{#isBasic}}{{#isBasicBasic}}
authentications.put("{{name}}", new HttpBasicAuth());{{/isBasicBasic}}{{^isBasicBasic}} authentications.put("{{name}}", new HttpBasicAuth());{{/isBasicBasic}}{{#isBasicBearer}}
authentications.put("{{name}}", new HttpBearerAuth("{{scheme}}"));{{/isBasicBasic}}{{/isBasic}}{{#isApiKey}} authentications.put("{{name}}", new HttpBearerAuth("{{scheme}}"));{{/isBasicBearer}}{{/isBasic}}{{#isApiKey}}
authentications.put("{{name}}", new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{^isKeyInHeader}}"query"{{/isKeyInHeader}}, "{{keyParamName}}"));{{/isApiKey}}{{#isOAuth}} authentications.put("{{name}}", new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{^isKeyInHeader}}"query"{{/isKeyInHeader}}, "{{keyParamName}}"));{{/isApiKey}}{{#isOAuth}}
authentications.put("{{name}}", new OAuth());{{/isOAuth}}{{/authMethods}} authentications.put("{{name}}", new OAuth());{{/isOAuth}}{{/authMethods}}
// Prevent the authentications from being modified. // Prevent the authentications from being modified.

View File

@ -173,10 +173,18 @@ Class | Method | HTTP request | Description
- **API key parameter name**: {{keyParamName}} - **API key parameter name**: {{keyParamName}}
- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}} - **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}}
{{/isApiKey}} {{/isApiKey}}
{{#isBasic}} {{#isBasicBasic}}
- **Type**: HTTP basic authentication - **Type**: HTTP basic authentication
{{/isBasic}} {{/isBasicBasic}}
{{#isBasicBearer}}
- **Type**: HTTP Bearer Token authentication{{#bearerFormat}} ({{{.}}}){{/bearerFormat}}
{{/isBasicBearer}}
{{#isHttpSignature}}
- **Type**: HTTP signature authentication
{{/isHttpSignature}}
{{#isOAuth}} {{#isOAuth}}
- **Type**: OAuth - **Type**: OAuth

View File

@ -101,7 +101,12 @@ public class ApiClient {
auth = new HttpBasicAuth(); auth = new HttpBasicAuth();
{{/isBasicBasic}} {{/isBasicBasic}}
{{^isBasicBasic}} {{^isBasicBasic}}
{{#isBasicBearer}}
auth = new HttpBearerAuth("{{scheme}}"); auth = new HttpBearerAuth("{{scheme}}");
{{/isBasicBearer}}
{{^isBasicBearer}}
throw new RuntimeException("auth name \"" + authName + "\" does not have a supported http scheme type");
{{/isBasicBearer}}
{{/isBasicBasic}} {{/isBasicBasic}}
{{/isBasic}} {{/isBasic}}
{{#isApiKey}} {{#isApiKey}}

View File

@ -154,10 +154,18 @@ Class | Method | HTTP request | Description
- **API key parameter name**: {{keyParamName}} - **API key parameter name**: {{keyParamName}}
- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}} - **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}}
{{/isApiKey}} {{/isApiKey}}
{{#isBasic}} {{#isBasicBasic}}
- **Type**: HTTP basic authentication - **Type**: HTTP basic authentication
{{/isBasic}} {{/isBasicBasic}}
{{#isBasicBearer}}
- **Type**: HTTP Bearer Token authentication{{#bearerFormat}} ({{{.}}}){{/bearerFormat}}
{{/isBasicBearer}}
{{#isHttpSignature}}
- **Type**: HTTP signature authentication
{{/isHttpSignature}}
{{#isOAuth}} {{#isOAuth}}
- **Type**: OAuth - **Type**: OAuth

View File

@ -135,8 +135,8 @@ public class ApiClient {
initHttpClient(); initHttpClient();
// Setup authentications (key: authentication name, value: authentication).{{#authMethods}}{{#isBasic}}{{#isBasicBasic}} // Setup authentications (key: authentication name, value: authentication).{{#authMethods}}{{#isBasic}}{{#isBasicBasic}}
authentications.put("{{name}}", new HttpBasicAuth());{{/isBasicBasic}}{{^isBasicBasic}} authentications.put("{{name}}", new HttpBasicAuth());{{/isBasicBasic}}{{#isBasicBearer}}
authentications.put("{{name}}", new HttpBearerAuth("{{scheme}}"));{{/isBasicBasic}}{{/isBasic}}{{#isApiKey}} authentications.put("{{name}}", new HttpBearerAuth("{{scheme}}"));{{/isBasicBearer}}{{/isBasic}}{{#isApiKey}}
authentications.put("{{name}}", new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{#isKeyInQuery}}"query"{{/isKeyInQuery}}{{#isKeyInCookie}}"cookie"{{/isKeyInCookie}}, "{{keyParamName}}"));{{/isApiKey}}{{#isOAuth}} authentications.put("{{name}}", new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{#isKeyInQuery}}"query"{{/isKeyInQuery}}{{#isKeyInCookie}}"cookie"{{/isKeyInCookie}}, "{{keyParamName}}"));{{/isApiKey}}{{#isOAuth}}
authentications.put("{{name}}", new OAuth());{{/isOAuth}}{{/authMethods}}{{#withAWSV4Signature}} authentications.put("{{name}}", new OAuth());{{/isOAuth}}{{/authMethods}}{{#withAWSV4Signature}}
authentications.put("AWS4Auth", new AWS4Auth());{{/withAWSV4Signature}} authentications.put("AWS4Auth", new AWS4Auth());{{/withAWSV4Signature}}
@ -155,8 +155,8 @@ public class ApiClient {
httpClient = client; httpClient = client;
// Setup authentications (key: authentication name, value: authentication).{{#authMethods}}{{#isBasic}}{{#isBasicBasic}} // Setup authentications (key: authentication name, value: authentication).{{#authMethods}}{{#isBasic}}{{#isBasicBasic}}
authentications.put("{{name}}", new HttpBasicAuth());{{/isBasicBasic}}{{^isBasicBasic}} authentications.put("{{name}}", new HttpBasicAuth());{{/isBasicBasic}}{{#isBasicBearer}}
authentications.put("{{name}}", new HttpBearerAuth("{{scheme}}"));{{/isBasicBasic}}{{/isBasic}}{{#isApiKey}} authentications.put("{{name}}", new HttpBearerAuth("{{scheme}}"));{{/isBasicBearer}}{{/isBasic}}{{#isApiKey}}
authentications.put("{{name}}", new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{#isKeyInQuery}}"query"{{/isKeyInQuery}}{{#isKeyInCookie}}"cookie"{{/isKeyInCookie}}, "{{keyParamName}}"));{{/isApiKey}}{{#isOAuth}} authentications.put("{{name}}", new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{#isKeyInQuery}}"query"{{/isKeyInQuery}}{{#isKeyInCookie}}"cookie"{{/isKeyInCookie}}, "{{keyParamName}}"));{{/isApiKey}}{{#isOAuth}}
authentications.put("{{name}}", new OAuth());{{/isOAuth}}{{/authMethods}}{{#withAWSV4Signature}} authentications.put("{{name}}", new OAuth());{{/isOAuth}}{{/authMethods}}{{#withAWSV4Signature}}
authentications.put("AWS4Auth", new AWS4Auth());{{/withAWSV4Signature}} authentications.put("AWS4Auth", new AWS4Auth());{{/withAWSV4Signature}}
@ -228,8 +228,8 @@ public class ApiClient {
); );
initHttpClient(Collections.<Interceptor>singletonList(retryingOAuth)); initHttpClient(Collections.<Interceptor>singletonList(retryingOAuth));
// Setup authentications (key: authentication name, value: authentication).{{#authMethods}}{{#isBasic}}{{#isBasicBasic}} // Setup authentications (key: authentication name, value: authentication).{{#authMethods}}{{#isBasic}}{{#isBasicBasic}}
authentications.put("{{name}}", new HttpBasicAuth());{{/isBasicBasic}}{{^isBasicBasic}} authentications.put("{{name}}", new HttpBasicAuth());{{/isBasicBasic}}{{#isBasicBearer}}
authentications.put("{{name}}", new HttpBearerAuth("{{scheme}}"));{{/isBasicBasic}}{{/isBasic}}{{#isApiKey}} authentications.put("{{name}}", new HttpBearerAuth("{{scheme}}"));{{/isBasicBearer}}{{/isBasic}}{{#isApiKey}}
authentications.put("{{name}}", new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{#isKeyInQuery}}"query"{{/isKeyInQuery}}{{#isKeyInCookie}}"cookie"{{/isKeyInCookie}}, "{{keyParamName}}"));{{/isApiKey}}{{/authMethods}}{{#withAWSV4Signature}} authentications.put("{{name}}", new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{#isKeyInQuery}}"query"{{/isKeyInQuery}}{{#isKeyInCookie}}"cookie"{{/isKeyInCookie}}, "{{keyParamName}}"));{{/isApiKey}}{{/authMethods}}{{#withAWSV4Signature}}
authentications.put("AWS4Auth", new AWS4Auth());{{/withAWSV4Signature}} authentications.put("AWS4Auth", new AWS4Auth());{{/withAWSV4Signature}}

View File

@ -168,8 +168,12 @@ Class | Method | HTTP request | Description
- **API key parameter name**: {{keyParamName}} - **API key parameter name**: {{keyParamName}}
- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}} - **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}}
{{/isApiKey}} {{/isApiKey}}
{{#isBasic}}- **Type**: HTTP basic authentication {{#isBasicBasic}}- **Type**: HTTP basic authentication
{{/isBasic}} {{/isBasicBasic}}
{{#isBasicBearer}}- **Type**: HTTP Bearer Token authentication{{#bearerFormat}} ({{{.}}}){{/bearerFormat}}
{{/isBasicBearer}}
{{#isHttpSignature}}- **Type**: HTTP signature authentication
{{/isHttpSignature}}
{{#isOAuth}}- **Type**: OAuth {{#isOAuth}}- **Type**: OAuth
- **Flow**: {{flow}} - **Flow**: {{flow}}
- **Authorization URL**: {{authorizationUrl}} - **Authorization URL**: {{authorizationUrl}}

View File

@ -85,8 +85,8 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
// Setup authentications (key: authentication name, value: authentication). // Setup authentications (key: authentication name, value: authentication).
authentications = new HashMap<String, Authentication>();{{#authMethods}}{{#isBasic}}{{#isBasicBasic}} authentications = new HashMap<String, Authentication>();{{#authMethods}}{{#isBasic}}{{#isBasicBasic}}
authentications.put("{{name}}", new HttpBasicAuth());{{/isBasicBasic}}{{^isBasicBasic}} authentications.put("{{name}}", new HttpBasicAuth());{{/isBasicBasic}}{{#isBasicBearer}}
authentications.put("{{name}}", new HttpBearerAuth("{{scheme}}"));{{/isBasicBasic}}{{/isBasic}}{{#isApiKey}} authentications.put("{{name}}", new HttpBearerAuth("{{scheme}}"));{{/isBasicBearer}}{{/isBasic}}{{#isApiKey}}
authentications.put("{{name}}", new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{#isKeyInQuery}}"query"{{/isKeyInQuery}}{{#isKeyInCookie}}"cookie"{{/isKeyInCookie}}, "{{keyParamName}}"));{{/isApiKey}}{{#isOAuth}} authentications.put("{{name}}", new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{#isKeyInQuery}}"query"{{/isKeyInQuery}}{{#isKeyInCookie}}"cookie"{{/isKeyInCookie}}, "{{keyParamName}}"));{{/isApiKey}}{{#isOAuth}}
authentications.put("{{name}}", new OAuth());{{/isOAuth}}{{/authMethods}} authentications.put("{{name}}", new OAuth());{{/isOAuth}}{{/authMethods}}
// Prevent the authentications from being modified. // Prevent the authentications from being modified.

View File

@ -138,8 +138,8 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
// Setup authentications (key: authentication name, value: authentication). // Setup authentications (key: authentication name, value: authentication).
authentications = new HashMap<String, Authentication>();{{#authMethods}}{{#isBasic}}{{#isBasicBasic}} authentications = new HashMap<String, Authentication>();{{#authMethods}}{{#isBasic}}{{#isBasicBasic}}
authentications.put("{{name}}", new HttpBasicAuth());{{/isBasicBasic}}{{^isBasicBasic}} authentications.put("{{name}}", new HttpBasicAuth());{{/isBasicBasic}}{{#isBasicBearer}}
authentications.put("{{name}}", new HttpBearerAuth("{{scheme}}"));{{/isBasicBasic}}{{/isBasic}}{{#isApiKey}} authentications.put("{{name}}", new HttpBearerAuth("{{scheme}}"));{{/isBasicBearer}}{{/isBasic}}{{#isApiKey}}
authentications.put("{{name}}", new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{#isKeyInQuery}}"query"{{/isKeyInQuery}}{{#isKeyInCookie}}"cookie"{{/isKeyInCookie}}, "{{keyParamName}}"));{{/isApiKey}}{{#isOAuth}} authentications.put("{{name}}", new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{#isKeyInQuery}}"query"{{/isKeyInQuery}}{{#isKeyInCookie}}"cookie"{{/isKeyInCookie}}, "{{keyParamName}}"));{{/isApiKey}}{{#isOAuth}}
authentications.put("{{name}}", new OAuth());{{/isOAuth}}{{/authMethods}} authentications.put("{{name}}", new OAuth());{{/isOAuth}}{{/authMethods}}
// Prevent the authentications from being modified. // Prevent the authentications from being modified.

View File

@ -66,7 +66,12 @@ public class ApiClient {
auth = new HttpBasicAuth(); auth = new HttpBasicAuth();
{{/isBasicBasic}} {{/isBasicBasic}}
{{^isBasicBasic}} {{^isBasicBasic}}
{{#isBasicBearer}}
auth = new HttpBearerAuth("{{scheme}}"); auth = new HttpBearerAuth("{{scheme}}");
{{/isBasicBearer}}
{{^isBasicBearer}}
throw new RuntimeException("auth name \"" + authName + "\" does not have a supported http scheme type");
{{/isBasicBearer}}
{{/isBasicBasic}} {{/isBasicBasic}}
{{/isBasic}} {{/isBasic}}
{{#isApiKey}} {{#isApiKey}}

View File

@ -70,9 +70,11 @@ public class ApiClient {
{{#authMethods}}if ("{{name}}".equals(authName)) { {{#authMethods}}if ("{{name}}".equals(authName)) {
{{#isBasic}}{{#isBasicBasic}} {{#isBasic}}{{#isBasicBasic}}
auth = new HttpBasicAuth(); auth = new HttpBasicAuth();
{{/isBasicBasic}}{{^isBasicBasic}} {{/isBasicBasic}}{{^isBasicBasic}}{{#isBasicBearer}}
auth = new HttpBearerAuth("{{scheme}}"); auth = new HttpBearerAuth("{{scheme}}");
{{/isBasicBasic}}{{/isBasic}} {{/isBasicBearer}}{{^isBasicBearer}}
throw new RuntimeException("auth name \"" + authName + "\" does not have a supported http scheme type");
{{/isBasicBearer}}{{/isBasicBasic}}{{/isBasic}}
{{#isApiKey}} {{#isApiKey}}
auth = new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{#isKeyInQuery}}"query"{{/isKeyInQuery}}{{#isKeyInCookie}}"cookie"{{/isKeyInCookie}}, "{{keyParamName}}"); auth = new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{#isKeyInQuery}}"query"{{/isKeyInQuery}}{{#isKeyInCookie}}"cookie"{{/isKeyInCookie}}, "{{keyParamName}}");
{{/isApiKey}} {{/isApiKey}}

View File

@ -45,8 +45,8 @@ public class ApiClient {
public ApiClient() { public ApiClient() {
// Setup authentications (key: authentication name, value: authentication). // Setup authentications (key: authentication name, value: authentication).
authentications = new HashMap<>();{{#authMethods}}{{#isBasic}}{{#isBasicBasic}} authentications = new HashMap<>();{{#authMethods}}{{#isBasic}}{{#isBasicBasic}}
// authentications.put("{{name}}", new HttpBasicAuth());{{/isBasicBasic}}{{^isBasicBasic}} // authentications.put("{{name}}", new HttpBasicAuth());{{/isBasicBasic}}{{#isBasicBearer}}
// authentications.put("{{name}}", new HttpBearerAuth("{{scheme}}"));{{/isBasicBasic}}{{/isBasic}}{{#isApiKey}} // authentications.put("{{name}}", new HttpBearerAuth("{{scheme}}"));{{/isBasicBearer}}{{/isBasic}}{{#isApiKey}}
authentications.put("{{name}}", new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{#isKeyInQuery}}"query"{{/isKeyInQuery}}{{#isKeyInCookie}}"cookie"{{/isKeyInCookie}}, "{{keyParamName}}"));{{/isApiKey}}{{#isOAuth}} authentications.put("{{name}}", new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{#isKeyInQuery}}"query"{{/isKeyInQuery}}{{#isKeyInCookie}}"cookie"{{/isKeyInCookie}}, "{{keyParamName}}"));{{/isApiKey}}{{#isOAuth}}
// authentications.put("{{name}}", new OAuth());{{/isOAuth}}{{/authMethods}} // authentications.put("{{name}}", new OAuth());{{/isOAuth}}{{/authMethods}}
// Prevent the authentications from being modified. // Prevent the authentications from being modified.

View File

@ -44,8 +44,8 @@ public class ApiClient {
public ApiClient() { public ApiClient() {
// Setup authentications (key: authentication name, value: authentication). // Setup authentications (key: authentication name, value: authentication).
authentications = new HashMap<>();{{#authMethods}}{{#isBasic}} authentications = new HashMap<>();{{#authMethods}}{{#isBasicBasic}}
// authentications.put("{{name}}", new HttpBasicAuth());{{/isBasic}}{{#isApiKey}} // authentications.put("{{name}}", new HttpBasicAuth());{{/isBasicBasic}}{{#isApiKey}}
authentications.put("{{name}}", new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{#isKeyInQuery}}"query"{{/isKeyInQuery}}{{#isKeyInCookie}}"query"{{/isKeyInCookie}}, "{{keyParamName}}"));{{/isApiKey}}{{#isOAuth}} authentications.put("{{name}}", new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{#isKeyInQuery}}"query"{{/isKeyInQuery}}{{#isKeyInCookie}}"query"{{/isKeyInCookie}}, "{{keyParamName}}"));{{/isApiKey}}{{#isOAuth}}
// authentications.put("{{name}}", new OAuth());{{/isOAuth}}{{/authMethods}} // authentications.put("{{name}}", new OAuth());{{/isOAuth}}{{/authMethods}}
// Prevent the authentications from being modified. // Prevent the authentications from being modified.

View File

@ -59,8 +59,8 @@ public class ApiClient {
public ApiClient() { public ApiClient() {
// Setup authentications (key: authentication name, value: authentication). // Setup authentications (key: authentication name, value: authentication).
authentications = new HashMap<>();{{#authMethods}}{{#isBasic}} authentications = new HashMap<>();{{#authMethods}}{{#isBasicBasic}}
// authentications.put("{{name}}", new HttpBasicAuth());{{/isBasic}}{{#isApiKey}} // authentications.put("{{name}}", new HttpBasicAuth());{{/isBasicBasic}}{{#isApiKey}}
authentications.put("{{name}}", new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{#isKeyInQuery}}"query"{{/isKeyInQuery}}{{#isKeyInCookie}}"cookie"{{/isKeyInCookie}}, "{{keyParamName}}"));{{/isApiKey}}{{#isOAuth}} authentications.put("{{name}}", new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{#isKeyInQuery}}"query"{{/isKeyInQuery}}{{#isKeyInCookie}}"cookie"{{/isKeyInCookie}}, "{{keyParamName}}"));{{/isApiKey}}{{#isOAuth}}
// authentications.put("{{name}}", new OAuth());{{/isOAuth}}{{/authMethods}} // authentications.put("{{name}}", new OAuth());{{/isOAuth}}{{/authMethods}}
// Prevent the authentications from being modified. // Prevent the authentications from being modified.

View File

@ -93,8 +93,8 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
// Setup authentications (key: authentication name, value: authentication). // Setup authentications (key: authentication name, value: authentication).
this.authentications = new HashMap<>();{{#authMethods}}{{#isBasic}}{{#isBasicBasic}} this.authentications = new HashMap<>();{{#authMethods}}{{#isBasic}}{{#isBasicBasic}}
authentications.put("{{name}}", new HttpBasicAuth());{{/isBasicBasic}}{{^isBasicBasic}} authentications.put("{{name}}", new HttpBasicAuth());{{/isBasicBasic}}{{#isBasicBearer}}
authentications.put("{{name}}", new HttpBearerAuth("{{scheme}}"));{{/isBasicBasic}}{{/isBasic}}{{#isApiKey}} authentications.put("{{name}}", new HttpBearerAuth("{{scheme}}"));{{/isBasicBearer}}{{/isBasic}}{{#isApiKey}}
authentications.put("{{name}}", new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{#isKeyInQuery}}"query"{{/isKeyInQuery}}{{#isKeyInCookie}}"cookie"{{/isKeyInCookie}}, "{{keyParamName}}"));{{/isApiKey}}{{#isOAuth}} authentications.put("{{name}}", new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{#isKeyInQuery}}"query"{{/isKeyInQuery}}{{#isKeyInCookie}}"cookie"{{/isKeyInCookie}}, "{{keyParamName}}"));{{/isApiKey}}{{#isOAuth}}
authentications.put("{{name}}", new OAuth());{{/isOAuth}}{{/authMethods}} authentications.put("{{name}}", new OAuth());{{/isOAuth}}{{/authMethods}}
// Prevent the authentications from being modified. // Prevent the authentications from being modified.
@ -685,14 +685,14 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
auth.setUsername(username); auth.setUsername(username);
auth.setPassword(password); auth.setPassword(password);
authentications.put("{{name}}", auth); authentications.put("{{name}}", auth);
}{{/isBasicBasic}}{{^isBasicBasic}} }{{/isBasicBasic}}{{#isBasicBearer}}
public void add{{#lambda.titlecase}}{{name}}{{/lambda.titlecase}}Authentication(String bearerToken) { public void add{{#lambda.titlecase}}{{name}}{{/lambda.titlecase}}Authentication(String bearerToken) {
HttpBearerAuth auth = new HttpBearerAuth auth = new
HttpBearerAuth("{{scheme}}"); HttpBearerAuth("{{scheme}}");
auth.setBearerToken(bearerToken); auth.setBearerToken(bearerToken);
authentications.put("{{name}}", auth); authentications.put("{{name}}", auth);
}{{/isBasicBasic}}{{/isBasic}}{{#isApiKey}} }{{/isBasicBearer}}{{/isBasic}}{{#isApiKey}}
public void add{{#lambda.titlecase}}{{name}}{{/lambda.titlecase}}Authentication(String apikey, String apiKeyPrefix) { public void add{{#lambda.titlecase}}{{name}}{{/lambda.titlecase}}Authentication(String apikey, String apiKeyPrefix) {
ApiKeyAuth auth = new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{#isKeyInQuery}}"query"{{/isKeyInQuery}}{{#isKeyInCookie}}"cookie"{{/isKeyInCookie}},"{{keyParamName}}"); ApiKeyAuth auth = new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{#isKeyInQuery}}"query"{{/isKeyInQuery}}{{#isKeyInCookie}}"cookie"{{/isKeyInCookie}},"{{keyParamName}}");
@ -711,13 +711,13 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
AuthInfo authInfo = new AuthInfo(); AuthInfo authInfo = new AuthInfo();
authInfo.add{{#lambda.titlecase}}{{name}}{{/lambda.titlecase}}Authentication(username, password); authInfo.add{{#lambda.titlecase}}{{name}}{{/lambda.titlecase}}Authentication(username, password);
return authInfo; return authInfo;
}{{/isBasicBasic}}{{^isBasicBasic}} }{{/isBasicBasic}}{{#isBasicBearer}}
public static AuthInfo for{{#lambda.titlecase}}{{name}}{{/lambda.titlecase}}Authentication(String bearerToken) { public static AuthInfo for{{#lambda.titlecase}}{{name}}{{/lambda.titlecase}}Authentication(String bearerToken) {
AuthInfo authInfo = new AuthInfo(); AuthInfo authInfo = new AuthInfo();
authInfo.add{{#lambda.titlecase}}{{name}}{{/lambda.titlecase}}Authentication(bearerToken); authInfo.add{{#lambda.titlecase}}{{name}}{{/lambda.titlecase}}Authentication(bearerToken);
return authInfo; return authInfo;
}{{/isBasicBasic}}{{/isBasic}}{{#isApiKey}} }{{/isBasicBearer}}{{/isBasic}}{{#isApiKey}}
public static AuthInfo for{{#lambda.titlecase}}{{name}}{{/lambda.titlecase}}Authentication(String apikey, String apiKeyPrefix) { public static AuthInfo for{{#lambda.titlecase}}{{name}}{{/lambda.titlecase}}Authentication(String apikey, String apiKeyPrefix) {
AuthInfo authInfo = new AuthInfo(); AuthInfo authInfo = new AuthInfo();

View File

@ -155,8 +155,8 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
protected void init() { protected void init() {
// Setup authentications (key: authentication name, value: authentication). // Setup authentications (key: authentication name, value: authentication).
authentications = new HashMap<String, Authentication>();{{#authMethods}}{{#isBasic}}{{#isBasicBasic}} authentications = new HashMap<String, Authentication>();{{#authMethods}}{{#isBasic}}{{#isBasicBasic}}
authentications.put("{{name}}", new HttpBasicAuth());{{/isBasicBasic}}{{^isBasicBasic}} authentications.put("{{name}}", new HttpBasicAuth());{{/isBasicBasic}}{{#isBasicBearer}}
authentications.put("{{name}}", new HttpBearerAuth("{{scheme}}"));{{/isBasicBasic}}{{/isBasic}}{{#isApiKey}} authentications.put("{{name}}", new HttpBearerAuth("{{scheme}}"));{{/isBasicBearer}}{{/isBasic}}{{#isApiKey}}
authentications.put("{{name}}", new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{#isKeyInQuery}}"query"{{/isKeyInQuery}}{{#isKeyInCookie}}"cookie"{{/isKeyInCookie}}, "{{keyParamName}}"));{{/isApiKey}}{{#isOAuth}} authentications.put("{{name}}", new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{#isKeyInQuery}}"query"{{/isKeyInQuery}}{{#isKeyInCookie}}"cookie"{{/isKeyInCookie}}, "{{keyParamName}}"));{{/isApiKey}}{{#isOAuth}}
authentications.put("{{name}}", new OAuth());{{/isOAuth}}{{/authMethods}} authentications.put("{{name}}", new OAuth());{{/isOAuth}}{{/authMethods}}
// Prevent the authentications from being modified. // Prevent the authentications from being modified.

View File

@ -4,10 +4,10 @@
# {{name}} # {{name}}
{{! {{!
basic auth basic auth
}}{{#isBasic}}Authorization method is of **basic auth**. }}{{#isBasicBasic}}Authorization method is of **basic auth**.
{{#configureAuth}}The configuration for it can be found in [application.yml](src/main/resources/application.yml) at `security.basic-auth.{{name}}`. `username` and `password` need to be filled for it to work correctly.{{/configureAuth}}{{^configureAuth}}It can be configured in the [application.yml](src/main/resources/application.yml) using Micronaut security features.{{/configureAuth}} {{#configureAuth}}The configuration for it can be found in [application.yml](src/main/resources/application.yml) at `security.basic-auth.{{name}}`. `username` and `password` need to be filled for it to work correctly.{{/configureAuth}}{{^configureAuth}}It can be configured in the [application.yml](src/main/resources/application.yml) using Micronaut security features.{{/configureAuth}}
{{/isBasic}}{{! {{/isBasicBasic}}{{!
api key api key
}}{{#isApiKey}}Authorization method is of **api key type**. The parameter `{{{keyParamName}}}` is located in `{{#isKeyInQuery}}query{{/isKeyInQuery}}{{#isKeyInHeader}}header{{/isKeyInHeader}}{{#isKeyInCookie}}cookie{{/isKeyInCookie}}`. }}{{#isApiKey}}Authorization method is of **api key type**. The parameter `{{{keyParamName}}}` is located in `{{#isKeyInQuery}}query{{/isKeyInQuery}}{{#isKeyInHeader}}header{{/isKeyInHeader}}{{#isKeyInCookie}}cookie{{/isKeyInCookie}}`.

View File

@ -47,12 +47,12 @@ micronaut:
# TODO fill in api key for {{{name}}} authorization # TODO fill in api key for {{{name}}} authorization
api-key: api-key:
{{/isApiKey}}{{/authMethods}} {{/isApiKey}}{{/authMethods}}
{{!basic authorization}}basic-auth:{{#authMethods}}{{#isBasic}} {{!basic authorization}}basic-auth:{{#authMethods}}{{#isBasicBasic}}
{{{name}}}: {{{name}}}:
# TODO fill in credentials for {{{name}}} authorization # TODO fill in credentials for {{{name}}} authorization
username: username:
password: password:
{{/isBasic}}{{/authMethods}}{{/configureAuth}} {{/isBasicBasic}}{{/authMethods}}{{/configureAuth}}
{{/client}} {{/client}}
{{!SERVER CONFIGURATION}} {{!SERVER CONFIGURATION}}
{{#server}} {{#server}}

View File

@ -90,8 +90,12 @@ No model defined in this package
- **API key parameter name**: {{keyParamName}} - **API key parameter name**: {{keyParamName}}
- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}} - **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}}
{{/isApiKey}} {{/isApiKey}}
{{#isBasic}}- **Type**: HTTP basic authentication {{#isBasicBasic}}- **Type**: HTTP basic authentication
{{/isBasic}} {{/isBasicBasic}}
{{#isBasicBearer}}- **Type**: HTTP Bearer Token authentication{{#bearerFormat}} ({{{.}}}){{/bearerFormat}}
{{/isBasicBearer}}
{{#isHttpSignature}}- **Type**: HTTP signature authentication
{{/isHttpSignature}}
{{#isOAuth}}- **Type**: OAuth {{#isOAuth}}- **Type**: OAuth
- **Flow**: {{flow}} - **Flow**: {{flow}}
- **Authorization URL**: {{authorizationUrl}} - **Authorization URL**: {{authorizationUrl}}

View File

@ -70,8 +70,8 @@ import {{packageName}}.auth.*
{{#hasAuthMethods}} {{#hasAuthMethods}}
private val authentications: kotlin.collections.Map<String, Authentication> by lazy { private val authentications: kotlin.collections.Map<String, Authentication> by lazy {
mapOf({{#authMethods}}{{#isBasic}}{{#isBasicBasic}} mapOf({{#authMethods}}{{#isBasic}}{{#isBasicBasic}}
"{{name}}" to HttpBasicAuth(){{/isBasicBasic}}{{^isBasicBasic}} "{{name}}" to HttpBasicAuth(){{/isBasicBasic}}{{#isBasicBearer}}
"{{name}}" to HttpBearerAuth("{{scheme}}"){{/isBasicBasic}}{{/isBasic}}{{#isApiKey}} "{{name}}" to HttpBearerAuth("{{scheme}}"){{/isBasicBearer}}{{/isBasic}}{{#isApiKey}}
"{{name}}" to ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{^isKeyInHeader}}"query"{{/isKeyInHeader}}, "{{keyParamName}}"){{/isApiKey}}{{#isOAuth}} "{{name}}" to ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{^isKeyInHeader}}"query"{{/isKeyInHeader}}, "{{keyParamName}}"){{/isApiKey}}{{#isOAuth}}
"{{name}}" to OAuth(){{/isOAuth}}{{^-last}}, {{/-last}}{{/authMethods}}) "{{name}}" to OAuth(){{/isOAuth}}{{^-last}}, {{/-last}}{{/authMethods}})
} }

View File

@ -128,7 +128,7 @@ import okhttp3.MediaType.Companion.toMediaType
) : this(baseUrl, okHttpClientBuilder{{^kotlinx_serialization}}, serializerBuilder{{/kotlinx_serialization}}) { ) : this(baseUrl, okHttpClientBuilder{{^kotlinx_serialization}}, serializerBuilder{{/kotlinx_serialization}}) {
authNames.forEach { authName -> authNames.forEach { authName ->
val auth = when (authName) { val auth = when (authName) {
{{#authMethods}}"{{name}}" -> {{#isBasic}}{{#isBasicBasic}}HttpBasicAuth(){{/isBasicBasic}}{{#isBasicBearer}}HttpBearerAuth("{{scheme}}"){{/isBasicBearer}}{{/isBasic}}{{#isApiKey}}ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{#isKeyInQuery}}"query"{{/isKeyInQuery}}{{#isKeyInCookie}}"cookie"{{/isKeyInCookie}}, "{{keyParamName}}"){{/isApiKey}}{{#isOAuth}}OAuth(OAuthFlow.{{flow}}, "{{authorizationUrl}}", "{{tokenUrl}}", "{{#scopes}}{{scope}}{{^-last}}, {{/-last}}{{/scopes}}"){{/isOAuth}}{{/authMethods}} {{#authMethods}}"{{name}}" -> {{#isBasic}}{{#isBasicBasic}}HttpBasicAuth(){{/isBasicBasic}}{{^isBasicBasic}}{{#isBasicBearer}}HttpBearerAuth("{{scheme}}"){{/isBasicBearer}}{{^isBasicBearer}}throw RuntimeException("auth name $authName does not have a supported http scheme type"){{/isBasicBearer}}{{/isBasicBasic}}{{/isBasic}}{{#isApiKey}}ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{#isKeyInQuery}}"query"{{/isKeyInQuery}}{{#isKeyInCookie}}"cookie"{{/isKeyInCookie}}, "{{keyParamName}}"){{/isApiKey}}{{#isOAuth}}OAuth(OAuthFlow.{{flow}}, "{{authorizationUrl}}", "{{tokenUrl}}", "{{#scopes}}{{scope}}{{^-last}}, {{/-last}}{{/scopes}}"){{/isOAuth}}{{/authMethods}}
else -> throw RuntimeException("auth name $authName not found in available auth names") else -> throw RuntimeException("auth name $authName not found in available auth names")
} }
addAuthorization(authName, auth) addAuthorization(authName, auth)

View File

@ -213,8 +213,12 @@ No model defined in this package
- **API key parameter name**: {{keyParamName}} - **API key parameter name**: {{keyParamName}}
- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}} - **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}}
{{/isApiKey}} {{/isApiKey}}
{{#isBasic}}- **Type**: HTTP basic authentication {{#isBasicBasic}}- **Type**: HTTP basic authentication
{{/isBasic}} {{/isBasicBasic}}
{{#isBasicBearer}}- **Type**: HTTP Bearer Token authentication{{#bearerFormat}} ({{{.}}}){{/bearerFormat}}
{{/isBasicBearer}}
{{#isHttpSignature}}- **Type**: HTTP signature authentication
{{/isHttpSignature}}
{{#isOAuth}}- **Type**: OAuth {{#isOAuth}}- **Type**: OAuth
- **Flow**: {{flow}} - **Flow**: {{flow}}
- **Authorization URL**: {{authorizationUrl}} - **Authorization URL**: {{authorizationUrl}}

View File

@ -5,9 +5,9 @@ companion object Authentication {
{{#isApiKey}} {{#isApiKey}}
{{>auth/apikeyauth}} {{>auth/apikeyauth}}
{{/isApiKey}} {{/isApiKey}}
{{#isBasic}} {{#isBasicBasic}}
{{>auth/httpbasicauth}} {{>auth/httpbasicauth}}
{{/isBasic}} {{/isBasicBasic}}
{{#isOAuth}} {{#isOAuth}}
// TODO: Oauth not implemented yet - comment out below as OAuth does not exist // TODO: Oauth not implemented yet - comment out below as OAuth does not exist
{{/isOAuth}} {{/isOAuth}}

View File

@ -39,8 +39,8 @@ import {{packageName}}.auth.*
{{#hasAuthMethods}} {{#hasAuthMethods}}
private val authentications: kotlin.collections.Map<String, Authentication> by lazy { private val authentications: kotlin.collections.Map<String, Authentication> by lazy {
mapOf({{#authMethods}}{{#isBasic}}{{#isBasicBasic}} mapOf({{#authMethods}}{{#isBasic}}{{#isBasicBasic}}
"{{name}}" to HttpBasicAuth(){{/isBasicBasic}}{{^isBasicBasic}} "{{name}}" to HttpBasicAuth(){{/isBasicBasic}}{{#isBasicBearer}}
"{{name}}" to HttpBearerAuth("{{scheme}}"){{/isBasicBasic}}{{/isBasic}}{{#isApiKey}} "{{name}}" to HttpBearerAuth("{{scheme}}"){{/isBasicBearer}}{{/isBasic}}{{#isApiKey}}
"{{name}}" to ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{^isKeyInHeader}}"query"{{/isKeyInHeader}}, "{{keyParamName}}"){{/isApiKey}}{{#isOAuth}} "{{name}}" to ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{^isKeyInHeader}}"query"{{/isKeyInHeader}}, "{{keyParamName}}"){{/isApiKey}}{{#isOAuth}}
"{{name}}" to OAuth(){{/isOAuth}}{{^-last}}, {{/-last}}{{/authMethods}}) "{{name}}" to OAuth(){{/isOAuth}}{{^-last}}, {{/-last}}{{/authMethods}})
} }

View File

@ -65,8 +65,12 @@ No model defined in this package
- **API key parameter name**: {{keyParamName}} - **API key parameter name**: {{keyParamName}}
- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}} - **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}}
{{/isApiKey}} {{/isApiKey}}
{{#isBasic}}- **Type**: HTTP basic authentication {{#isBasicBasic}}- **Type**: HTTP basic authentication
{{/isBasic}} {{/isBasicBasic}}
{{#isBasicBearer}}- **Type**: HTTP Bearer Token authentication{{#bearerFormat}} ({{{.}}}){{/bearerFormat}}
{{/isBasicBearer}}
{{#isHttpSignature}}- **Type**: HTTP signature authentication
{{/isHttpSignature}}
{{#isOAuth}}- **Type**: OAuth {{#isOAuth}}- **Type**: OAuth
- **Flow**: {{flow}} - **Flow**: {{flow}}
- **Authorization URL**: {{authorizationUrl}} - **Authorization URL**: {{authorizationUrl}}

View File

@ -86,7 +86,7 @@ fun Application.main() {
{{#hasAuthMethods}} {{#hasAuthMethods}}
install(Authentication) { install(Authentication) {
{{#authMethods}} {{#authMethods}}
{{#isBasic}} {{#isBasicBasic}}
basic("{{{name}}}") { basic("{{{name}}}") {
validate { credentials -> validate { credentials ->
// TODO: "Apply your basic authentication functionality." // TODO: "Apply your basic authentication functionality."
@ -97,7 +97,7 @@ fun Application.main() {
null null
} }
} }
{{/isBasic}} {{/isBasicBasic}}
{{#isApiKey}} {{#isApiKey}}
// "Implement API key auth ({{{name}}}) for parameter name '{{{keyParamName}}}'." // "Implement API key auth ({{{name}}}) for parameter name '{{{keyParamName}}}'."
apiKeyAuth("{{{name}}}") { apiKeyAuth("{{{name}}}") {

View File

@ -82,8 +82,12 @@ No model defined in this package
- **API key parameter name**: {{keyParamName}} - **API key parameter name**: {{keyParamName}}
- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}} - **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}}
{{/isApiKey}} {{/isApiKey}}
{{#isBasic}}- **Type**: HTTP basic authentication {{#isBasicBasic}}- **Type**: HTTP basic authentication
{{/isBasic}} {{/isBasicBasic}}
{{#isBasicBearer}}- **Type**: HTTP Bearer Token authentication{{#bearerFormat}} ({{{.}}}){{/bearerFormat}}
{{/isBasicBearer}}
{{#isHttpSignature}}- **Type**: HTTP signature authentication
{{/isHttpSignature}}
{{#isOAuth}}- **Type**: OAuth {{#isOAuth}}- **Type**: OAuth
- **Flow**: {{flow}} - **Flow**: {{flow}}
- **Authorization URL**: {{authorizationUrl}} - **Authorization URL**: {{authorizationUrl}}

View File

@ -1,7 +1,7 @@
{{#authMethods}} {{#authMethods}}
{{#isBasic}} {{#isBasicBasic}}
val principal = call.authentication.principal<UserIdPrincipal>() val principal = call.authentication.principal<UserIdPrincipal>()
{{/isBasic}} {{/isBasicBasic}}
{{#isApiKey}} {{#isApiKey}}
val principal = call.authentication.principal<ApiPrincipal>() val principal = call.authentication.principal<ApiPrincipal>()
{{/isApiKey}} {{/isApiKey}}

View File

@ -65,8 +65,12 @@ No model defined in this package
- **API key parameter name**: {{keyParamName}} - **API key parameter name**: {{keyParamName}}
- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}} - **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}}
{{/isApiKey}} {{/isApiKey}}
{{#isBasic}}- **Type**: HTTP basic authentication {{#isBasicBasic}}- **Type**: HTTP basic authentication
{{/isBasic}} {{/isBasicBasic}}
{{#isBasicBearer}}- **Type**: HTTP Bearer Token authentication{{#bearerFormat}} ({{{.}}}){{/bearerFormat}}
{{/isBasicBearer}}
{{#isHttpSignature}}- **Type**: HTTP signature authentication
{{/isHttpSignature}}
{{#isOAuth}}- **Type**: OAuth {{#isOAuth}}- **Type**: OAuth
- **Flow**: {{flow}} - **Flow**: {{flow}}
- **Authorization URL**: {{authorizationUrl}} - **Authorization URL**: {{authorizationUrl}}

View File

@ -85,7 +85,7 @@ fun Application.main() {
{{#hasAuthMethods}} {{#hasAuthMethods}}
install(Authentication) { install(Authentication) {
{{#authMethods}} {{#authMethods}}
{{#isBasic}} {{#isBasicBasic}}
basic("{{{name}}}") { basic("{{{name}}}") {
validate { credentials -> validate { credentials ->
// TODO: "Apply your basic authentication functionality." // TODO: "Apply your basic authentication functionality."
@ -96,7 +96,7 @@ fun Application.main() {
null null
} }
} }
{{/isBasic}} {{/isBasicBasic}}
{{#isApiKey}} {{#isApiKey}}
// "Implement API key auth ({{{name}}}) for parameter name '{{{keyParamName}}}'." // "Implement API key auth ({{{name}}}) for parameter name '{{{keyParamName}}}'."
apiKeyAuth("{{{name}}}") { apiKeyAuth("{{{name}}}") {

View File

@ -82,8 +82,12 @@ No model defined in this package
- **API key parameter name**: {{keyParamName}} - **API key parameter name**: {{keyParamName}}
- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}} - **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}}
{{/isApiKey}} {{/isApiKey}}
{{#isBasic}}- **Type**: HTTP basic authentication {{#isBasicBasic}}- **Type**: HTTP basic authentication
{{/isBasic}} {{/isBasicBasic}}
{{#isBasicBearer}}- **Type**: HTTP Bearer Token authentication{{#bearerFormat}} ({{{.}}}){{/bearerFormat}}
{{/isBasicBearer}}
{{#isHttpSignature}}- **Type**: HTTP signature authentication
{{/isHttpSignature}}
{{#isOAuth}}- **Type**: OAuth {{#isOAuth}}- **Type**: OAuth
- **Flow**: {{flow}} - **Flow**: {{flow}}
- **Authorization URL**: {{authorizationUrl}} - **Authorization URL**: {{authorizationUrl}}

View File

@ -1,7 +1,7 @@
{{#authMethods}} {{#authMethods}}
{{#isBasic}} {{#isBasicBasic}}
val principal = call.authentication.principal<UserIdPrincipal>()!! val principal = call.authentication.principal<UserIdPrincipal>()!!
{{/isBasic}} {{/isBasicBasic}}
{{#isApiKey}} {{#isApiKey}}
val principal = call.authentication.principal<ApiPrincipal>()!! val principal = call.authentication.principal<ApiPrincipal>()!!
{{/isApiKey}} {{/isApiKey}}

View File

@ -20,28 +20,28 @@ This runs all tests and packages the library.
* Some Kotlin and Java types are fully qualified to avoid conflicts with types defined in OpenAPI definitions. * Some Kotlin and Java types are fully qualified to avoid conflicts with types defined in OpenAPI definitions.
{{#generateApiDocs}} {{#generateApiDocs}}
<a id="documentation-for-api-endpoints"></a> <a id="documentation-for-api-endpoints"></a>
## Documentation for API Endpoints ## Documentation for API Endpoints
All URIs are relative to *{{{basePath}}}* All URIs are relative to *{{{basePath}}}*
Class | Method | HTTP request | Description Class | Method | HTTP request | Description
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{{summary}}} {{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{{summary}}}
{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}} {{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}
{{/generateApiDocs}} {{/generateApiDocs}}
{{#generateModelDocs}} {{#generateModelDocs}}
<a id="documentation-for-models"></a> <a id="documentation-for-models"></a>
## Documentation for Models ## Documentation for Models
{{#modelPackage}} {{#modelPackage}}
{{#models}}{{#model}} - [{{{modelPackage}}}.{{{classname}}}]({{modelDocPath}}{{{classname}}}.md) {{#models}}{{#model}} - [{{{modelPackage}}}.{{{classname}}}]({{modelDocPath}}{{{classname}}}.md)
{{/model}}{{/models}} {{/model}}{{/models}}
{{/modelPackage}} {{/modelPackage}}
{{^modelPackage}} {{^modelPackage}}
No model defined in this package No model defined in this package
{{/modelPackage}} {{/modelPackage}}
{{/generateModelDocs}} {{/generateModelDocs}}
<a id="documentation-for-authorization"></a> <a id="documentation-for-authorization"></a>
@ -50,21 +50,25 @@ This runs all tests and packages the library.
{{^authMethods}}Endpoints do not require authorization.{{/authMethods}} {{^authMethods}}Endpoints do not require authorization.{{/authMethods}}
{{#hasAuthMethods}}Authentication schemes defined for the API:{{/hasAuthMethods}} {{#hasAuthMethods}}Authentication schemes defined for the API:{{/hasAuthMethods}}
{{#authMethods}} {{#authMethods}}
<a id="{{name}}"></a> <a id="{{name}}"></a>
### {{name}} ### {{name}}
{{#isApiKey}}- **Type**: API key {{#isApiKey}}- **Type**: API key
- **API key parameter name**: {{keyParamName}} - **API key parameter name**: {{keyParamName}}
- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}} - **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}}
{{/isApiKey}} {{/isApiKey}}
{{#isBasic}}- **Type**: HTTP basic authentication {{#isBasicBasic}}- **Type**: HTTP basic authentication
{{/isBasic}} {{/isBasicBasic}}
{{#isOAuth}}- **Type**: OAuth {{#isBasicBearer}}- **Type**: HTTP Bearer Token authentication{{#bearerFormat}} ({{{.}}}){{/bearerFormat}}
- **Flow**: {{flow}} {{/isBasicBearer}}
- **Authorization URL**: {{authorizationUrl}} {{#isHttpSignature}}- **Type**: HTTP signature authentication
- **Scopes**: {{^scopes}}N/A{{/scopes}} {{/isHttpSignature}}
{{#scopes}} - {{scope}}: {{description}} {{#isOAuth}}- **Type**: OAuth
{{/scopes}} - **Flow**: {{flow}}
{{/isOAuth}} - **Authorization URL**: {{authorizationUrl}}
- **Scopes**: {{^scopes}}N/A{{/scopes}}
{{#scopes}} - {{scope}}: {{description}}
{{/scopes}}
{{/isOAuth}}
{{/authMethods}} {{/authMethods}}

View File

@ -143,9 +143,9 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
setUserAgent("{{#httpUserAgent}}{{{.}}}{{/httpUserAgent}}{{^httpUserAgent}}OpenAPI-Generator/{{{artifactVersion}}}/java{{/httpUserAgent}}"); setUserAgent("{{#httpUserAgent}}{{{.}}}{{/httpUserAgent}}{{^httpUserAgent}}OpenAPI-Generator/{{{artifactVersion}}}/java{{/httpUserAgent}}");
// Setup authentications (key: authentication name, value: authentication). // Setup authentications (key: authentication name, value: authentication).
authentications = new HashMap<String, Authentication>();{{#authMethods}}{{#isBasic}}{{#isBasicBasic}} authentications = new HashMap<String, Authentication>();{{#authMethods}}{{#isBasicBasic}}
authentications.put("{{name}}", new HttpBasicAuth());{{/isBasicBasic}}{{^isBasicBasic}} authentications.put("{{name}}", new HttpBasicAuth());{{/isBasicBasic}}{{#isBasicBearer}}
authentications.put("{{name}}", new HttpBearerAuth("{{scheme}}"));{{/isBasicBasic}}{{/isBasic}}{{#isApiKey}} authentications.put("{{name}}", new HttpBearerAuth("{{scheme}}"));{{/isBasicBearer}}{{#isApiKey}}
authentications.put("{{name}}", new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{^isKeyInHeader}}"query"{{/isKeyInHeader}}, "{{keyParamName}}"));{{/isApiKey}}{{#isOAuth}} authentications.put("{{name}}", new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{^isKeyInHeader}}"query"{{/isKeyInHeader}}, "{{keyParamName}}"));{{/isApiKey}}{{#isOAuth}}
authentications.put("{{name}}", new OAuth());{{/isOAuth}}{{/authMethods}} authentications.put("{{name}}", new OAuth());{{/isOAuth}}{{/authMethods}}
// Prevent the authentications from being modified. // Prevent the authentications from being modified.

View File

@ -43,7 +43,6 @@ paths:
'405': '405':
description: Invalid input description: Invalid input
security: security:
- http_signature_test: []
- petstore_auth: - petstore_auth:
- 'write:pets' - 'write:pets'
- 'read:pets' - 'read:pets'
@ -63,7 +62,6 @@ paths:
'405': '405':
description: Validation exception description: Validation exception
security: security:
- http_signature_test: []
- petstore_auth: - petstore_auth:
- 'write:pets' - 'write:pets'
- 'read:pets' - 'read:pets'
@ -110,7 +108,6 @@ paths:
'400': '400':
description: Invalid status value description: Invalid status value
security: security:
- http_signature_test: []
- petstore_auth: - petstore_auth:
- 'write:pets' - 'write:pets'
- 'read:pets' - 'read:pets'
@ -151,7 +148,6 @@ paths:
'400': '400':
description: Invalid tag value description: Invalid tag value
security: security:
- http_signature_test: []
- petstore_auth: - petstore_auth:
- 'write:pets' - 'write:pets'
- 'read:pets' - 'read:pets'
@ -1197,12 +1193,6 @@ components:
type: http type: http
scheme: bearer scheme: bearer
bearerFormat: JWT bearerFormat: JWT
http_signature_test:
# Test the 'HTTP signature' security scheme.
# Each HTTP request is cryptographically signed as specified
# in https://datatracker.ietf.org/doc/draft-cavage-http-signatures/
type: http
scheme: signature
schemas: schemas:
Foo: Foo:
type: object type: object

View File

@ -243,13 +243,13 @@ Authentication schemes defined for the API:
### bearer_test ### bearer_test
- **Type**: HTTP basic authentication - **Type**: HTTP Bearer Token authentication (JWT)
<a id="http_signature_test"></a> <a id="http_signature_test"></a>
### http_signature_test ### http_signature_test
- **Type**: HTTP basic authentication - **Type**: HTTP signature authentication
## Recommendation ## Recommendation

View File

@ -179,7 +179,6 @@ public class ApiClient extends JavaTimeFormatter {
authentications.put("api_key_query", new ApiKeyAuth("query", "api_key_query")); authentications.put("api_key_query", new ApiKeyAuth("query", "api_key_query"));
authentications.put("http_basic_test", new HttpBasicAuth()); authentications.put("http_basic_test", new HttpBasicAuth());
authentications.put("bearer_test", new HttpBearerAuth("bearer")); authentications.put("bearer_test", new HttpBearerAuth("bearer"));
authentications.put("http_signature_test", new HttpBearerAuth("signature"));
// Prevent the authentications from being modified. // Prevent the authentications from being modified.
authentications = Collections.unmodifiableMap(authentications); authentications = Collections.unmodifiableMap(authentications);

View File

@ -70,7 +70,7 @@ public class ApiClient {
} else if ("bearer_test".equals(authName)) { } else if ("bearer_test".equals(authName)) {
auth = new HttpBearerAuth("bearer"); auth = new HttpBearerAuth("bearer");
} else if ("http_signature_test".equals(authName)) { } else if ("http_signature_test".equals(authName)) {
auth = new HttpBearerAuth("signature"); throw new RuntimeException("auth name \"" + authName + "\" does not have a supported http scheme type");
} else { } else {
throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names"); throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names");
} }

View File

@ -276,13 +276,13 @@ Authentication schemes defined for the API:
### bearer_test ### bearer_test
- **Type**: HTTP basic authentication - **Type**: HTTP Bearer Token authentication (JWT)
<a id="http_signature_test"></a> <a id="http_signature_test"></a>
### http_signature_test ### http_signature_test
- **Type**: HTTP basic authentication - **Type**: HTTP signature authentication
## Recommendation ## Recommendation

View File

@ -308,13 +308,13 @@ Authentication schemes defined for the API:
### bearer_test ### bearer_test
- **Type**: HTTP basic authentication - **Type**: HTTP Bearer Token authentication (JWT)
<a id="http_signature_test"></a> <a id="http_signature_test"></a>
### http_signature_test ### http_signature_test
- **Type**: HTTP basic authentication - **Type**: HTTP signature authentication
## Recommendation ## Recommendation

View File

@ -307,13 +307,13 @@ Authentication schemes defined for the API:
### bearer_test ### bearer_test
- **Type**: HTTP basic authentication - **Type**: HTTP Bearer Token authentication (JWT)
<a id="http_signature_test"></a> <a id="http_signature_test"></a>
### http_signature_test ### http_signature_test
- **Type**: HTTP basic authentication - **Type**: HTTP signature authentication
## Recommendation ## Recommendation

View File

@ -275,12 +275,7 @@ Authentication schemes defined for the API:
<a id="bearer_test"></a> <a id="bearer_test"></a>
### bearer_test ### bearer_test
- **Type**: HTTP basic authentication - **Type**: HTTP Bearer Token authentication (JWT)
<a id="http_signature_test"></a>
### http_signature_test
- **Type**: HTTP basic authentication
## Recommendation ## Recommendation

View File

@ -61,7 +61,6 @@ paths:
"405": "405":
description: Invalid input description: Invalid input
security: security:
- http_signature_test: []
- petstore_auth: - petstore_auth:
- write:pets - write:pets
- read:pets - read:pets
@ -83,7 +82,6 @@ paths:
"405": "405":
description: Validation exception description: Validation exception
security: security:
- http_signature_test: []
- petstore_auth: - petstore_auth:
- write:pets - write:pets
- read:pets - read:pets
@ -133,7 +131,6 @@ paths:
"400": "400":
description: Invalid status value description: Invalid status value
security: security:
- http_signature_test: []
- petstore_auth: - petstore_auth:
- write:pets - write:pets
- read:pets - read:pets
@ -175,7 +172,6 @@ paths:
"400": "400":
description: Invalid tag value description: Invalid tag value
security: security:
- http_signature_test: []
- petstore_auth: - petstore_auth:
- write:pets - write:pets
- read:pets - read:pets
@ -2399,7 +2395,4 @@ components:
bearerFormat: JWT bearerFormat: JWT
scheme: bearer scheme: bearer
type: http type: http
http_signature_test:
scheme: signature
type: http

View File

@ -42,7 +42,6 @@ public class Example {
OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth");
petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); petstore_auth.setAccessToken("YOUR ACCESS TOKEN");
PetApi apiInstance = new PetApi(defaultClient); PetApi apiInstance = new PetApi(defaultClient);
Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store
try { try {
@ -70,7 +69,7 @@ null (empty response body)
### Authorization ### Authorization
[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) [petstore_auth](../README.md#petstore_auth)
### HTTP request headers ### HTTP request headers
@ -177,7 +176,6 @@ public class Example {
OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth");
petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); petstore_auth.setAccessToken("YOUR ACCESS TOKEN");
PetApi apiInstance = new PetApi(defaultClient); PetApi apiInstance = new PetApi(defaultClient);
List<String> status = Arrays.asList("available"); // List<String> | Status values that need to be considered for filter List<String> status = Arrays.asList("available"); // List<String> | Status values that need to be considered for filter
try { try {
@ -206,7 +204,7 @@ public class Example {
### Authorization ### Authorization
[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) [petstore_auth](../README.md#petstore_auth)
### HTTP request headers ### HTTP request headers
@ -246,7 +244,6 @@ public class Example {
OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth");
petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); petstore_auth.setAccessToken("YOUR ACCESS TOKEN");
PetApi apiInstance = new PetApi(defaultClient); PetApi apiInstance = new PetApi(defaultClient);
List<String> tags = Arrays.asList(); // List<String> | Tags to filter by List<String> tags = Arrays.asList(); // List<String> | Tags to filter by
try { try {
@ -275,7 +272,7 @@ public class Example {
### Authorization ### Authorization
[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) [petstore_auth](../README.md#petstore_auth)
### HTTP request headers ### HTTP request headers
@ -386,7 +383,6 @@ public class Example {
OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth");
petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); petstore_auth.setAccessToken("YOUR ACCESS TOKEN");
PetApi apiInstance = new PetApi(defaultClient); PetApi apiInstance = new PetApi(defaultClient);
Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store
try { try {
@ -414,7 +410,7 @@ null (empty response body)
### Authorization ### Authorization
[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) [petstore_auth](../README.md#petstore_auth)
### HTTP request headers ### HTTP request headers

View File

@ -152,7 +152,6 @@ public class ApiClient {
authentications.put("api_key_query", new ApiKeyAuth("query", "api_key_query")); authentications.put("api_key_query", new ApiKeyAuth("query", "api_key_query"));
authentications.put("http_basic_test", new HttpBasicAuth()); authentications.put("http_basic_test", new HttpBasicAuth());
authentications.put("bearer_test", new HttpBearerAuth("bearer")); authentications.put("bearer_test", new HttpBearerAuth("bearer"));
authentications.put("http_signature_test", new HttpBearerAuth("signature"));
// Prevent the authentications from being modified. // Prevent the authentications from being modified.
authentications = Collections.unmodifiableMap(authentications); authentications = Collections.unmodifiableMap(authentications);
} }
@ -173,7 +172,6 @@ public class ApiClient {
authentications.put("api_key_query", new ApiKeyAuth("query", "api_key_query")); authentications.put("api_key_query", new ApiKeyAuth("query", "api_key_query"));
authentications.put("http_basic_test", new HttpBasicAuth()); authentications.put("http_basic_test", new HttpBasicAuth());
authentications.put("bearer_test", new HttpBearerAuth("bearer")); authentications.put("bearer_test", new HttpBearerAuth("bearer"));
authentications.put("http_signature_test", new HttpBearerAuth("signature"));
// Prevent the authentications from being modified. // Prevent the authentications from being modified.
authentications = Collections.unmodifiableMap(authentications); authentications = Collections.unmodifiableMap(authentications);
} }
@ -243,7 +241,6 @@ public class ApiClient {
authentications.put("api_key_query", new ApiKeyAuth("query", "api_key_query")); authentications.put("api_key_query", new ApiKeyAuth("query", "api_key_query"));
authentications.put("http_basic_test", new HttpBasicAuth()); authentications.put("http_basic_test", new HttpBasicAuth());
authentications.put("bearer_test", new HttpBearerAuth("bearer")); authentications.put("bearer_test", new HttpBearerAuth("bearer"));
authentications.put("http_signature_test", new HttpBearerAuth("signature"));
// Prevent the authentications from being modified. // Prevent the authentications from being modified.
authentications = Collections.unmodifiableMap(authentications); authentications = Collections.unmodifiableMap(authentications);

View File

@ -128,7 +128,7 @@ public class PetApi {
localVarHeaderParams.put("Content-Type", localVarContentType); 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); 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); 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); 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); 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); 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); 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); return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
} }

View File

@ -250,13 +250,13 @@ Authentication schemes defined for the API:
### bearer_test ### bearer_test
- **Type**: HTTP basic authentication - **Type**: HTTP Bearer Token authentication (JWT)
<a id="http_signature_test"></a> <a id="http_signature_test"></a>
### http_signature_test ### http_signature_test
- **Type**: HTTP basic authentication - **Type**: HTTP signature authentication
## Recommendation ## Recommendation

View File

@ -152,7 +152,6 @@ public class ApiClient extends JavaTimeFormatter {
authentications.put("api_key_query", new ApiKeyAuth("query", "api_key_query")); authentications.put("api_key_query", new ApiKeyAuth("query", "api_key_query"));
authentications.put("http_basic_test", new HttpBasicAuth()); authentications.put("http_basic_test", new HttpBasicAuth());
authentications.put("bearer_test", new HttpBearerAuth("bearer")); authentications.put("bearer_test", new HttpBearerAuth("bearer"));
authentications.put("http_signature_test", new HttpBearerAuth("signature"));
// Prevent the authentications from being modified. // Prevent the authentications from being modified.
authentications = Collections.unmodifiableMap(authentications); authentications = Collections.unmodifiableMap(authentications);
} }

View File

@ -250,13 +250,13 @@ Authentication schemes defined for the API:
### bearer_test ### bearer_test
- **Type**: HTTP basic authentication - **Type**: HTTP Bearer Token authentication (JWT)
<a id="http_signature_test"></a> <a id="http_signature_test"></a>
### http_signature_test ### http_signature_test
- **Type**: HTTP basic authentication - **Type**: HTTP signature authentication
## Recommendation ## Recommendation

View File

@ -152,7 +152,6 @@ public class ApiClient extends JavaTimeFormatter {
authentications.put("api_key_query", new ApiKeyAuth("query", "api_key_query")); authentications.put("api_key_query", new ApiKeyAuth("query", "api_key_query"));
authentications.put("http_basic_test", new HttpBasicAuth()); authentications.put("http_basic_test", new HttpBasicAuth());
authentications.put("bearer_test", new HttpBearerAuth("bearer")); authentications.put("bearer_test", new HttpBearerAuth("bearer"));
authentications.put("http_signature_test", new HttpBearerAuth("signature"));
// Prevent the authentications from being modified. // Prevent the authentications from being modified.
authentications = Collections.unmodifiableMap(authentications); authentications = Collections.unmodifiableMap(authentications);
} }

View File

@ -301,13 +301,13 @@ Authentication schemes defined for the API:
### bearer_test ### bearer_test
- **Type**: HTTP basic authentication - **Type**: HTTP Bearer Token authentication (JWT)
<a id="http_signature_test"></a> <a id="http_signature_test"></a>
### http_signature_test ### http_signature_test
- **Type**: HTTP basic authentication - **Type**: HTTP signature authentication
## Recommendation ## Recommendation

View File

@ -19,37 +19,37 @@ This runs all tests and packages the library.
* Supports collection formats for query parameters: csv, tsv, ssv, pipes. * Supports collection formats for query parameters: csv, tsv, ssv, pipes.
* Some Kotlin and Java types are fully qualified to avoid conflicts with types defined in OpenAPI definitions. * Some Kotlin and Java types are fully qualified to avoid conflicts with types defined in OpenAPI definitions.
<a id="documentation-for-api-endpoints"></a> <a id="documentation-for-api-endpoints"></a>
## Documentation for API Endpoints ## Documentation for API Endpoints
All URIs are relative to *http://petstore.swagger.io/v2* All URIs are relative to *http://petstore.swagger.io/v2*
Class | Method | HTTP request | Description Class | Method | HTTP request | Description
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
*PetApi* | [**addPet**](docs/PetApi.md#addpet) | **POST** /pet | Add a new pet to the store *PetApi* | [**addPet**](docs/PetApi.md#addpet) | **POST** /pet | Add a new pet to the store
*PetApi* | [**deletePet**](docs/PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet *PetApi* | [**deletePet**](docs/PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet
*PetApi* | [**findPetsByStatus**](docs/PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status *PetApi* | [**findPetsByStatus**](docs/PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status
*PetApi* | [**findPetsByTags**](docs/PetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags *PetApi* | [**findPetsByTags**](docs/PetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags
*PetApi* | [**getPetById**](docs/PetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID *PetApi* | [**getPetById**](docs/PetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID
*PetApi* | [**updatePet**](docs/PetApi.md#updatepet) | **PUT** /pet | Update an existing pet *PetApi* | [**updatePet**](docs/PetApi.md#updatepet) | **PUT** /pet | Update an existing pet
*PetApi* | [**updatePetWithForm**](docs/PetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data *PetApi* | [**updatePetWithForm**](docs/PetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data
*PetApi* | [**uploadFile**](docs/PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image *PetApi* | [**uploadFile**](docs/PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image
*StoreApi* | [**deleteOrder**](docs/StoreApi.md#deleteorder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID *StoreApi* | [**deleteOrder**](docs/StoreApi.md#deleteorder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID
*StoreApi* | [**getInventory**](docs/StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status *StoreApi* | [**getInventory**](docs/StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status
*StoreApi* | [**getOrderById**](docs/StoreApi.md#getorderbyid) | **GET** /store/order/{orderId} | Find purchase order by ID *StoreApi* | [**getOrderById**](docs/StoreApi.md#getorderbyid) | **GET** /store/order/{orderId} | Find purchase order by ID
*StoreApi* | [**placeOrder**](docs/StoreApi.md#placeorder) | **POST** /store/order | Place an order for a pet *StoreApi* | [**placeOrder**](docs/StoreApi.md#placeorder) | **POST** /store/order | Place an order for a pet
*UserApi* | [**createUser**](docs/UserApi.md#createuser) | **POST** /user | Create user *UserApi* | [**createUser**](docs/UserApi.md#createuser) | **POST** /user | Create user
*UserApi* | [**createUsersWithArrayInput**](docs/UserApi.md#createuserswitharrayinput) | **POST** /user/createWithArray | Creates list of users with given input array *UserApi* | [**createUsersWithArrayInput**](docs/UserApi.md#createuserswitharrayinput) | **POST** /user/createWithArray | Creates list of users with given input array
*UserApi* | [**createUsersWithListInput**](docs/UserApi.md#createuserswithlistinput) | **POST** /user/createWithList | Creates list of users with given input array *UserApi* | [**createUsersWithListInput**](docs/UserApi.md#createuserswithlistinput) | **POST** /user/createWithList | Creates list of users with given input array
*UserApi* | [**deleteUser**](docs/UserApi.md#deleteuser) | **DELETE** /user/{username} | Delete user *UserApi* | [**deleteUser**](docs/UserApi.md#deleteuser) | **DELETE** /user/{username} | Delete user
*UserApi* | [**getUserByName**](docs/UserApi.md#getuserbyname) | **GET** /user/{username} | Get user by user name *UserApi* | [**getUserByName**](docs/UserApi.md#getuserbyname) | **GET** /user/{username} | Get user by user name
*UserApi* | [**loginUser**](docs/UserApi.md#loginuser) | **GET** /user/login | Logs user into the system *UserApi* | [**loginUser**](docs/UserApi.md#loginuser) | **GET** /user/login | Logs user into the system
*UserApi* | [**logoutUser**](docs/UserApi.md#logoutuser) | **GET** /user/logout | Logs out current logged in user session *UserApi* | [**logoutUser**](docs/UserApi.md#logoutuser) | **GET** /user/logout | Logs out current logged in user session
*UserApi* | [**updateUser**](docs/UserApi.md#updateuser) | **PUT** /user/{username} | Updated user *UserApi* | [**updateUser**](docs/UserApi.md#updateuser) | **PUT** /user/{username} | Updated user
<a id="documentation-for-models"></a> <a id="documentation-for-models"></a>
## Documentation for Models ## Documentation for Models
- [org.openapitools.server.api.model.Category](docs/Category.md) - [org.openapitools.server.api.model.Category](docs/Category.md)
- [org.openapitools.server.api.model.ModelApiResponse](docs/ModelApiResponse.md) - [org.openapitools.server.api.model.ModelApiResponse](docs/ModelApiResponse.md)
@ -64,20 +64,20 @@ This runs all tests and packages the library.
Authentication schemes defined for the API: Authentication schemes defined for the API:
<a id="petstore_auth"></a> <a id="petstore_auth"></a>
### petstore_auth ### petstore_auth
- **Type**: OAuth - **Type**: OAuth
- **Flow**: implicit - **Flow**: implicit
- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog - **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog
- **Scopes**: - **Scopes**:
- write:pets: modify pets in your account - write:pets: modify pets in your account
- read:pets: read your pets - read:pets: read your pets
<a id="api_key"></a> <a id="api_key"></a>
### api_key ### api_key
- **Type**: API key - **Type**: API key
- **API key parameter name**: api_key - **API key parameter name**: api_key
- **Location**: HTTP header - **Location**: HTTP header

View File

@ -19,37 +19,37 @@ This runs all tests and packages the library.
* Supports collection formats for query parameters: csv, tsv, ssv, pipes. * Supports collection formats for query parameters: csv, tsv, ssv, pipes.
* Some Kotlin and Java types are fully qualified to avoid conflicts with types defined in OpenAPI definitions. * Some Kotlin and Java types are fully qualified to avoid conflicts with types defined in OpenAPI definitions.
<a id="documentation-for-api-endpoints"></a> <a id="documentation-for-api-endpoints"></a>
## Documentation for API Endpoints ## Documentation for API Endpoints
All URIs are relative to *http://petstore.swagger.io/v2* All URIs are relative to *http://petstore.swagger.io/v2*
Class | Method | HTTP request | Description Class | Method | HTTP request | Description
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
*PetApi* | [**addPet**](docs/PetApi.md#addpet) | **POST** /pet | Add a new pet to the store *PetApi* | [**addPet**](docs/PetApi.md#addpet) | **POST** /pet | Add a new pet to the store
*PetApi* | [**deletePet**](docs/PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet *PetApi* | [**deletePet**](docs/PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet
*PetApi* | [**findPetsByStatus**](docs/PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status *PetApi* | [**findPetsByStatus**](docs/PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status
*PetApi* | [**findPetsByTags**](docs/PetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags *PetApi* | [**findPetsByTags**](docs/PetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags
*PetApi* | [**getPetById**](docs/PetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID *PetApi* | [**getPetById**](docs/PetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID
*PetApi* | [**updatePet**](docs/PetApi.md#updatepet) | **PUT** /pet | Update an existing pet *PetApi* | [**updatePet**](docs/PetApi.md#updatepet) | **PUT** /pet | Update an existing pet
*PetApi* | [**updatePetWithForm**](docs/PetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data *PetApi* | [**updatePetWithForm**](docs/PetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data
*PetApi* | [**uploadFile**](docs/PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image *PetApi* | [**uploadFile**](docs/PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image
*StoreApi* | [**deleteOrder**](docs/StoreApi.md#deleteorder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID *StoreApi* | [**deleteOrder**](docs/StoreApi.md#deleteorder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID
*StoreApi* | [**getInventory**](docs/StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status *StoreApi* | [**getInventory**](docs/StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status
*StoreApi* | [**getOrderById**](docs/StoreApi.md#getorderbyid) | **GET** /store/order/{orderId} | Find purchase order by ID *StoreApi* | [**getOrderById**](docs/StoreApi.md#getorderbyid) | **GET** /store/order/{orderId} | Find purchase order by ID
*StoreApi* | [**placeOrder**](docs/StoreApi.md#placeorder) | **POST** /store/order | Place an order for a pet *StoreApi* | [**placeOrder**](docs/StoreApi.md#placeorder) | **POST** /store/order | Place an order for a pet
*UserApi* | [**createUser**](docs/UserApi.md#createuser) | **POST** /user | Create user *UserApi* | [**createUser**](docs/UserApi.md#createuser) | **POST** /user | Create user
*UserApi* | [**createUsersWithArrayInput**](docs/UserApi.md#createuserswitharrayinput) | **POST** /user/createWithArray | Creates list of users with given input array *UserApi* | [**createUsersWithArrayInput**](docs/UserApi.md#createuserswitharrayinput) | **POST** /user/createWithArray | Creates list of users with given input array
*UserApi* | [**createUsersWithListInput**](docs/UserApi.md#createuserswithlistinput) | **POST** /user/createWithList | Creates list of users with given input array *UserApi* | [**createUsersWithListInput**](docs/UserApi.md#createuserswithlistinput) | **POST** /user/createWithList | Creates list of users with given input array
*UserApi* | [**deleteUser**](docs/UserApi.md#deleteuser) | **DELETE** /user/{username} | Delete user *UserApi* | [**deleteUser**](docs/UserApi.md#deleteuser) | **DELETE** /user/{username} | Delete user
*UserApi* | [**getUserByName**](docs/UserApi.md#getuserbyname) | **GET** /user/{username} | Get user by user name *UserApi* | [**getUserByName**](docs/UserApi.md#getuserbyname) | **GET** /user/{username} | Get user by user name
*UserApi* | [**loginUser**](docs/UserApi.md#loginuser) | **GET** /user/login | Logs user into the system *UserApi* | [**loginUser**](docs/UserApi.md#loginuser) | **GET** /user/login | Logs user into the system
*UserApi* | [**logoutUser**](docs/UserApi.md#logoutuser) | **GET** /user/logout | Logs out current logged in user session *UserApi* | [**logoutUser**](docs/UserApi.md#logoutuser) | **GET** /user/logout | Logs out current logged in user session
*UserApi* | [**updateUser**](docs/UserApi.md#updateuser) | **PUT** /user/{username} | Updated user *UserApi* | [**updateUser**](docs/UserApi.md#updateuser) | **PUT** /user/{username} | Updated user
<a id="documentation-for-models"></a> <a id="documentation-for-models"></a>
## Documentation for Models ## Documentation for Models
- [org.openapitools.server.api.model.Category](docs/Category.md) - [org.openapitools.server.api.model.Category](docs/Category.md)
- [org.openapitools.server.api.model.ModelApiResponse](docs/ModelApiResponse.md) - [org.openapitools.server.api.model.ModelApiResponse](docs/ModelApiResponse.md)
@ -64,20 +64,20 @@ This runs all tests and packages the library.
Authentication schemes defined for the API: Authentication schemes defined for the API:
<a id="petstore_auth"></a> <a id="petstore_auth"></a>
### petstore_auth ### petstore_auth
- **Type**: OAuth - **Type**: OAuth
- **Flow**: implicit - **Flow**: implicit
- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog - **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog
- **Scopes**: - **Scopes**:
- write:pets: modify pets in your account - write:pets: modify pets in your account
- read:pets: read your pets - read:pets: read your pets
<a id="api_key"></a> <a id="api_key"></a>
### api_key ### api_key
- **Type**: API key - **Type**: API key
- **API key parameter name**: api_key - **API key parameter name**: api_key
- **Location**: HTTP header - **Location**: HTTP header