Total Complexity | 6 |
Total Lines | 52 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
6 | class Auth0 |
||
7 | { |
||
8 | public $auth0; |
||
9 | |||
10 | public function __construct() |
||
11 | { |
||
12 | $this->auth0 = new Auth0SDK([ |
||
13 | 'domain' => GJC_AUTH0_DOMAIN, |
||
14 | 'client_id' => GJC_AUTH0_CLIENT_ID, |
||
15 | 'client_secret' => GJC_AUTH0_CLIENT_SECRET, |
||
16 | 'redirect_uri' => GJC_AUTH0_CALLBACK_URL, |
||
17 | 'audience' => GJC_AUTH0_AUDIENCE, |
||
18 | 'scope' => GJC_AUTH0_SCOPE, |
||
19 | 'persist_id_token' => GJC_AUTH0_PER_ID_TOKEN, |
||
20 | 'persist_access_token' => GJC_AUTH0_PER_ACCESS_TOKEN, |
||
21 | 'persist_refresh_token' => GJC_AUTH0_PER_REFRESH_TOKEN, |
||
22 | ]); |
||
23 | } |
||
24 | |||
25 | public function check() |
||
26 | { |
||
27 | $user_info = $this->auth0->getUser(); |
||
28 | |||
29 | if (!$user_info) { |
||
30 | |||
31 | header("Location: " . GJC_AUTH0_LOGIN_URL); |
||
32 | exit; |
||
33 | |||
34 | } else { |
||
35 | |||
36 | return; |
||
37 | |||
38 | } |
||
39 | |||
40 | } |
||
41 | |||
42 | public function login() |
||
45 | } |
||
46 | |||
47 | public function getUser() |
||
48 | { |
||
49 | return $this->auth0->getUser(); |
||
50 | } |
||
51 | |||
52 | public function logout() |
||
58 | } |
||
59 | |||
60 | } |
||
61 |