updated plugin WP Mail SMTP version 2.3.1

This commit is contained in:
2020-08-24 15:45:02 +00:00
committed by Gitium
parent be08bbbabd
commit fd5eaaad6c
66 changed files with 3703 additions and 1342 deletions

View File

@ -25,6 +25,7 @@ use Google\Auth\Iam;
use Google\Auth\ProjectIdProviderInterface;
use Google\Auth\SignBlobInterface;
use GuzzleHttp\Exception\ClientException;
use GuzzleHttp\Exception\ConnectException;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Exception\ServerException;
use GuzzleHttp\Psr7\Request;
@ -283,6 +284,7 @@ class GCECredentials extends CredentialsLoader implements
} catch (ClientException $e) {
} catch (ServerException $e) {
} catch (RequestException $e) {
} catch (ConnectException $e) {
}
}
return false;

View File

@ -84,14 +84,23 @@ class FetchAuthTokenCache implements
// TODO: correct caching; enable the cache to be cleared.
$cacheKey = $this->fetcher->getCacheKey();
$cached = $this->getCachedValue($cacheKey);
if (!empty($cached)) {
return ['access_token' => $cached];
if (is_array($cached)) {
if (empty($cached['expires_at'])) {
// If there is no expiration data, assume token is not expired.
// (for JwtAccess and ID tokens)
return $cached;
}
if (time() < $cached['expires_at']) {
// access token is not expired
return $cached;
}
}
$auth_token = $this->fetcher->fetchAuthToken($httpHandler);
if (isset($auth_token['access_token'])) {
$this->setCachedValue($cacheKey, $auth_token['access_token']);
if (isset($auth_token['access_token']) ||
isset($auth_token['id_token'])) {
$this->setCachedValue($cacheKey, $auth_token);
}
return $auth_token;

View File

@ -124,7 +124,11 @@ class AuthTokenMiddleware
if (array_key_exists('access_token', $auth_tokens)) {
// notify the callback if applicable
if ($this->tokenCallback) {
call_user_func($this->tokenCallback, $this->fetcher->getCacheKey(), $auth_tokens['access_token']);
call_user_func(
$this->tokenCallback,
$this->fetcher->getCacheKey(),
$auth_tokens['access_token']
);
}
return $auth_tokens['access_token'];

View File

@ -543,6 +543,10 @@ class OAuth2 implements FetchAuthTokenInterface
return implode(':', $this->scope);
}
if ($this->audience) {
return $this->audience;
}
// If scope has not set, return null to indicate no caching.
return null;
}