mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-06-30 20:50:53 +00:00
[C] fix use of isBasic condition (#15534)
This commit is contained in:
parent
8aa8a60754
commit
ce587c7b57
@ -90,10 +90,18 @@ Category | 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
|
||||||
|
@ -18,10 +18,10 @@ apiClient_t *apiClient_create() {
|
|||||||
apiClient->response_code = 0;
|
apiClient->response_code = 0;
|
||||||
{{#hasAuthMethods}}
|
{{#hasAuthMethods}}
|
||||||
{{#authMethods}}
|
{{#authMethods}}
|
||||||
{{#isBasic}}
|
{{#isBasicBasic}}
|
||||||
apiClient->username = NULL;
|
apiClient->username = NULL;
|
||||||
apiClient->password = NULL;
|
apiClient->password = NULL;
|
||||||
{{/isBasic}}
|
{{/isBasicBasic}}
|
||||||
{{#isOAuth}}
|
{{#isOAuth}}
|
||||||
apiClient->accessToken = NULL;
|
apiClient->accessToken = NULL;
|
||||||
{{/isOAuth}}
|
{{/isOAuth}}
|
||||||
@ -65,10 +65,10 @@ apiClient_t *apiClient_create_with_base_path(const char *basePath
|
|||||||
apiClient->response_code = 0;
|
apiClient->response_code = 0;
|
||||||
{{#hasAuthMethods}}
|
{{#hasAuthMethods}}
|
||||||
{{#authMethods}}
|
{{#authMethods}}
|
||||||
{{#isBasic}}
|
{{#isBasicBasic}}
|
||||||
apiClient->username = NULL;
|
apiClient->username = NULL;
|
||||||
apiClient->password = NULL;
|
apiClient->password = NULL;
|
||||||
{{/isBasic}}
|
{{/isBasicBasic}}
|
||||||
{{#isOAuth}}
|
{{#isOAuth}}
|
||||||
apiClient->accessToken = NULL;
|
apiClient->accessToken = NULL;
|
||||||
{{/isOAuth}}
|
{{/isOAuth}}
|
||||||
@ -100,14 +100,14 @@ void apiClient_free(apiClient_t *apiClient) {
|
|||||||
apiClient->progress_data = NULL;
|
apiClient->progress_data = NULL;
|
||||||
{{#hasAuthMethods}}
|
{{#hasAuthMethods}}
|
||||||
{{#authMethods}}
|
{{#authMethods}}
|
||||||
{{#isBasic}}
|
{{#isBasicBasic}}
|
||||||
if(apiClient->username) {
|
if(apiClient->username) {
|
||||||
free(apiClient->username);
|
free(apiClient->username);
|
||||||
}
|
}
|
||||||
if(apiClient->password) {
|
if(apiClient->password) {
|
||||||
free(apiClient->password);
|
free(apiClient->password);
|
||||||
}
|
}
|
||||||
{{/isBasic}}
|
{{/isBasicBasic}}
|
||||||
{{#isOAuth}}
|
{{#isOAuth}}
|
||||||
if(apiClient->accessToken) {
|
if(apiClient->accessToken) {
|
||||||
free(apiClient->accessToken);
|
free(apiClient->accessToken);
|
||||||
@ -487,7 +487,7 @@ void apiClient_invoke(apiClient_t *apiClient,
|
|||||||
|
|
||||||
{{#hasAuthMethods}}
|
{{#hasAuthMethods}}
|
||||||
{{#authMethods}}
|
{{#authMethods}}
|
||||||
{{#isBasic}}
|
{{#isBasicBasic}}
|
||||||
// this would only be generated for basic authentication:
|
// this would only be generated for basic authentication:
|
||||||
char *authenticationToken;
|
char *authenticationToken;
|
||||||
|
|
||||||
@ -511,7 +511,7 @@ void apiClient_invoke(apiClient_t *apiClient,
|
|||||||
CURLOPT_USERPWD,
|
CURLOPT_USERPWD,
|
||||||
authenticationToken);
|
authenticationToken);
|
||||||
}
|
}
|
||||||
{{/isBasic}}
|
{{/isBasicBasic}}
|
||||||
{{#isOAuth}}
|
{{#isOAuth}}
|
||||||
// this would only be generated for OAuth2 authentication
|
// this would only be generated for OAuth2 authentication
|
||||||
if(apiClient->accessToken != NULL) {
|
if(apiClient->accessToken != NULL) {
|
||||||
@ -548,13 +548,13 @@ void apiClient_invoke(apiClient_t *apiClient,
|
|||||||
}
|
}
|
||||||
{{#hasAuthMethods}}
|
{{#hasAuthMethods}}
|
||||||
{{#authMethods}}
|
{{#authMethods}}
|
||||||
{{#isBasic}}
|
{{#isBasicBasic}}
|
||||||
if((apiClient->username != NULL) &&
|
if((apiClient->username != NULL) &&
|
||||||
(apiClient->password != NULL) )
|
(apiClient->password != NULL) )
|
||||||
{
|
{
|
||||||
free(authenticationToken);
|
free(authenticationToken);
|
||||||
}
|
}
|
||||||
{{/isBasic}}
|
{{/isBasicBasic}}
|
||||||
{{/authMethods}}
|
{{/authMethods}}
|
||||||
{{/hasAuthMethods}}
|
{{/hasAuthMethods}}
|
||||||
|
|
||||||
|
@ -30,10 +30,10 @@ typedef struct apiClient_t {
|
|||||||
long response_code;
|
long response_code;
|
||||||
{{#hasAuthMethods}}
|
{{#hasAuthMethods}}
|
||||||
{{#authMethods}}
|
{{#authMethods}}
|
||||||
{{#isBasic}}
|
{{#isBasicBasic}}
|
||||||
char *username;
|
char *username;
|
||||||
char *password;
|
char *password;
|
||||||
{{/isBasic}}
|
{{/isBasicBasic}}
|
||||||
{{#isOAuth}}
|
{{#isOAuth}}
|
||||||
char *accessToken;
|
char *accessToken;
|
||||||
{{/isOAuth}}
|
{{/isOAuth}}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user