Miglioramenti minori OAuth2
This commit is contained in:
parent
74665d4a88
commit
be86c40a6f
|
@ -162,7 +162,7 @@ class FatturaOrdinaria extends FatturaElettronica
|
|||
if (!empty($articolo)) {
|
||||
$articolo->idconto_acquisto = $conto[$key];
|
||||
$articolo->save();
|
||||
|
||||
|
||||
$obj = Articolo::build($fattura, $articolo);
|
||||
|
||||
$obj->movimentazione($movimentazione);
|
||||
|
|
|
@ -22,6 +22,7 @@ namespace Models;
|
|||
use Common\SimpleModelTrait;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use InvalidArgumentException;
|
||||
use League\OAuth2\Client\Provider\AbstractProvider;
|
||||
use League\OAuth2\Client\Provider\Exception\IdentityProviderException;
|
||||
use League\OAuth2\Client\Token\AccessToken;
|
||||
|
||||
|
@ -37,6 +38,9 @@ class OAuth2 extends Model
|
|||
'config' => 'array',
|
||||
];
|
||||
|
||||
/**
|
||||
* @return AbstractProvider
|
||||
*/
|
||||
public function getProvider()
|
||||
{
|
||||
// Inizializza il provider per l'autenticazione OAuth2.
|
||||
|
@ -147,6 +151,25 @@ class OAuth2 extends Model
|
|||
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.
|
||||
*
|
||||
|
|
|
@ -121,7 +121,6 @@ CREATE TABLE IF NOT EXISTS `zz_oauth2` (
|
|||
`after_configuration` text DEFAULT NULL,
|
||||
`created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
`deleted_at` timestamp NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
|
|
Loading…
Reference in New Issue