Passed
Push — master ( 442a9a...3948f8 )
by Dāvis
05:23
created

Openidconnect/Provider/AbstractVariables.php (1 issue)

1
<?php
2
3
namespace Sludio\HelperBundle\Openidconnect\Provider;
4
5
use Sludio\HelperBundle\Openidconnect\Specification;
6
use Symfony\Component\HttpFoundation\Session\Session;
7
use Lcobucci\JWT\Signer;
8
use Symfony\Bundle\FrameworkBundle\Routing\Router;
9
use Psr\Http\Message\ResponseInterface;
10
use League\OAuth2\Client\Token\AccessToken as BaseAccessToken;
11
use League\OAuth2\Client\Provider\AbstractProvider;
12
13
abstract class AbstractVariables extends AbstractProvider
14
{
15
    /**
16
     * @var string
17
     */
18
    protected $publicKey;
19
20
    /**
21
     * @var Signer
22
     */
23
    protected $signer;
24
25
    /**
26
     * @var Specification\ValidatorChain
27
     */
28
    protected $validatorChain;
29
30
    /**
31
     * @var string
32
     */
33
    protected $idTokenIssuer;
34
    /**
35
     * @var Uri[]
36
     */
37
    protected $uris = [];
38
39
    /**
40
     * @var bool
41
     */
42
    protected $useSession;
43
44
    /**
45
     * @var Session
46
     */
47
    protected $session;
48
49
    /**
50
     * @var int
51
     */
52
    protected $statusCode;
53
54
    /**
55
     * @var Router
56
     */
57
    protected $router;
58
59
    /**
60
     * @var string
61
     */
62
    protected $baseUri;
63
64
    protected function checkResponse(ResponseInterface $response, $data)
65
    {
66
    }
67
68
    public function check($response = null)
0 ignored issues
show
The parameter $response is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

68
    public function check(/** @scrutinizer ignore-unused */ $response = null)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
69
    {
70
        return true;
71
    }
72
73
    /**
74
     * Get the issuer of the OpenID Connect id_token
75
     *
76
     * @return string
77
     */
78
    protected function getIdTokenIssuer()
79
    {
80
        return $this->idTokenIssuer;
81
    }
82
83
    public function getBaseAuthorizationUrl()
84
    {
85
        return '';
86
    }
87
88
    public function getBaseAccessTokenUrl(array $params)
89
    {
90
        return '';
91
    }
92
93
    public function getDefaultScopes()
94
    {
95
        return [];
96
    }
97
98
    public function getResourceOwnerDetailsUrl(BaseAccessToken $token)
99
    {
100
    }
101
102
    /**
103
     * Overload parent as OpenID Connect specification states scopes shall be separated by spaces
104
     *
105
     * @return string
106
     */
107
    protected function getScopeSeparator()
108
    {
109
        return ' ';
110
    }
111
112
    protected function createResourceOwner(array $response, BaseAccessToken $token)
113
    {
114
        return [];
115
    }
116
117
    /**
118
     * @return Specification\ValidatorChain
119
     */
120
    public function getValidatorChain()
121
    {
122
        return $this->validatorChain;
123
    }
124
125
    public function getUri($name)
126
    {
127
        return $this->uris[$name];
128
    }
129
    /**
130
     * @return mixed
131
     */
132
    public function getStatusCode()
133
    {
134
        return $this->statusCode;
135
    }
136
137
    /**
138
     * @param mixed $statusCode
139
     *
140
     * @return $this
141
     */
142
    public function setStatusCode($statusCode)
143
    {
144
        $this->statusCode = $statusCode;
145
146
        return $this;
147
    }
148
149
    /**
150
     * Returns all options that are required.
151
     *
152
     * @return array
153
     */
154
    protected function getRequiredOptions()
155
    {
156
        return [];
157
    }
158
159
    abstract public function getValidateTokenUrl();
160
161
    abstract public function getRefreshTokenUrl();
162
163
    abstract public function getRevokeTokenUrl();
164
}
165