mirror of
https://github.com/bitinflow/accounts.git
synced 2026-03-18 07:55:53 +00:00
Allow * tokens
This commit is contained in:
@@ -137,7 +137,7 @@ class TokenGuard
|
|||||||
// is physically logged into the application via the application's interface.
|
// is physically logged into the application via the application's interface.
|
||||||
/** @var Authenticatable|HasBitinflowTokens $user */
|
/** @var Authenticatable|HasBitinflowTokens $user */
|
||||||
if ($user = $this->provider->retrieveById($token['sub'])) {
|
if ($user = $this->provider->retrieveById($token['sub'])) {
|
||||||
return $user->withBitinflowAccessToken((object)['scopes' => '*']);
|
return $user->withBitinflowAccessToken((object)['scopes' => ['*']]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace GhostZero\BitinflowAccounts\Traits;
|
namespace GhostZero\BitinflowAccounts\Traits;
|
||||||
|
|
||||||
use Illuminate\Container\Container;
|
|
||||||
use stdClass;
|
use stdClass;
|
||||||
|
|
||||||
trait HasBitinflowTokens
|
trait HasBitinflowTokens
|
||||||
@@ -27,11 +26,15 @@ trait HasBitinflowTokens
|
|||||||
/**
|
/**
|
||||||
* Determine if the current API token has a given scope.
|
* Determine if the current API token has a given scope.
|
||||||
*
|
*
|
||||||
* @param string $scopeUserProvider
|
* @param string $scope
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function bitinflowTokenCan(string $scope): bool
|
public function bitinflowTokenCan(string $scope): bool
|
||||||
{
|
{
|
||||||
|
if (in_array('*', $this->accessToken->scopes)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return $this->accessToken ? in_array($scope, $this->accessToken->scopes) : false;
|
return $this->accessToken ? in_array($scope, $this->accessToken->scopes) : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user