@@ 27-55 (lines=29) @@ | ||
24 | ||
25 | class FailureController extends Controller |
|
26 | { |
|
27 | public function sendLoaCannotBeGivenAction() |
|
28 | { |
|
29 | /** @var ResponseContext $responseContext */ |
|
30 | $responseContext = $this->get( |
|
31 | $this->get('gateway.proxy.state_handler')->getResponseContextServiceId() |
|
32 | ); |
|
33 | $originalRequestId = $responseContext->getInResponseTo(); |
|
34 | ||
35 | /** @var \Surfnet\SamlBundle\Monolog\SamlAuthenticationLogger $logger */ |
|
36 | $logger = $this->get('surfnet_saml.logger')->forAuthentication($originalRequestId); |
|
37 | $logger->notice('Loa cannot be given, creating Response with NoAuthnContext status'); |
|
38 | ||
39 | /** @var \Surfnet\StepupGateway\GatewayBundle\Saml\ResponseBuilder $responseBuilder */ |
|
40 | $responseBuilder = $this->get('gateway.proxy.response_builder'); |
|
41 | ||
42 | $response = $responseBuilder |
|
43 | ->createNewResponse($responseContext) |
|
44 | ->setResponseStatus(SAML2_Const::STATUS_RESPONDER, SAML2_Const::STATUS_NO_AUTHN_CONTEXT) |
|
45 | ->get(); |
|
46 | ||
47 | $logger->notice(sprintf( |
|
48 | 'Responding to request "%s" with response based on response from the remote IdP with response "%s"', |
|
49 | $responseContext->getInResponseTo(), |
|
50 | $response->getId() |
|
51 | )); |
|
52 | ||
53 | $responseRendering = $this->get('gateway.service.saml_response'); |
|
54 | return $responseRendering->renderResponse($responseContext, $response); |
|
55 | } |
|
56 | ||
57 | public function sendAuthenticationCancelledByUserAction() |
|
58 | { |
|
@@ 57-89 (lines=33) @@ | ||
54 | return $responseRendering->renderResponse($responseContext, $response); |
|
55 | } |
|
56 | ||
57 | public function sendAuthenticationCancelledByUserAction() |
|
58 | { |
|
59 | /** @var ResponseContext $responseContext */ |
|
60 | $responseContext = $this->get( |
|
61 | $this->get('gateway.proxy.state_handler')->getResponseContextServiceId() |
|
62 | ); |
|
63 | $originalRequestId = $responseContext->getInResponseTo(); |
|
64 | ||
65 | /** @var \Surfnet\SamlBundle\Monolog\SamlAuthenticationLogger $logger */ |
|
66 | $logger = $this->get('surfnet_saml.logger')->forAuthentication($originalRequestId); |
|
67 | $logger->notice('Authentication was cancelled by the user, creating Response with AuthnFailed status'); |
|
68 | ||
69 | /** @var \Surfnet\StepupGateway\GatewayBundle\Saml\ResponseBuilder $responseBuilder */ |
|
70 | $responseBuilder = $this->get('gateway.proxy.response_builder'); |
|
71 | ||
72 | $response = $responseBuilder |
|
73 | ->createNewResponse($responseContext) |
|
74 | ->setResponseStatus( |
|
75 | SAML2_Const::STATUS_RESPONDER, |
|
76 | SAML2_Const::STATUS_AUTHN_FAILED, |
|
77 | 'Authentication cancelled by user' |
|
78 | ) |
|
79 | ->get(); |
|
80 | ||
81 | $logger->notice(sprintf( |
|
82 | 'Responding to request "%s" with response based on response from the remote IdP with response "%s"', |
|
83 | $responseContext->getInResponseTo(), |
|
84 | $response->getId() |
|
85 | )); |
|
86 | ||
87 | $responseRendering = $this->get('gateway.service.saml_response'); |
|
88 | return $responseRendering->renderResponse($responseContext, $response); |
|
89 | } |
|
90 | } |
|
91 |