1 | <?php |
||
27 | class Provider |
||
28 | { |
||
29 | /** @var string */ |
||
30 | private $clientId; |
||
31 | |||
32 | /** @var string|null */ |
||
33 | private $clientSecret; |
||
34 | |||
35 | /** @var string */ |
||
36 | private $authorizationEndpoint; |
||
37 | |||
38 | /** @var string */ |
||
39 | private $tokenEndpoint; |
||
40 | |||
41 | /** |
||
42 | * @param string $clientId |
||
43 | * @param string|null $clientSecret |
||
44 | * @param string $authorizationEndpoint |
||
45 | * @param string $tokenEndpoint |
||
46 | */ |
||
47 | public function __construct($clientId, $clientSecret, $authorizationEndpoint, $tokenEndpoint) |
||
48 | { |
||
49 | $this->clientId = $clientId; |
||
50 | $this->clientSecret = $clientSecret; |
||
51 | $this->authorizationEndpoint = $authorizationEndpoint; |
||
52 | $this->tokenEndpoint = $tokenEndpoint; |
||
53 | } |
||
54 | |||
55 | public function getProviderId() |
||
56 | { |
||
57 | return sprintf('%s|%s', $this->getAuthorizationEndpoint(), $this->getClientId()); |
||
58 | } |
||
59 | |||
60 | /** |
||
61 | * @return string |
||
62 | * |
||
63 | * @see https://tools.ietf.org/html/rfc6749#section-2.2 |
||
64 | */ |
||
65 | public function getClientId() |
||
66 | { |
||
67 | return $this->clientId; |
||
68 | } |
||
69 | |||
70 | /** |
||
71 | * @return string|null |
||
72 | * |
||
73 | * @see https://tools.ietf.org/html/rfc6749#section-2.3.1 |
||
74 | */ |
||
75 | public function getSecret() |
||
76 | { |
||
77 | return $this->clientSecret; |
||
78 | } |
||
79 | |||
80 | /** |
||
81 | * @return string |
||
82 | * |
||
83 | * @see https://tools.ietf.org/html/rfc6749#section-3.1 |
||
84 | */ |
||
85 | public function getAuthorizationEndpoint() |
||
86 | { |
||
87 | return $this->authorizationEndpoint; |
||
88 | } |
||
89 | |||
90 | /** |
||
91 | * @return string |
||
92 | * |
||
93 | * @see https://tools.ietf.org/html/rfc6749#section-3.2 |
||
94 | */ |
||
95 | public function getTokenEndpoint() |
||
99 | } |
||
100 |