Skip to content

Commit

Permalink
Minor CS changes
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbyoung committed Aug 9, 2023
1 parent 41ea2a7 commit c188f07
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/Demo/Auth/AuthorizedUserDeleterRequirement.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
public array $authorizedRoles;

/**
* @param string|list<string> $authorizedRoles The role or list of roles that are authorized to delete other users' accounts
* @param list<string>|string $authorizedRoles The role or list of roles that are authorized to delete other users' accounts
*/
public function __construct(array|string $authorizedRoles)
{
Expand Down
13 changes: 5 additions & 8 deletions src/Demo/Auth/BasicAuthenticationHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
use Aphiria\Authentication\AuthenticationScheme;
use Aphiria\Authentication\Schemes\BasicAuthenticationHandler as BaseBasicAuthenticationHandler;
use Aphiria\Net\Http\IRequest;
use Aphiria\Security\IdentityBuilder;
use Aphiria\Security\PrincipalBuilder;
use App\Demo\Users\IUserService;

Expand Down Expand Up @@ -38,13 +37,11 @@ protected function createAuthenticationResultFromCredentials(
}

return AuthenticationResult::pass(
(new PrincipalBuilder($scheme->options->claimsIssuer ?? $scheme->name))
->withIdentity(function (IdentityBuilder $identity) use ($user, $scheme) {
$identity->withNameIdentifier($user->id)
->withEmail($user->email)
->withRoles($user->roles)
->withAuthenticationSchemeName($scheme->name);
})->build(),
(new PrincipalBuilder($scheme->options->claimsIssuer ?? $scheme->name))->withNameIdentifier($user->id)
->withEmail($user->email)
->withRoles($user->roles)
->withAuthenticationSchemeName($scheme->name)
->build(),
$scheme->name
);
}
Expand Down
13 changes: 5 additions & 8 deletions src/Demo/Auth/CookieAuthenticationHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
use Aphiria\Authentication\Schemes\CookieAuthenticationOptions;
use Aphiria\Net\Http\IRequest;
use Aphiria\Net\Http\IResponse;
use Aphiria\Security\IdentityBuilder;
use Aphiria\Security\IPrincipal;
use Aphiria\Security\PrincipalBuilder;
use App\Demo\Users\IUserService;
Expand Down Expand Up @@ -92,13 +91,11 @@ protected function createAuthenticationResultFromCookie(string $cookieValue, IRe
$user = $this->users->getUserById($userId);

return AuthenticationResult::pass(
(new PrincipalBuilder($scheme->options->claimsIssuer ?? $scheme->name))
->withIdentity(function (IdentityBuilder $identity) use ($user, $scheme) {
$identity->withNameIdentifier($user->id)
->withEmail($user->email)
->withRoles($user->roles)
->withAuthenticationSchemeName($scheme->name);
})->build(),
(new PrincipalBuilder($scheme->options->claimsIssuer ?? $scheme->name))->withNameIdentifier($user->id)
->withEmail($user->email)
->withRoles($user->roles)
->withAuthenticationSchemeName($scheme->name)
->build(),
$scheme->name
);
}
Expand Down
1 change: 1 addition & 0 deletions src/Demo/Database/Components/DatabaseComponents.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ trait DatabaseComponents
* @param IApplicationBuilder $appBuilder The application builder
* @param class-string<IDatabaseSeeder>|list<class-string<IDatabaseSeeder>> $classNames The name or names of database seeder classes to add
* @return static For chaining
* @throws RuntimeException Thrown if the global container instance was not set
*/
protected function withDatabaseSeeders(IApplicationBuilder $appBuilder, string|array $classNames): static
{
Expand Down

0 comments on commit c188f07

Please sign in to comment.