Skip to content

Commit

Permalink
Use TicketStore abstract class type
Browse files Browse the repository at this point in the history
  • Loading branch information
ioigoume committed Dec 15, 2024
1 parent f314472 commit 36c2e4e
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 15 deletions.
9 changes: 5 additions & 4 deletions src/Controller/Cas10Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use SimpleSAML\Logger;
use SimpleSAML\Module\casserver\Cas\Factories\TicketFactory;
use SimpleSAML\Module\casserver\Cas\Protocol\Cas10;
use SimpleSAML\Module\casserver\Cas\Ticket\TicketStore;
use SimpleSAML\Module\casserver\Controller\Traits\UrlTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
Expand All @@ -31,20 +32,20 @@ class Cas10Controller
/** @var TicketFactory */
protected TicketFactory $ticketFactory;

// this could be any configured ticket store
protected mixed $ticketStore;
/** @var TicketStore */
protected TicketStore $ticketStore;

/**
* @param Configuration $sspConfig
* @param Configuration|null $casConfig
* @param null $ticketStore
* @param TicketStore|null $ticketStore
*
* @throws \Exception
*/
public function __construct(
private readonly Configuration $sspConfig,
Configuration $casConfig = null,
$ticketStore = null,
TicketStore $ticketStore = null,
) {
// We are using this work around in order to bypass Symfony's autowiring for cas configuration. Since
// the configuration class is the same, it loads the ssp configuration twice. Still, we need the constructor
Expand Down
10 changes: 6 additions & 4 deletions src/Controller/Cas20Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use SimpleSAML\Logger;
use SimpleSAML\Module\casserver\Cas\Factories\TicketFactory;
use SimpleSAML\Module\casserver\Cas\Protocol\Cas20;
use SimpleSAML\Module\casserver\Cas\Ticket\TicketStore;
use SimpleSAML\Module\casserver\Controller\Traits\UrlTrait;
use SimpleSAML\Module\casserver\Http\XmlResponse;
use SimpleSAML\Utils;
Expand Down Expand Up @@ -37,20 +38,21 @@ class Cas20Controller
/** @var TicketFactory */
protected TicketFactory $ticketFactory;

// this could be any configured ticket store
protected mixed $ticketStore;
/** @var TicketStore */
protected TicketStore $ticketStore;

/**
* @param Configuration $sspConfig
* @param Configuration|null $casConfig
* @param $ticketStore
* @param TicketStore|null $ticketStore
* @param Utils\HTTP|null $httpUtils
*
* @throws \Exception
*/
public function __construct(
private readonly Configuration $sspConfig,
Configuration $casConfig = null,
$ticketStore = null,
TicketStore $ticketStore = null,
Utils\HTTP $httpUtils = null,
) {
// We are using this work around in order to bypass Symfony's autowiring for cas configuration. Since
Expand Down
8 changes: 4 additions & 4 deletions src/Controller/LoginController.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use SimpleSAML\Module\casserver\Cas\Protocol\Cas20;
use SimpleSAML\Module\casserver\Cas\Protocol\SamlValidateResponder;
use SimpleSAML\Module\casserver\Cas\ServiceValidator;
use SimpleSAML\Module\casserver\Cas\Ticket\TicketStore;
use SimpleSAML\Module\casserver\Controller\Traits\UrlTrait;
use SimpleSAML\Module\casserver\Http\XmlResponse;
use SimpleSAML\Session;
Expand Down Expand Up @@ -48,9 +49,8 @@ class LoginController
/** @var Cas20 */
protected Cas20 $cas20Protocol;

// this could be any configured ticket store
/** @var mixed */
protected mixed $ticketStore;
/** @var TicketStore */
protected TicketStore $ticketStore;

/** @var ServiceValidator */
protected ServiceValidator $serviceValidator;
Expand All @@ -76,7 +76,7 @@ class LoginController
* @param Configuration $sspConfig
* @param Configuration|null $casConfig
* @param Simple|null $source
* @param HTTP|null $httpUtils
* @param Utils\HTTP|null $httpUtils
*
* @throws \Exception
*/
Expand Down
6 changes: 3 additions & 3 deletions src/Controller/LogoutController.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use SimpleSAML\Logger;
use SimpleSAML\Module;
use SimpleSAML\Module\casserver\Cas\Factories\TicketFactory;
use SimpleSAML\Module\casserver\Cas\Ticket\TicketStore;
use SimpleSAML\Module\casserver\Controller\Traits\UrlTrait;
use SimpleSAML\Session;
use Symfony\Component\HttpFoundation\RedirectResponse;
Expand Down Expand Up @@ -37,9 +38,8 @@ class LogoutController
/** @var SspContainer */
protected SspContainer $container;

// this could be any configured ticket store
/** @var mixed */
protected mixed $ticketStore;
/** @var TicketStore */
protected TicketStore $ticketStore;


/**
Expand Down

0 comments on commit 36c2e4e

Please sign in to comment.