1 | <?php namespace Arcanedev\Socialite\OAuth\One; |
||
15 | abstract class AbstractProvider implements Provider |
||
16 | { |
||
17 | /* ------------------------------------------------------------------------------------------------ |
||
18 | | Properties |
||
19 | | ------------------------------------------------------------------------------------------------ |
||
20 | */ |
||
21 | /** |
||
22 | * The HTTP request instance. |
||
23 | * |
||
24 | * @var \Illuminate\Http\Request |
||
25 | */ |
||
26 | protected $request; |
||
27 | |||
28 | /** |
||
29 | * The OAuth server implementation. |
||
30 | * |
||
31 | * @var \League\OAuth1\Client\Server\Server |
||
32 | */ |
||
33 | protected $server; |
||
34 | |||
35 | /* ------------------------------------------------------------------------------------------------ |
||
36 | | Constructor |
||
37 | | ------------------------------------------------------------------------------------------------ |
||
38 | */ |
||
39 | /** |
||
40 | * Create a new provider instance. |
||
41 | * |
||
42 | * @param \Illuminate\Http\Request $request |
||
43 | * @param \League\OAuth1\Client\Server\Server $server |
||
44 | */ |
||
45 | 18 | public function __construct(Request $request, Server $server) |
|
50 | |||
51 | /* ------------------------------------------------------------------------------------------------ |
||
52 | | Getters & Setters |
||
53 | | ------------------------------------------------------------------------------------------------ |
||
54 | */ |
||
55 | /** |
||
56 | * Set the request instance. |
||
57 | * |
||
58 | * @param \Illuminate\Http\Request $request |
||
59 | * |
||
60 | * @return self |
||
61 | */ |
||
62 | 18 | public function setRequest(Request $request) |
|
68 | |||
69 | /* ------------------------------------------------------------------------------------------------ |
||
70 | | Main Functions |
||
71 | | ------------------------------------------------------------------------------------------------ |
||
72 | */ |
||
73 | /** |
||
74 | * Redirect the user to the authentication page for the provider. |
||
75 | * |
||
76 | * @return \Symfony\Component\HttpFoundation\RedirectResponse |
||
77 | */ |
||
78 | 6 | public function redirect() |
|
86 | |||
87 | /** |
||
88 | * Get the User instance for the authenticated user. |
||
89 | * |
||
90 | * @throws \InvalidArgumentException |
||
91 | * |
||
92 | * @return \Arcanedev\Socialite\OAuth\One\User |
||
93 | */ |
||
94 | 12 | public function user() |
|
114 | |||
115 | /** |
||
116 | * Get a Social User instance from a known access token and secret. |
||
117 | * |
||
118 | * @param string $token |
||
119 | * @param string $secret |
||
120 | * |
||
121 | * @return \Arcanedev\Socialite\OAuth\One\User |
||
122 | */ |
||
123 | public function userFromTokenAndSecret($token, $secret) |
||
142 | |||
143 | /* ------------------------------------------------------------------------------------------------ |
||
144 | | Other Functions |
||
145 | | ------------------------------------------------------------------------------------------------ |
||
146 | */ |
||
147 | /** |
||
148 | * Get the token credentials for the request. |
||
149 | * |
||
150 | * @return \League\OAuth1\Client\Credentials\TokenCredentials |
||
151 | */ |
||
152 | 6 | protected function getToken() |
|
160 | |||
161 | /** |
||
162 | * Determine if the request has the necessary OAuth verifier. |
||
163 | * |
||
164 | * @return bool |
||
165 | */ |
||
166 | 12 | protected function hasNecessaryVerifier() |
|
170 | } |
||
171 |