Skip to content

Commit

Permalink
Replace use-statements with fqdn phpdocs (src)
Browse files Browse the repository at this point in the history
  • Loading branch information
tvdijen committed May 27, 2024
1 parent 7c001c5 commit 8fa039e
Show file tree
Hide file tree
Showing 94 changed files with 628 additions and 668 deletions.
113 changes: 113 additions & 0 deletions 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
# This is a combination of 2 commits.
# This is the 1st commit message:

Replace use-statements with fqdn phpdocs (src)

# This is the commit message #2:

#eplace use-statements with fqdn phpdocs

# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# Date: Mon May 27 23:07:53 2024 +0200
#
# interactive rebase in progress; onto 0ffb51f
# Last commands done (2 commands done):
# reword 6db30c7 Replace use-statements with fqdn phpdocs
# squash 24e0ad6 Replace use-statements with fqdn phpdocs
# No commands remaining.
# You are currently rebasing branch 'style/phpdoc-fqdn' on '0ffb51f'.
#
# Changes to be committed:
# modified: hooks/hook_cron.php
# modified: hooks/hook_federationpage.php
# modified: hooks/hook_frontpage.php
# modified: phpcs.xml
# modified: src/Bridges/SspBridge/Module.php
# modified: src/Controller/AccessTokenController.php
# modified: src/Controller/AuthorizationController.php
# modified: src/Controller/Client/CreateController.php
# modified: src/Controller/Client/DeleteController.php
# modified: src/Controller/Client/EditController.php
# modified: src/Controller/Client/IndexController.php
# modified: src/Controller/Client/ResetSecretController.php
# modified: src/Controller/Client/ShowController.php
# modified: src/Controller/Federation/EntityStatementController.php
# modified: src/Controller/InstallerController.php
# modified: src/Controller/LogoutController.php
# modified: src/Controller/Traits/AuthenticatedGetClientFromRequestTrait.php
# modified: src/Controller/Traits/GetClientFromRequestTrait.php
# modified: src/Controller/Traits/RequestTrait.php
# modified: src/Controller/UserInfoController.php
# modified: src/Entities/AccessTokenEntity.php
# modified: src/Entities/AuthCodeEntity.php
# modified: src/Entities/ClientEntity.php
# modified: src/Entities/RefreshTokenEntity.php
# modified: src/Entities/UserEntity.php
# modified: src/Factories/AuthSimpleFactory.php
# modified: src/Factories/AuthorizationServerFactory.php
# modified: src/Factories/ClaimTranslatorExtractorFactory.php
# modified: src/Factories/FormFactory.php
# modified: src/Factories/ResourceServerFactory.php
# modified: src/Factories/TemplateFactory.php
# modified: src/Forms/ClientForm.php
# modified: src/Forms/Controls/CsrfProtection.php
# modified: src/ModuleConfig.php
# modified: src/Repositories/AbstractDatabaseRepository.php
# modified: src/Repositories/AccessTokenRepository.php
# modified: src/Repositories/AuthCodeRepository.php
# modified: src/Repositories/ClientRepository.php
# modified: src/Repositories/CodeChallengeVerifiersRepository.php
# modified: src/Repositories/Interfaces/AccessTokenRepositoryInterface.php
# modified: src/Repositories/RefreshTokenRepository.php
# modified: src/Repositories/ScopeRepository.php
# modified: src/Repositories/UserRepository.php
# modified: src/Server/AuthorizationServer.php
# modified: src/Server/Exceptions/OidcServerException.php
# modified: src/Server/Grants/AuthCodeGrant.php
# modified: src/Server/Grants/ImplicitGrant.php
# modified: src/Server/Grants/OAuth2ImplicitGrant.php
# modified: src/Server/Grants/RefreshTokenGrant.php
# modified: src/Server/Grants/Traits/IssueAccessTokenTrait.php
# modified: src/Server/LogoutHandlers/BackChannelLogoutHandler.php
# modified: src/Server/ResponseTypes/IdTokenResponse.php
# modified: src/Server/Validators/BearerTokenValidator.php
# modified: src/Services/AuthContextService.php
# modified: src/Services/AuthProcService.php
# modified: src/Services/AuthenticationService.php
# modified: src/Services/DatabaseLegacyOAuth2Import.php
# modified: src/Services/IdTokenBuilder.php
# modified: src/Services/JsonWebKeySetService.php
# modified: src/Services/JsonWebTokenBuilderService.php
# modified: src/Services/LogoutTokenBuilder.php
# modified: src/Services/OpMetadataService.php
# modified: src/Services/RoutingService.php
# modified: src/Services/SessionMessagesService.php
# modified: src/Services/SessionService.php
# modified: src/Stores/Session/LogoutTicketStoreDb.php
# modified: src/Utils/Checker/Interfaces/RequestRuleInterface.php
# modified: src/Utils/Checker/Interfaces/ResultBagInterface.php
# modified: src/Utils/Checker/RequestRulesManager.php
# modified: src/Utils/Checker/ResultBag.php
# modified: src/Utils/Checker/Rules/AcrValuesRule.php
# modified: src/Utils/Checker/Rules/AddClaimsToIdTokenRule.php
# modified: src/Utils/Checker/Rules/CodeChallengeMethodRule.php
# modified: src/Utils/Checker/Rules/CodeChallengeRule.php
# modified: src/Utils/Checker/Rules/IdTokenHintRule.php
# modified: src/Utils/Checker/Rules/MaxAgeRule.php
# modified: src/Utils/Checker/Rules/PostLogoutRedirectUriRule.php
# modified: src/Utils/Checker/Rules/PromptRule.php
# modified: src/Utils/Checker/Rules/RedirectUriRule.php
# modified: src/Utils/Checker/Rules/RequestParameterRule.php
# modified: src/Utils/Checker/Rules/RequestedClaimsRule.php
# modified: src/Utils/Checker/Rules/RequiredNonceRule.php
# modified: src/Utils/Checker/Rules/RequiredOpenIdScopeRule.php
# modified: src/Utils/Checker/Rules/ScopeOfflineAccessRule.php
# modified: src/Utils/Checker/Rules/ScopeRule.php
# modified: src/Utils/ClaimTranslatorExtractor.php
# modified: src/Utils/FingerprintGenerator.php
# modified: src/Utils/ScopeHelper.php
# modified: src/Utils/TimestampGenerator.php
# modified: src/Utils/UniqueIdentifierGenerator.php
#
17 changes: 7 additions & 10 deletions hooks/hook_cron.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
* file that was distributed with this source code.
*/

