You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
			
				
					
					
						
							60 lines
						
					
					
						
							1.6 KiB
						
					
					
				
			
		
		
		
			
			
			
				
					
				
				
					
				
			
		
		
	
	
							60 lines
						
					
					
						
							1.6 KiB
						
					
					
				| <?php | |
| include_once './config/bootstrap.php'; | |
| require "../vendor/autoload.php"; | |
| use \Firebase\JWT\JWT; | |
| 
 | |
| header("Access-Control-Allow-Origin: *"); | |
| header("Content-Type: application/json; charset=UTF-8"); | |
| header("Access-Control-Allow-Methods: GET"); | |
| header("Access-Control-Max-Age: 3600"); | |
| header("Access-Control-Allow-Headers: Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With"); | |
| 
 | |
| 
 | |
| $authToken = new AuthenticationToken(); | |
| $tokenCheck = $authToken->tokenCheck($GLOBALS['CONF']['CLAIM']['SECRET']); | |
| 
 | |
| 
 | |
| if($tokenCheck['access'] == "GRANTED") { | |
|   echo json_encode($tokenCheck); | |
| } else { | |
|   echo json_encode($tokenCheck); | |
| } | |
| 
 | |
| //$jwt = getBearerToken();//$arr[1]; | |
| //"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC9yZXN0LmxvY2FsIiwiYXVkIjoiaHR0cDpcL1wvcmVzdC5sb2NhbCIsImlhdCI6MTU4NzY1MTA2NCwibmJmIjoxNTg3NjUxMDc0LCJleHAiOjE1ODc3MTEwNjQsImRhdGEiOnsiaWQiOiIxIiwiZmlyc3RuYW1lIjoiQ2FybWluZSIsImxhc3RuYW1lIjoiRGUgUm9zYSIsImVtYWlsIjoiZHNsYWt5QGdtYWlsLmNvbSJ9fQ.l9uPKJuqGlnRD8prKzcEDWTf_fuqEZarje-mFANaBZM"; | |
|  | |
| /* | |
| echo $jwt; | |
| if($jwt){ | |
|  | |
|   try { | |
|  | |
|       $decoded = JWT::decode($jwt, $secret_key, array('HS256')); | |
|  | |
|       print_r($decoded); | |
|       // Access is granted. Add code of the operation here | |
|  | |
|       echo json_encode(array( | |
|           "message" => "Access granted:", | |
|           "error" => "aaa" | |
|       )); | |
|  | |
|   } catch (Exception $e){ | |
|  | |
|     http_response_code(401); | |
|  | |
|     echo json_encode(array( | |
|         "message" => "Access denied.", | |
|         "error" => $e->getMessage() | |
|     )); | |
|   } | |
|  | |
| } else { | |
|   echo json_encode(array( | |
|     "message" => "Access denied.", | |
|     "error" => "no token" | |
|   )); | |
| }*/ | |
| 
 | |
| 
 | |
| ?>
 |