SamlController::consumeAssertionAction()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 14
rs 9.7998
c 0
b 0
f 0
cc 1
nc 1
nop 1
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\StepupRa\RaBundle\Controller;
20
21
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
22
use Surfnet\SamlBundle\Http\XMLResponse;
23
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
24
use Symfony\Component\HttpFoundation\Request;
25
26
class SamlController extends Controller
0 ignored issues
show
Deprecated Code introduced by
The class Symfony\Bundle\Framework...e\Controller\Controller has been deprecated with message: since Symfony 4.2, use "Symfony\Bundle\FrameworkBundle\Controller\AbstractController" instead.

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
27
{
28
    /**
29
     * @Template
30
     */
31
    public function consumeAssertionAction(Request $httpRequest)
32
    {
33
        /** @var \Surfnet\SamlBundle\Http\PostBinding $postBinding */
34
        $postBinding = $this->get('surfnet_saml.http.post_binding');
35
36
        /** @var \SAML2\Assertion $assertion */
37
        $assertion = $postBinding->processResponse(
38
            $httpRequest,
39
            $this->get('surfnet_saml.remote.idp'),
40
            $this->get('surfnet_saml.hosted.service_provider')
41
        );
42
43
        return $assertion->getAttributes();
44
    }
45
46
    public function metadataAction()
47
    {
48
        /** @var \Surfnet\SamlBundle\Metadata\MetadataFactory $metadataFactory */
49
        $metadataFactory = $this->get('surfnet_saml.metadata_factory');
50
51
        return new XMLResponse($metadataFactory->generate());
52
    }
53
}
54