Completed
Pull Request — master (#84)
by Robbie
08:46 queued 06:42
created

SAMLHelper::getSAMLauth()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
3
namespace SilverStripe\ActiveDirectory\Helpers;
4
5
use OneLogin_Saml2_Auth;
6
use SilverStripe\Core\Object;
7
8
/**
9
 * Class SAMLHelper
10
 *
11
 * SAMLHelper acts as a simple wrapper for the OneLogin implementation, so that we can configure
12
 * and inject it via the config system.
13
 */
14
class SAMLHelper extends Object
15
{
16
    /**
17
     * @var array
18
     */
19
    public static $dependencies = [
20
        'SAMLConfService' => '%$SilverStripe\\ActiveDirectory\\Services\\SAMLConfiguration',
21
    ];
22
23
    /**
24
     * @var SAMLConfiguration
25
     */
26
    public $SAMLConfService;
27
28
    /**
29
     * @return OneLogin_Saml2_Auth
30
     */
31
    public function getSAMLauth()
32
    {
33
        $samlConfig = $this->SAMLConfService->asArray();
34
        return new OneLogin_Saml2_Auth($samlConfig);
35
    }
36
}
37