ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
SAML2\Response\Processor Class Reference

@SuppressWarnings(PHPMD.CouplingBetweenObjects) - due to specific exceptions More...

+ Collaboration diagram for SAML2\Response\Processor:

Public Member Functions

 __construct (LoggerInterface $logger)
 
 process (ServiceProvider $serviceProviderConfiguration, IdentityProvider $identityProviderConfiguration, Destination $currentDestination, Response $response)
 

Private Member Functions

 enforcePreconditions (Response $response)
 Checks the preconditions that must be valid in order for the response to be processed. More...
 
 verifySignature (Response $response, IdentityProvider $identityProviderConfiguration)
 
 processAssertions (Response $response)
 

Private Attributes

 $logger
 
 $preconditionValidator
 
 $signatureValidator
 
 $assertionProcessor
 
 $responseIsSigned = false
 

Detailed Description

@SuppressWarnings(PHPMD.CouplingBetweenObjects) - due to specific exceptions

Definition at line 21 of file Processor.php.

Constructor & Destructor Documentation

◆ __construct()

SAML2\Response\Processor::__construct ( LoggerInterface  $logger)
Parameters
\Psr\Log\LoggerInterface$logger

Definition at line 55 of file Processor.php.

56 {
57 $this->logger = $logger;
58
59 $this->signatureValidator = new Validator($logger);
60 }

References SAML2\Response\Processor\$logger.

Member Function Documentation

◆ enforcePreconditions()

SAML2\Response\Processor::enforcePreconditions ( Response  $response)
private

Checks the preconditions that must be valid in order for the response to be processed.

Parameters
\SAML2\Response$response

Definition at line 96 of file Processor.php.

97 {
98 $result = $this->preconditionValidator->validate($response);
99
100 if (!$result->isValid()) {
102 }
103 }
$result
$response

References $response, $result, and SAML2\Response\Exception\PreconditionNotMetException\createFromValidationResult().

Referenced by SAML2\Response\Processor\process().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ process()

SAML2\Response\Processor::process ( ServiceProvider  $serviceProviderConfiguration,
IdentityProvider  $identityProviderConfiguration,
Destination  $currentDestination,
Response  $response 
)
Parameters
\SAML2\Configuration\ServiceProvider$serviceProviderConfiguration
\SAML2\Configuration\IdentityProvider$identityProviderConfiguration
\SAML2\Configuration\Destination$currentDestination
\SAML2\Response$response
Returns
\SAML2\Assertion[] Collection (\SAML2\Utilities\ArrayCollection) of \SAML2\Assertion objects

Definition at line 70 of file Processor.php.

75 {
76 $this->preconditionValidator = new PreconditionValidator($currentDestination);
77 $this->assertionProcessor = ProcessorBuilder::build(
78 $this->logger,
79 $this->signatureValidator,
80 $currentDestination,
81 $identityProviderConfiguration,
82 $serviceProviderConfiguration,
84 );
85
87 $this->verifySignature($response, $identityProviderConfiguration);
88 return $this->processAssertions($response);
89 }
static build(LoggerInterface $logger, Validator $signatureValidator, Destination $currentDestination, IdentityProvider $identityProvider, ServiceProvider $serviceProvider, Response $response)
verifySignature(Response $response, IdentityProvider $identityProviderConfiguration)
Definition: Processor.php:109
enforcePreconditions(Response $response)
Checks the preconditions that must be valid in order for the response to be processed.
Definition: Processor.php:96
processAssertions(Response $response)
Definition: Processor.php:140

References $response, SAML2\Assertion\ProcessorBuilder\build(), SAML2\Response\Processor\enforcePreconditions(), SAML2\Response\Processor\processAssertions(), and SAML2\Response\Processor\verifySignature().

+ Here is the call graph for this function:

◆ processAssertions()

SAML2\Response\Processor::processAssertions ( Response  $response)
private
Parameters
\SAML2\Response$response
Returns
\SAML2\Assertion[]

Definition at line 140 of file Processor.php.

141 {
142 $assertions = $response->getAssertions();
143 if (empty($assertions)) {
144 throw new NoAssertionsFoundException('No assertions found in response from IdP.');
145 }
146
147 if (!$this->responseIsSigned) {
148 foreach ($assertions as $assertion) {
149 if (!$assertion->getWasSignedAtConstruction()) {
150 throw new UnsignedResponseException(
151 'Both the response and the assertion it contains are not signed.'
152 );
153 }
154 }
155 }
156
157 return $this->assertionProcessor->processAssertions($assertions);
158 }
$assertions
The assertions in this response.
Definition: Response.php:15

References SAML2\Response\$assertions, and $response.

Referenced by SAML2\Response\Processor\process().

+ Here is the caller graph for this function:

◆ verifySignature()

SAML2\Response\Processor::verifySignature ( Response  $response,
IdentityProvider  $identityProviderConfiguration 
)
private
Parameters
\SAML2\Response$response
\SAML2\Configuration\IdentityProvider$identityProviderConfiguration

Definition at line 109 of file Processor.php.

112 {
113 if (!$response->isMessageConstructedWithSignature()) {
114 $this->logger->info(sprintf(
115 'SAMLResponse with id "%s" was not signed at root level, not attempting to verify the signature of the'
116 . ' reponse itself',
117 $response->getId()
118 ));
119
120 return;
121 }
122
123 $this->logger->info(sprintf(
124 'Attempting to verify the signature of SAMLResponse with id "%s"',
125 $response->getId()
126 ));
127
128 $this->responseIsSigned = true;
129
130 if (!$this->signatureValidator->hasValidSignature($response, $identityProviderConfiguration)) {
131 throw new InvalidResponseException();
132 }
133 }

References $response.

Referenced by SAML2\Response\Processor\process().

+ Here is the caller graph for this function:

Field Documentation

◆ $assertionProcessor

SAML2\Response\Processor::$assertionProcessor
private

Definition at line 41 of file Processor.php.

◆ $logger

SAML2\Response\Processor::$logger
private

Definition at line 26 of file Processor.php.

Referenced by SAML2\Response\Processor\__construct().

◆ $preconditionValidator

SAML2\Response\Processor::$preconditionValidator
private

Definition at line 31 of file Processor.php.

◆ $responseIsSigned

SAML2\Response\Processor::$responseIsSigned = false
private

Definition at line 49 of file Processor.php.

◆ $signatureValidator

SAML2\Response\Processor::$signatureValidator
private

Definition at line 36 of file Processor.php.


The documentation for this class was generated from the following file: