Skip to content

Commit

Permalink
Merge branch 'master' into PHRAS-3918_subdef-substituable-setting
Browse files Browse the repository at this point in the history
  • Loading branch information
nmaillat authored Oct 17, 2023
2 parents 712f765 + 16353c3 commit 9ad38f1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1355,7 +1355,7 @@ private function getAndSaveToken($exposeName)
$accessToken = $tokenInfo['access_token'];
} elseif (is_array($tokenInfo) && $tokenInfo['expires_at'] > time()) {
$accessToken = $tokenInfo['access_token'];
} elseif (is_array($tokenInfo) && $tokenInfo['expires_at'] <= time() && $tokenInfo['refresh_expires_at'] > time()) {
} elseif (is_array($tokenInfo) && $tokenInfo['expires_at'] <= time() && isset($tokenInfo['refresh_expires_at']) && $tokenInfo['refresh_expires_at'] > time()) {
$resToken = $this->refreshToken($oauthClient, $config, $tokenInfo['refresh_token']);

if ($resToken->getStatusCode() !== 200) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ public function process(array $payload)
'publication_id' => $payload['publicationId'],
'description' => $description,
'asset_id' => $assetId,
'title' => $record->get_title(),
'upload' => [
'type' => $record->get_subdef($phraseanetSubdefAsDocument)->get_mime(),
'size' => $record->get_subdef($phraseanetSubdefAsDocument)->get_size(),
Expand Down Expand Up @@ -472,9 +473,9 @@ private function getToken()
if ($this->exposeConfiguration['connection_kind'] == 'password') {
if (!isset($this->accessTokenInfo['expires_at'])) {
return $this->accessTokenInfo['access_token'];
} elseif ($this->accessTokenInfo['expires_at'] > time() && $this->accessTokenInfo['refresh_expires_at'] > time()) {
} elseif ($this->accessTokenInfo['expires_at'] > time()) {
return $this->accessTokenInfo['access_token'];
} elseif ($this->accessTokenInfo['expires_at'] <= time() && $this->accessTokenInfo['refresh_expires_at'] > time()) {
} elseif ($this->accessTokenInfo['expires_at'] <= time() && isset($tokenInfo['refresh_expires_at']) && $this->accessTokenInfo['refresh_expires_at'] > time()) {
$resToken = $oauthClient->post($this->exposeConfiguration['oauth_token_uri'], [
'form_params' => [
'client_id' => $this->exposeConfiguration['auth_client_id'],
Expand Down
2 changes: 1 addition & 1 deletion templates/web/admin/phraseanet-service/expose.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
{{ form_row(form.expose_client_id) }}
</div>

<div class="control-group auth-field">
<div class="control-group">
{{ form_label(form.oauth_token_uri) }}
<div style="margin-top: 10px; margin-bottom: 10px;">
expose v2 : https://api-auth.phrasea.local/oauth/v2/token
Expand Down

0 comments on commit 9ad38f1

Please sign in to comment.