You've already forked php-auth
generated from siteworxpro/Php-Template
Basics of auth
Some checks failed
🧪✨ Tests Workflow / 🛡️ 🔒 Library Audit (push) Successful in 2m31s
🧪✨ Tests Workflow / 📝 ✨ Code Lint (push) Successful in 2m24s
🧪✨ Tests Workflow / 🛡️ 🔒 License Check (push) Successful in 2m57s
🧪✨ Tests Workflow / 🧪 ✨ Database Migrations (push) Successful in 3m14s
🧪✨ Tests Workflow / 🐙 🔍 Code Sniffer (push) Failing after 2m58s
🧪✨ Tests Workflow / 🧪 ✅ Unit Tests (push) Failing after 1m24s
Some checks failed
🧪✨ Tests Workflow / 🛡️ 🔒 Library Audit (push) Successful in 2m31s
🧪✨ Tests Workflow / 📝 ✨ Code Lint (push) Successful in 2m24s
🧪✨ Tests Workflow / 🛡️ 🔒 License Check (push) Successful in 2m57s
🧪✨ Tests Workflow / 🧪 ✨ Database Migrations (push) Successful in 3m14s
🧪✨ Tests Workflow / 🐙 🔍 Code Sniffer (push) Failing after 2m58s
🧪✨ Tests Workflow / 🧪 ✅ Unit Tests (push) Failing after 1m24s
This commit is contained in:
@@ -35,7 +35,7 @@ use Siteworxpro\App\OAuth\ScopeRepository;
|
||||
* @property string $description
|
||||
* @property string $private_key
|
||||
* @property string $encryption_key
|
||||
* @property string[] $grant_types
|
||||
* @property Collection<string> $grant_types
|
||||
* @property bool $confidential
|
||||
*
|
||||
* @property-read ClientCapabilities $capabilities
|
||||
@@ -101,7 +101,14 @@ class Client extends Model implements ClientEntityInterface
|
||||
*/
|
||||
public function scopes(): HasManyThrough
|
||||
{
|
||||
return $this->hasManyThrough(Scope::class, ClientScope::class);
|
||||
return $this->hasManyThrough(
|
||||
Scope::class,
|
||||
ClientScope::class,
|
||||
'client_id',
|
||||
'id',
|
||||
'id',
|
||||
'scope_id'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -109,7 +116,14 @@ class Client extends Model implements ClientEntityInterface
|
||||
*/
|
||||
public function users(): HasManyThrough
|
||||
{
|
||||
return $this->hasManyThrough(User::class, ClientUser::class);
|
||||
return $this->hasManyThrough(
|
||||
User::class,
|
||||
ClientUser::class,
|
||||
'client_id',
|
||||
'id',
|
||||
'id',
|
||||
'user_id'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -154,7 +168,7 @@ class Client extends Model implements ClientEntityInterface
|
||||
*/
|
||||
public function setCapabilitiesAttribute(ClientCapabilities $capabilities): void
|
||||
{
|
||||
$this->attributes->capabilities = $capabilities->toJson();
|
||||
$this->attributes['capabilities'] = $capabilities->toJson();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -203,4 +217,16 @@ class Client extends Model implements ClientEntityInterface
|
||||
|
||||
return $authorizationServer;
|
||||
}
|
||||
|
||||
public function loginUser(string $username, string $password): ?User
|
||||
{
|
||||
/** @var User|null $user */
|
||||
$user = $this->users()->where('email', $username)->first();
|
||||
|
||||
if (!$user) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $user->verifyPassword($password) ? $user : null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user