[PHP] Fix checking value of Configuration::getAccessToken() (#11486)

* Prevents empty access token from overriding basic auth
This commit is contained in:
Juan Treminio 2022-02-10 02:01:16 -06:00 committed by GitHub
parent 376bf6cd34
commit 15501f10c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 11 deletions

View File

@ -636,14 +636,14 @@ use {{invokerPackage}}\ObjectSerializer;
{{/isBasicBasic}}
{{#isBasicBearer}}
// this endpoint requires Bearer{{#bearerFormat}} ({{{.}}}){{/bearerFormat}} authentication (access token)
if ($this->config->getAccessToken() !== null) {
if (!empty($this->config->getAccessToken())) {
$headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
}
{{/isBasicBearer}}
{{/isBasic}}
{{#isOAuth}}
// this endpoint requires OAuth (access token)
if ($this->config->getAccessToken() !== null) {
if (!empty($this->config->getAccessToken())) {
$headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
}
{{/isOAuth}}

View File

@ -3867,7 +3867,7 @@ class FakeApi
}
// this endpoint requires Bearer (JWT) authentication (access token)
if ($this->config->getAccessToken() !== null) {
if (!empty($this->config->getAccessToken())) {
$headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
}

View File

@ -339,7 +339,7 @@ class PetApi
}
// this endpoint requires OAuth (access token)
if ($this->config->getAccessToken() !== null) {
if (!empty($this->config->getAccessToken())) {
$headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
}
@ -584,7 +584,7 @@ class PetApi
}
// this endpoint requires OAuth (access token)
if ($this->config->getAccessToken() !== null) {
if (!empty($this->config->getAccessToken())) {
$headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
}
@ -858,7 +858,7 @@ class PetApi
}
// this endpoint requires OAuth (access token)
if ($this->config->getAccessToken() !== null) {
if (!empty($this->config->getAccessToken())) {
$headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
}
@ -1138,7 +1138,7 @@ class PetApi
}
// this endpoint requires OAuth (access token)
if ($this->config->getAccessToken() !== null) {
if (!empty($this->config->getAccessToken())) {
$headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
}
@ -1662,7 +1662,7 @@ class PetApi
}
// this endpoint requires OAuth (access token)
if ($this->config->getAccessToken() !== null) {
if (!empty($this->config->getAccessToken())) {
$headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
}
@ -1916,7 +1916,7 @@ class PetApi
}
// this endpoint requires OAuth (access token)
if ($this->config->getAccessToken() !== null) {
if (!empty($this->config->getAccessToken())) {
$headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
}
@ -2217,7 +2217,7 @@ class PetApi
}
// this endpoint requires OAuth (access token)
if ($this->config->getAccessToken() !== null) {
if (!empty($this->config->getAccessToken())) {
$headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
}
@ -2524,7 +2524,7 @@ class PetApi
}
// this endpoint requires OAuth (access token)
if ($this->config->getAccessToken() !== null) {
if (!empty($this->config->getAccessToken())) {
$headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
}