1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* Copyright 2014 SURFnet bv |
5
|
|
|
* |
6
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
7
|
|
|
* you may not use this file except in compliance with the License. |
8
|
|
|
* You may obtain a copy of the License at |
9
|
|
|
* |
10
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0 |
11
|
|
|
* |
12
|
|
|
* Unless required by applicable law or agreed to in writing, software |
13
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, |
14
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
15
|
|
|
* See the License for the specific language governing permissions and |
16
|
|
|
* limitations under the License. |
17
|
|
|
*/ |
|
|
|
|
18
|
|
|
|
19
|
|
|
namespace Surfnet\StepupGateway\SamlStepupProviderBundle\Controller; |
20
|
|
|
|
21
|
|
|
use DateTime; |
22
|
|
|
use Exception; |
23
|
|
|
use SAML2\Constants; |
24
|
|
|
use SAML2\Response as SAMLResponse; |
25
|
|
|
use SAML2\XML\saml\Issuer; |
26
|
|
|
use Surfnet\SamlBundle\Http\XMLResponse; |
27
|
|
|
use Surfnet\StepupGateway\GatewayBundle\Controller\GatewayController; |
28
|
|
|
use Surfnet\StepupGateway\GatewayBundle\Exception\ResponseFailureException; |
29
|
|
|
use Surfnet\StepupGateway\GatewayBundle\Saml\ResponseContext; |
30
|
|
|
use Surfnet\StepupGateway\SamlStepupProviderBundle\Exception\InvalidSubjectException; |
31
|
|
|
use Surfnet\StepupGateway\SamlStepupProviderBundle\Exception\NotConnectedServiceProviderException; |
32
|
|
|
use Surfnet\StepupGateway\SamlStepupProviderBundle\Exception\RuntimeException; |
33
|
|
|
use Surfnet\StepupGateway\SamlStepupProviderBundle\Exception\SecondfactorVerificationRequiredException; |
34
|
|
|
use Surfnet\StepupGateway\SamlStepupProviderBundle\Provider\Provider; |
35
|
|
|
use Surfnet\StepupGateway\SamlStepupProviderBundle\Saml\ProxyResponseFactory; |
36
|
|
|
use Surfnet\StepupGateway\SamlStepupProviderBundle\Saml\StateHandler; |
37
|
|
|
use Surfnet\StepupGateway\SamlStepupProviderBundle\Service\Gateway\ConsumeAssertionService; |
38
|
|
|
use Surfnet\StepupGateway\SamlStepupProviderBundle\Service\Gateway\LoginService; |
39
|
|
|
use Surfnet\StepupGateway\SamlStepupProviderBundle\Service\Gateway\SecondFactorVerificationService; |
40
|
|
|
use Surfnet\StepupGateway\SecondFactorOnlyBundle\Adfs\ResponseHelper; |
41
|
|
|
use Symfony\Bundle\FrameworkBundle\Controller\Controller; |
42
|
|
|
use Symfony\Component\HttpFoundation\Request; |
43
|
|
|
use Symfony\Component\HttpFoundation\Response; |
44
|
|
|
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; |
45
|
|
|
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* Handling of GSSP registration and verification. |
49
|
|
|
* |
50
|
|
|
* See docs/GatewayState.md for a high-level diagram on how this controller |
51
|
|
|
* interacts with outside actors and other parts of Stepup. |
52
|
|
|
* |
53
|
|
|
* Should be refactored, {@see https://www.pivotaltracker.com/story/show/90169776} |
54
|
|
|
* |
55
|
|
|
* @SuppressWarnings(PHPMD.CouplingBetweenObjects) |
56
|
|
|
* @SuppressWarnings(PHPMD.NPathComplexity) |
57
|
|
|
*/ |
|
|
|
|
58
|
|
|
class SamlProxyController extends Controller |
|
|
|
|
59
|
|
|
{ |
60
|
|
|
/** |
61
|
|
|
* Proxy a GSSP authentication request to the remote GSSP SSO endpoint. |
62
|
|
|
* |
63
|
|
|
* The user is about to be sent to the remote GSSP application for |
64
|
|
|
* registration. Verification is not initiated with a SAML AUthnRequest, |
65
|
|
|
* see sendSecondFactorVerificationAuthnRequestAction(). |
66
|
|
|
* |
67
|
|
|
* The service provider in this context is SelfService (when registering |
68
|
|
|
* a token) or RA (when vetting a token). |
69
|
|
|
* |
70
|
|
|
* @param string $provider |
|
|
|
|
71
|
|
|
* @param Request $httpRequest |
|
|
|
|
72
|
|
|
* @return \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response |
|
|
|
|
73
|
|
|
*/ |
74
|
|
|
public function singleSignOnAction($provider, Request $httpRequest) |
75
|
|
|
{ |
76
|
|
|
$provider = $this->getProvider($provider); |
77
|
|
|
|
78
|
|
|
/** @var \Surfnet\SamlBundle\Http\RedirectBinding $redirectBinding */ |
|
|
|
|
79
|
|
|
$redirectBinding = $this->get('surfnet_saml.http.redirect_binding'); |
80
|
|
|
$gsspLoginService = $this->getGsspLoginService(); |
81
|
|
|
|
82
|
|
|
$logger = $this->get('logger'); |
83
|
|
|
$logger->notice('Received AuthnRequest, started processing'); |
84
|
|
|
|
85
|
|
|
try { |
86
|
|
|
$proxyRequest = $gsspLoginService->singleSignOn($provider, $httpRequest); |
87
|
|
|
} catch (NotConnectedServiceProviderException $e) { |
88
|
|
|
throw new AccessDeniedHttpException(); |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
return $redirectBinding->createResponseFor($proxyRequest); |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
/** |
95
|
|
|
* Start a GSSP single sign-on. |
96
|
|
|
* |
97
|
|
|
* The user has selected a second factor token and the token happens to be |
98
|
|
|
* a GSSP token. The SecondFactorController therefor did an internal |
99
|
|
|
* redirect (see SecondFactorController::verifyGssfAction) to this method. |
100
|
|
|
* |
101
|
|
|
* In this method, an authn request is created. This authn request is sent |
102
|
|
|
* directly to the remote GSSP SSO URL, and the response is handled in |
103
|
|
|
* consumeAssertionAction(). |
104
|
|
|
* |
105
|
|
|
* @param string $provider |
|
|
|
|
106
|
|
|
* @param string $subjectNameId |
|
|
|
|
107
|
|
|
* @param string $responseContextServiceId |
|
|
|
|
108
|
|
|
* @return \Symfony\Component\HttpFoundation\RedirectResponse |
|
|
|
|
109
|
|
|
*/ |
110
|
|
|
public function sendSecondFactorVerificationAuthnRequestAction($provider, $subjectNameId, $responseContextServiceId) |
111
|
|
|
{ |
112
|
|
|
$provider = $this->getProvider($provider); |
113
|
|
|
|
114
|
|
|
$gsspSecondFactorVerificationService = $this->getGsspSecondFactorVerificationService(); |
115
|
|
|
|
116
|
|
|
$authnRequest = $gsspSecondFactorVerificationService->sendSecondFactorVerificationAuthnRequest( |
117
|
|
|
$provider, |
118
|
|
|
$subjectNameId, |
119
|
|
|
$responseContextServiceId |
120
|
|
|
); |
121
|
|
|
|
122
|
|
|
/** @var \Surfnet\SamlBundle\Http\RedirectBinding $redirectBinding */ |
|
|
|
|
123
|
|
|
$redirectBinding = $this->get('surfnet_saml.http.redirect_binding'); |
124
|
|
|
|
125
|
|
|
return $redirectBinding->createResponseFor($authnRequest); |
126
|
|
|
} |
127
|
|
|
|
128
|
|
|
/** |
129
|
|
|
* Process an assertion received from the remote GSSP application. |
130
|
|
|
* |
131
|
|
|
* The GSSP application sent an assertion back to the gateway. When |
132
|
|
|
* successful, the user is sent back to: |
133
|
|
|
* |
134
|
|
|
* 1. in case of registration: back to the originating SP (SelfService or RA) |
135
|
|
|
* 2. in case of verification: internal redirect to SecondFactorController |
136
|
|
|
* |
137
|
|
|
* @param string $provider |
|
|
|
|
138
|
|
|
* @param Request $httpRequest |
|
|
|
|
139
|
|
|
* @return \Symfony\Component\HttpFoundation\Response |
|
|
|
|
140
|
|
|
* @throws Exception |
|
|
|
|
141
|
|
|
*/ |
142
|
|
|
public function consumeAssertionAction($provider, Request $httpRequest) |
143
|
|
|
{ |
144
|
|
|
$provider = $this->getProvider($provider); |
145
|
|
|
|
146
|
|
|
$consumeAssertionService = $this->getGsspConsumeAssertionService(); |
147
|
|
|
$proxyResponseFactory = $this->getProxyResponseFactory($provider); |
148
|
|
|
|
149
|
|
|
try { |
150
|
|
|
$response = $consumeAssertionService->consumeAssertion($provider, $httpRequest, $proxyResponseFactory); |
151
|
|
|
} catch (ResponseFailureException $e) { |
152
|
|
|
$response = $this->createResponseFailureResponse( |
153
|
|
|
$provider, |
154
|
|
|
$this->getDestination($provider->getStateHandler()), |
155
|
|
|
$this->getIssuer($provider->getStateHandler()), |
156
|
|
|
$e->getMessage() |
157
|
|
|
); |
158
|
|
|
return $this->renderSamlResponse('consume_assertion', $provider->getStateHandler(), $response); |
159
|
|
|
} catch (InvalidSubjectException $e) { |
160
|
|
|
return $this->renderSamlResponse( |
161
|
|
|
'recoverable_error', |
162
|
|
|
$provider->getStateHandler(), |
163
|
|
|
$this->createAuthnFailedResponse( |
164
|
|
|
$provider, |
165
|
|
|
$this->getDestination($provider->getStateHandler()) |
166
|
|
|
) |
167
|
|
|
); |
168
|
|
|
} catch (SecondfactorVerificationRequiredException $e) { |
169
|
|
|
// The provider state handler has no access to the session object, hence we use the proxy state handler |
170
|
|
|
$stateHandler = $this->get('gateway.proxy.sso.state_handler'); |
171
|
|
|
return $this->forward( |
172
|
|
|
'SurfnetStepupGatewayGatewayBundle:SecondFactor:gssfVerified', |
173
|
|
|
[ |
174
|
|
|
// The authentication mode is loaded from session, based on the request id |
175
|
|
|
'authenticationMode' => $stateHandler->getAuthenticationModeForRequestId( |
176
|
|
|
$consumeAssertionService->getReceivedRequestId() |
177
|
|
|
), |
178
|
|
|
] |
179
|
|
|
); |
180
|
|
|
} catch (Exception $e) { |
181
|
|
|
throw $e; |
182
|
|
|
} |
183
|
|
|
|
184
|
|
|
return $this->renderSamlResponse('consume_assertion', $provider->getStateHandler(), $response); |
185
|
|
|
} |
186
|
|
|
|
187
|
|
|
/** |
|
|
|
|
188
|
|
|
* @param string $provider |
|
|
|
|
189
|
|
|
* @return XMLResponse |
|
|
|
|
190
|
|
|
*/ |
191
|
|
|
public function metadataAction($provider) |
192
|
|
|
{ |
193
|
|
|
$provider = $this->getProvider($provider); |
194
|
|
|
|
195
|
|
|
/** @var \Surfnet\SamlBundle\Metadata\MetadataFactory $factory */ |
|
|
|
|
196
|
|
|
$factory = $this->get('gssp.provider.' . $provider->getName() . '.metadata.factory'); |
197
|
|
|
|
198
|
|
|
return new XMLResponse($factory->generate()); |
199
|
|
|
} |
200
|
|
|
|
201
|
|
|
/** |
|
|
|
|
202
|
|
|
* @param string $provider |
|
|
|
|
203
|
|
|
* @return \Surfnet\StepupGateway\SamlStepupProviderBundle\Provider\Provider |
|
|
|
|
204
|
|
|
*/ |
205
|
|
|
private function getProvider($provider) |
|
|
|
|
206
|
|
|
{ |
207
|
|
|
/** @var \Surfnet\StepupGateway\SamlStepupProviderBundle\Provider\ProviderRepository $providerRepository */ |
|
|
|
|
208
|
|
|
$providerRepository = $this->get('gssp.provider_repository'); |
209
|
|
|
|
210
|
|
|
if (!$providerRepository->has($provider)) { |
211
|
|
|
throw new NotFoundHttpException( |
212
|
|
|
sprintf('Requested GSSP "%s" does not exist or is not registered', $provider) |
213
|
|
|
); |
214
|
|
|
} |
215
|
|
|
|
216
|
|
|
return $providerRepository->get($provider); |
217
|
|
|
} |
218
|
|
|
|
219
|
|
|
/** |
|
|
|
|
220
|
|
|
* @param StateHandler $stateHandler |
|
|
|
|
221
|
|
|
* @return string |
|
|
|
|
222
|
|
|
*/ |
223
|
|
|
private function getDestination(StateHandler $stateHandler) |
|
|
|
|
224
|
|
|
{ |
225
|
|
|
if ($stateHandler->secondFactorVerificationRequested()) { |
226
|
|
|
// This can either be a SFO or 'regular' SSO authentication. Both use a ResponseContext service of their own |
227
|
|
|
$responseContextServiceId = $stateHandler->getResponseContextServiceId(); |
228
|
|
|
// GSSP verification action, return to SP from GatewayController state! |
229
|
|
|
$destination = $this->get($responseContextServiceId)->getDestination(); |
|
|
|
|
230
|
|
|
} else { |
231
|
|
|
// GSSP registration action, return to SP remembered in ssoAction(). |
232
|
|
|
$serviceProvider = $this->getServiceProvider( |
233
|
|
|
$stateHandler->getRequestServiceProvider() |
234
|
|
|
); |
235
|
|
|
|
236
|
|
|
$destination = $serviceProvider->determineAcsLocation( |
237
|
|
|
$stateHandler->getRequestAssertionConsumerServiceUrl(), |
238
|
|
|
$this->get('logger') |
239
|
|
|
); |
240
|
|
|
} |
241
|
|
|
|
242
|
|
|
return $destination; |
243
|
|
|
} |
244
|
|
|
|
245
|
|
|
private function getIssuer(StateHandler $stateHandler): Issuer |
|
|
|
|
246
|
|
|
{ |
247
|
|
|
// This can either be a SFO or 'regular' SSO authentication. Both use a ResponseContext service of their own |
248
|
|
|
$responseContextServiceId = $stateHandler->getResponseContextServiceId(); |
249
|
|
|
if (!$responseContextServiceId) { |
250
|
|
|
throw new RuntimeException( |
251
|
|
|
sprintf( |
252
|
|
|
'Unable to find the ResponseContext service-id for this authentication or registration, ' . |
253
|
|
|
'service-id provided was: "%s"', |
254
|
|
|
$responseContextServiceId |
255
|
|
|
) |
256
|
|
|
); |
257
|
|
|
} |
258
|
|
|
// GSSP verification action, return to SP from GatewayController state! |
259
|
|
|
/** @var ResponseContext $responseService */ |
|
|
|
|
260
|
|
|
$responseService = $this->get($responseContextServiceId); |
261
|
|
|
return $responseService->getIssuer(); |
262
|
|
|
} |
263
|
|
|
|
264
|
|
|
/** |
|
|
|
|
265
|
|
|
* @param string $view |
|
|
|
|
266
|
|
|
* @param StateHandler $stateHandler |
|
|
|
|
267
|
|
|
* @param SAMLResponse $response |
|
|
|
|
268
|
|
|
* @return Response |
|
|
|
|
269
|
|
|
*/ |
270
|
|
|
public function renderSamlResponse($view, StateHandler $stateHandler, SAMLResponse $response) |
271
|
|
|
{ |
272
|
|
|
/** @var ResponseHelper $responseHelper */ |
|
|
|
|
273
|
|
|
$responseHelper = $this->get('second_factor_only.adfs.response_helper'); |
274
|
|
|
$logger = $this->get('logger'); |
275
|
|
|
|
276
|
|
|
$logger->notice(sprintf('Rendering SAML Response with view "%s"', $view)); |
277
|
|
|
|
278
|
|
|
$parameters = [ |
279
|
|
|
'acu' => $response->getDestination(), |
280
|
|
|
'response' => $this->getResponseAsXML($response), |
281
|
|
|
'relayState' => $stateHandler->getRelayState(), |
282
|
|
|
]; |
283
|
|
|
$responseContext = $this->getResponseContext('gateway.proxy.sfo.state_handler'); |
284
|
|
|
|
285
|
|
|
// Test if we should add ADFS response parameters |
286
|
|
|
$inResponseTo = $responseContext->getInResponseTo(); |
287
|
|
|
$isAdfsResponse = $responseHelper->isAdfsResponse($inResponseTo); |
288
|
|
|
$logger->notice(sprintf('Responding to "%s" an ADFS response? %s', $inResponseTo, $isAdfsResponse ? 'yes' : 'no')); |
289
|
|
|
if ($isAdfsResponse) { |
290
|
|
|
$adfsParameters = $responseHelper->retrieveAdfsParameters(); |
291
|
|
|
$logMessage = 'Responding with additional ADFS parameters, in response to request: "%s", with view: "%s"'; |
292
|
|
|
if ($response->isSuccess()) { |
293
|
|
|
$logMessage = 'Responding with an AuthnFailed SamlResponse with ADFS parameters, in response to AR: "%s", with view: "%s"'; |
294
|
|
|
} |
295
|
|
|
$logger->notice(sprintf($logMessage, $inResponseTo, $view)); |
296
|
|
|
$parameters['adfs'] = $adfsParameters; |
297
|
|
|
$parameters['acu'] = $responseContext->getDestinationForAdfs(); |
298
|
|
|
} |
299
|
|
|
|
300
|
|
|
$response = parent::render( |
301
|
|
|
'SurfnetStepupGatewaySamlStepupProviderBundle:saml_proxy:' . $view . '.html.twig', |
302
|
|
|
$parameters |
303
|
|
|
); |
304
|
|
|
|
305
|
|
|
// clear the state so we can call again :) |
306
|
|
|
$stateHandler->clear(); |
307
|
|
|
|
308
|
|
|
return $response; |
309
|
|
|
} |
310
|
|
|
|
311
|
|
|
/** |
|
|
|
|
312
|
|
|
* @param SAMLResponse $response |
|
|
|
|
313
|
|
|
* @return string |
|
|
|
|
314
|
|
|
*/ |
315
|
|
|
private function getResponseAsXML(SAMLResponse $response) |
|
|
|
|
316
|
|
|
{ |
317
|
|
|
return base64_encode($response->toUnsignedXML()->ownerDocument->saveXML()); |
|
|
|
|
318
|
|
|
} |
319
|
|
|
|
320
|
|
|
/** |
|
|
|
|
321
|
|
|
* Response that indicates that an error occurred in the responder |
322
|
|
|
* (the gateway). Used to indicate that we could not process the |
323
|
|
|
* response we received from the upstream GSSP |
324
|
|
|
* |
325
|
|
|
* The correct Destination (where did the SAMLResponse originate from. |
326
|
|
|
* And the Issuer (who issued the response) are explicitly set on the response |
327
|
|
|
* allowing for correctly setting them. |
328
|
|
|
*/ |
|
|
|
|
329
|
|
|
private function createResponseFailureResponse( |
|
|
|
|
330
|
|
|
Provider $provider, |
331
|
|
|
string $destination, |
332
|
|
|
Issuer $issuer, |
333
|
|
|
string $message |
334
|
|
|
): SAMLResponse { |
335
|
|
|
$response = $this->createResponse($provider, $destination); |
336
|
|
|
// Overwrite the issuer with the correct issuer for the saml failed response |
337
|
|
|
$response->setIssuer($issuer); |
338
|
|
|
$response->setStatus([ |
|
|
|
|
339
|
|
|
'Code' => Constants::STATUS_RESPONDER, |
340
|
|
|
'SubCode' => Constants::STATUS_AUTHN_FAILED, |
341
|
|
|
'Message' => $message |
342
|
|
|
]); |
|
|
|
|
343
|
|
|
|
344
|
|
|
return $response; |
345
|
|
|
} |
346
|
|
|
|
347
|
|
|
/** |
348
|
|
|
* Response that indicates that the authentication could not be performed correctly. In this context it means |
349
|
|
|
* that the upstream GSSP did not responsd with the same NameID as we request to authenticate in the AuthnRequest |
350
|
|
|
* |
351
|
|
|
* @param Provider $provider |
|
|
|
|
352
|
|
|
* @param string $destination |
|
|
|
|
353
|
|
|
* @return SAMLResponse |
|
|
|
|
354
|
|
|
*/ |
355
|
|
|
private function createAuthnFailedResponse(Provider $provider, $destination) |
|
|
|
|
356
|
|
|
{ |
357
|
|
|
$response = $this->createResponse($provider, $destination); |
358
|
|
|
$response->setStatus( |
359
|
|
|
[ |
360
|
|
|
'Code' => Constants::STATUS_RESPONDER, |
361
|
|
|
'SubCode' => Constants::STATUS_AUTHN_FAILED, |
362
|
|
|
] |
363
|
|
|
); |
364
|
|
|
|
365
|
|
|
return $response; |
366
|
|
|
} |
367
|
|
|
|
368
|
|
|
/** |
369
|
|
|
* Creates a standard response with default status Code (success) |
370
|
|
|
* |
371
|
|
|
* @param Provider $provider |
|
|
|
|
372
|
|
|
* @param string $destination |
|
|
|
|
373
|
|
|
* @return SAMLResponse |
|
|
|
|
374
|
|
|
*/ |
375
|
|
|
private function createResponse(Provider $provider, $destination) |
|
|
|
|
376
|
|
|
{ |
377
|
|
|
$context = $this->getResponseContext(); |
378
|
|
|
$response = new SAMLResponse(); |
379
|
|
|
$response->setDestination($destination); |
380
|
|
|
$response->setIssuer($context->getIssuer()); |
381
|
|
|
$response->setIssueInstant((new DateTime('now'))->getTimestamp()); |
382
|
|
|
$response->setInResponseTo($provider->getStateHandler()->getRequestId()); |
383
|
|
|
|
384
|
|
|
return $response; |
385
|
|
|
} |
386
|
|
|
|
387
|
|
|
/** |
|
|
|
|
388
|
|
|
* @param string $serviceProvider |
|
|
|
|
389
|
|
|
* @return \Surfnet\StepupGateway\GatewayBundle\Entity\ServiceProvider |
|
|
|
|
390
|
|
|
*/ |
391
|
|
|
private function getServiceProvider($serviceProvider) |
|
|
|
|
392
|
|
|
{ |
393
|
|
|
/** |
|
|
|
|
394
|
|
|
* @var \Surfnet\StepupGateway\SamlStepupProviderBundle\Provider\ConnectedServiceProviders $connectedServiceProviders |
395
|
|
|
*/ |
396
|
|
|
$connectedServiceProviders = $this->get('gssp.connected_service_providers'); |
397
|
|
|
return $connectedServiceProviders->getConfigurationOf($serviceProvider); |
398
|
|
|
} |
399
|
|
|
|
400
|
|
|
/** |
|
|
|
|
401
|
|
|
* @return LoginService |
402
|
|
|
*/ |
403
|
|
|
private function getGsspLoginService() |
|
|
|
|
404
|
|
|
{ |
405
|
|
|
return $this->get('gssp.service.gssp.login'); |
406
|
|
|
} |
407
|
|
|
|
408
|
|
|
/** |
|
|
|
|
409
|
|
|
* @return SecondFactorVerificationService |
410
|
|
|
*/ |
411
|
|
|
private function getGsspSecondFactorVerificationService() |
|
|
|
|
412
|
|
|
{ |
413
|
|
|
return $this->get('gssp.service.gssp.second_factor_verification'); |
414
|
|
|
} |
415
|
|
|
|
416
|
|
|
/** |
|
|
|
|
417
|
|
|
* @return ConsumeAssertionService |
418
|
|
|
*/ |
419
|
|
|
private function getGsspConsumeAssertionService() |
|
|
|
|
420
|
|
|
{ |
421
|
|
|
return $this->get('gssp.service.gssp.consume_assertion'); |
422
|
|
|
} |
423
|
|
|
|
424
|
|
|
/** |
|
|
|
|
425
|
|
|
* @param Provider $provider |
|
|
|
|
426
|
|
|
* @return ProxyResponseFactory |
|
|
|
|
427
|
|
|
*/ |
428
|
|
|
private function getProxyResponseFactory(Provider $provider) |
|
|
|
|
429
|
|
|
{ |
430
|
|
|
return $this->get('gssp.provider.' . $provider->getName() . '.response_proxy'); |
431
|
|
|
} |
432
|
|
|
|
433
|
|
|
/** |
|
|
|
|
434
|
|
|
* @return \Surfnet\StepupGateway\GatewayBundle\Saml\ResponseContext |
435
|
|
|
*/ |
436
|
|
|
public function getResponseContext($mode = 'gateway.proxy.sso.state_handler') |
437
|
|
|
{ |
438
|
|
|
$stateHandler = $this->get($mode); |
439
|
|
|
|
440
|
|
|
$responseContextServiceId = $stateHandler->getResponseContextServiceId(); |
441
|
|
|
|
442
|
|
|
if (!$responseContextServiceId) { |
443
|
|
|
return $this->get(GatewayController::RESPONSE_CONTEXT_SERVICE_ID); |
444
|
|
|
} |
445
|
|
|
|
446
|
|
|
return $this->get($responseContextServiceId); |
447
|
|
|
} |
448
|
|
|
} |
449
|
|
|
|