use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
use SimpleSAML\Logger;
use SimpleSAML\Module\oidc\ModuleConfig;
use SimpleSAML\Module\oidc\Repositories\AccessTokenRepository;
Expand All @@ -25,11 +23,10 @@
use SimpleSAML\Module\oidc\Services\Container;

/**
* @param array $croninfo
* @throws OidcServerException
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
* @throws Exception
* @throws \SimpleSAML\Module\oidc\Server\Exceptions\OidcServerException
* @throws \Psr\Container\ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface
* @throws \Exception
*/
function oidc_hook_cron(array &$croninfo): void
{
Expand All @@ -55,15 +52,15 @@ function oidc_hook_cron(array &$croninfo): void
$container = new Container();

try {
/** @var AccessTokenRepository $accessTokenRepository */
/** @var \SimpleSAML\Module\oidc\Repositories\AccessTokenRepository $accessTokenRepository */
$accessTokenRepository = $container->get(AccessTokenRepository::class);
$accessTokenRepository->removeExpired();

/** @var AuthCodeRepository $authTokenRepository */
/** @var \SimpleSAML\Module\oidc\Repositories\AuthCodeRepository $authTokenRepository */
$authTokenRepository = $container->get(AuthCodeRepository::class);
$authTokenRepository->removeExpired();

/** @var RefreshTokenRepository $refreshTokenRepository */
/** @var \SimpleSAML\Module\oidc\Repositories\RefreshTokenRepository $refreshTokenRepository */
$refreshTokenRepository = $container->get(RefreshTokenRepository::class);
$refreshTokenRepository->removeExpired();

Expand Down
5 changes: 4 additions & 1 deletion hooks/hook_federationpage.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,14 @@
* file that was distributed with this source code.
*/

use SimpleSAML\Locale\Translate;
use SimpleSAML\Module;
use SimpleSAML\Module\oidc\Services\DatabaseMigration;
use SimpleSAML\XHTML\Template;
use SimpleSAML\Locale\Translate;

/**
* @param \SimpleSAML\XHTML\Template $template
*/
function oidc_hook_federationpage(Template $template): void
{
$href = Module::getModuleURL('oidc/admin-clients/index.php');
Expand Down
2 changes: 2 additions & 0 deletions hooks/hook_frontpage.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
use SimpleSAML\Module;
use SimpleSAML\Module\oidc\Services\DatabaseMigration;

/**
*/
function oidc_hook_frontpage(array &$links): void
{
if (!is_array($links['federation'])) {
Expand Down
2 changes: 1 addition & 1 deletion phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

<!-- This is the rule we inherit from. If you want to exlude some specific rules, see the docs on how to do that -->
<rule ref="PSR12"/>
<!-- <rule ref="vendor/simplesamlphp/simplesamlphp-test-framework/phpcs-simplesamlphp.xml"/> -->
<rule ref="vendor/simplesamlphp/simplesamlphp-test-framework/phpcs-simplesamlphp.xml"/>

<!-- Enforce the use of trailing commas -->
<rule ref="SlevomatCodingStandard.Arrays.TrailingArrayComma" />
Expand Down
4 changes: 3 additions & 1 deletion src/Bridges/SspBridge/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@

namespace SimpleSAML\Module\oidc\Bridges\SspBridge;

use SimpleSAML\Module as SspModule;

class Module
{
public function getModuleUrl(string $resource, array $parameters = []): string
{
return \SimpleSAML\Module::getModuleURL($resource, $parameters);
return SspModule::getModuleURL($resource, $parameters);
}
}
3 changes: 1 addition & 2 deletions src/Controller/AccessTokenController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

use Laminas\Diactoros\Response;
use Laminas\Diactoros\ServerRequest;
use League\OAuth2\Server\Exception\OAuthServerException;
use Psr\Http\Message\ResponseInterface;
use SimpleSAML\Module\oidc\Controller\Traits\RequestTrait;
use SimpleSAML\Module\oidc\Repositories\AllowedOriginRepository;
Expand All @@ -34,7 +33,7 @@ public function __construct(
}

/**
* @throws OAuthServerException
* @throws \League\OAuth2\Server\Exception\OAuthServerException
*/
public function __invoke(ServerRequest $request): ResponseInterface
{
Expand Down
22 changes: 10 additions & 12 deletions src/Controller/AuthorizationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,15 @@

namespace SimpleSAML\Module\oidc\Controller;

use Exception;
use Laminas\Diactoros\Response;
use Laminas\Diactoros\ServerRequest;
use League\OAuth2\Server\Exception\OAuthServerException;
use Psr\Http\Message\ResponseInterface;
use SimpleSAML\Error;
use SimpleSAML\Module\oidc\ModuleConfig;
use SimpleSAML\Module\oidc\Server\AuthorizationServer;
use SimpleSAML\Module\oidc\Server\Exceptions\OidcServerException;
use SimpleSAML\Module\oidc\Server\RequestTypes\AuthorizationRequest;
use SimpleSAML\Module\oidc\Services\AuthenticationService;
use SimpleSAML\Module\oidc\Services\LoggerService;
use Throwable;

class AuthorizationController
{
Expand All @@ -41,12 +37,13 @@ public function __construct(
}

/**
* @throws Error\AuthSource
* @throws Error\BadRequest
* @throws Error\NotFound
* @throws Error\Exception
* @throws OAuthServerException
* @throws Exception|Throwable
* @throws \Exception
* @throws \SimpleSAML\Error\AuthSource
* @throws \SimpleSAML\Error\BadRequest
* @throws \SimpleSAML\Error\NotFound
* @throws \SimpleSAML\Error\Exception
* @throws \League\OAuth2\Server\Exception\OAuthServerException
* @throws \Throwable
*/
public function __invoke(ServerRequest $request): ResponseInterface
{
Expand All @@ -71,15 +68,16 @@ public function __invoke(ServerRequest $request): ResponseInterface
/**
* Validate authorization request after the authn has been performed. For example, check if the
* ACR claim has been requested and that authn performed satisfies it.
* @throws Exception
*
* @throws \Exception
*/
protected function validatePostAuthnAuthorizationRequest(AuthorizationRequest $authorizationRequest): void
{
$this->validateAcr($authorizationRequest);
}

/**
* @throws Exception
* @throws \Exception
*/
protected function validateAcr(AuthorizationRequest $authorizationRequest): void
{
Expand Down
6 changes: 3 additions & 3 deletions src/Controller/Client/CreateController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
namespace SimpleSAML\Module\oidc\Controller\Client;

use Laminas\Diactoros\Response\RedirectResponse;
use SimpleSAML\Error\Exception;
use SimpleSAML\Module\oidc\Entities\ClientEntity;
use SimpleSAML\Module\oidc\Factories\FormFactory;
use SimpleSAML\Module\oidc\Factories\TemplateFactory;
Expand All @@ -44,8 +43,9 @@ public function __construct(
}

/**
* @return RedirectResponse|Template
* @throws Exception
* @return \Laminas\Diactoros\Response\RedirectResponse|\SimpleSAML\XHTML\Template
* @throws \SimpleSAML\Error\Exception
* @throws \SimpleSAML\Module\oidc\Server\Exceptions\OidcServerException
* @throws \Exception
*/
public function __invoke(): Template|RedirectResponse
Expand Down
18 changes: 9 additions & 9 deletions src/Controller/Client/DeleteController.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,12 @@

namespace SimpleSAML\Module\oidc\Controller\Client;

use JsonException;
use Laminas\Diactoros\Response\RedirectResponse;
use Laminas\Diactoros\ServerRequest;
use SimpleSAML\Error\BadRequest;
use SimpleSAML\Error\ConfigurationError;
use SimpleSAML\Error\Exception;
use SimpleSAML\Error\NotFound;
use SimpleSAML\Error;
use SimpleSAML\Module\oidc\Controller\Traits\AuthenticatedGetClientFromRequestTrait;
use SimpleSAML\Module\oidc\Factories\TemplateFactory;
use SimpleSAML\Module\oidc\Repositories\ClientRepository;
use SimpleSAML\Module\oidc\Server\Exceptions\OidcServerException;
use SimpleSAML\Module\oidc\Services\AuthContextService;
use SimpleSAML\Module\oidc\Services\SessionMessagesService;
use SimpleSAML\Utils\HTTP;
Expand All @@ -47,8 +42,13 @@ public function __construct(
}

/**
* @throws ConfigurationError|BadRequest|NotFound|Exception|OidcServerException|JsonException
* @throws \Exception
* @throws \JsonException
* @throws \SimpleSAML\Error\BadRequest
* @throws \SimpleSAML\Error\ConfigurationError
* @throws \SimpleSAML\Error\Exception
* @throws \SimpleSAML\Error\NotFound
* @throws \SimpleSAML\Module\oidc\Server\Exceptions\OidcServerException
*/
public function __invoke(ServerRequest $request): Template|RedirectResponse
{
Expand All @@ -58,11 +58,11 @@ public function __invoke(ServerRequest $request): Template|RedirectResponse
$authedUser = $this->authContextService->isSspAdmin() ? null : $this->authContextService->getAuthUserId();
if ('POST' === mb_strtoupper($request->getMethod())) {
if (!$clientSecret) {
throw new BadRequest('Client secret is missing.');
throw new Error\BadRequest('Client secret is missing.');
}

if ($clientSecret !== $client->getSecret()) {
throw new BadRequest('Client secret is invalid.');
throw new Error\BadRequest('Client secret is invalid.');
}

$this->clientRepository->delete($client, $authedUser);
Expand Down
8 changes: 4 additions & 4 deletions src/Controller/Client/EditController.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@

use Laminas\Diactoros\Response\RedirectResponse;
use Laminas\Diactoros\ServerRequest;
use SimpleSAML\Error\BadRequest;
use SimpleSAML\Error\Exception;
use SimpleSAML\Error\NotFound;
use SimpleSAML\Module\oidc\Controller\Traits\AuthenticatedGetClientFromRequestTrait;
use SimpleSAML\Module\oidc\Entities\ClientEntity;
use SimpleSAML\Module\oidc\Factories\FormFactory;
Expand Down Expand Up @@ -51,7 +48,10 @@ public function __construct(
}

/**
* @throws BadRequest|Exception|NotFound|\Exception
* @throws \Exception
* @throws \SimpleSAML\Error\BadRequest
* @throws \SimpleSAML\Error\Exception
* @throws \SimpleSAML\Error\NotFound
*/
public function __invoke(ServerRequest $request): Template|RedirectResponse
{
Expand Down
3 changes: 1 addition & 2 deletions src/Controller/Client/IndexController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
namespace SimpleSAML\Module\oidc\Controller\Client;

use Laminas\Diactoros\ServerRequest;
use SimpleSAML\Error\Exception;
use SimpleSAML\Module\oidc\Factories\TemplateFactory;
use SimpleSAML\Module\oidc\Repositories\ClientRepository;
use SimpleSAML\Module\oidc\Services\AuthContextService;
Expand All @@ -33,8 +32,8 @@ public function __construct(
}

/**
* @throws Exception
* @throws \Exception
* @throws \SimpleSAML\Error\Exception
*/
public function __invoke(ServerRequest $request): Template
{
Expand Down
Loading

0 comments on commit 8fa039e

Please sign in to comment.