mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-24 23:37:51 +01:00
Miglioramenti minori OAuth2
This commit is contained in:
parent
74665d4a88
commit
be86c40a6f
@ -162,7 +162,7 @@ class FatturaOrdinaria extends FatturaElettronica
|
|||||||
if (!empty($articolo)) {
|
if (!empty($articolo)) {
|
||||||
$articolo->idconto_acquisto = $conto[$key];
|
$articolo->idconto_acquisto = $conto[$key];
|
||||||
$articolo->save();
|
$articolo->save();
|
||||||
|
|
||||||
$obj = Articolo::build($fattura, $articolo);
|
$obj = Articolo::build($fattura, $articolo);
|
||||||
|
|
||||||
$obj->movimentazione($movimentazione);
|
$obj->movimentazione($movimentazione);
|
||||||
|
@ -22,6 +22,7 @@ namespace Models;
|
|||||||
use Common\SimpleModelTrait;
|
use Common\SimpleModelTrait;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use InvalidArgumentException;
|
use InvalidArgumentException;
|
||||||
|
use League\OAuth2\Client\Provider\AbstractProvider;
|
||||||
use League\OAuth2\Client\Provider\Exception\IdentityProviderException;
|
use League\OAuth2\Client\Provider\Exception\IdentityProviderException;
|
||||||
use League\OAuth2\Client\Token\AccessToken;
|
use League\OAuth2\Client\Token\AccessToken;
|
||||||
|
|
||||||
@ -37,6 +38,9 @@ class OAuth2 extends Model
|
|||||||
'config' => 'array',
|
'config' => 'array',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return AbstractProvider
|
||||||
|
*/
|
||||||
public function getProvider()
|
public function getProvider()
|
||||||
{
|
{
|
||||||
// Inizializza il provider per l'autenticazione OAuth2.
|
// Inizializza il provider per l'autenticazione OAuth2.
|
||||||
@ -147,6 +151,25 @@ class OAuth2 extends Model
|
|||||||
return unserialize($this->attributes['access_token']);
|
return unserialize($this->attributes['access_token']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Effettua una richiesta utilizzando il token di accesso prestabilito.
|
||||||
|
*
|
||||||
|
* @param string $method
|
||||||
|
* @param string $url
|
||||||
|
* @param array $options
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function request($method, $url, $options = [])
|
||||||
|
{
|
||||||
|
$provider = $this->getProvider();
|
||||||
|
$accessToken = $this->getAccessToken();
|
||||||
|
|
||||||
|
$request = $provider->getAuthenticatedRequest($method, $url, $accessToken, $options);
|
||||||
|
|
||||||
|
return $provider->getParsedResponse($request);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Imposta Access Token e Refresh Token per l'autenticazione OAuth2.
|
* Imposta Access Token e Refresh Token per l'autenticazione OAuth2.
|
||||||
*
|
*
|
||||||
|
@ -121,7 +121,6 @@ CREATE TABLE IF NOT EXISTS `zz_oauth2` (
|
|||||||
`after_configuration` text DEFAULT NULL,
|
`after_configuration` text DEFAULT NULL,
|
||||||
`created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
|
`created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
`updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
`updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||||
`deleted_at` timestamp NULL DEFAULT NULL,
|
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) ENGINE=InnoDB;
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user