protected function checkAuth()
	{
		try {

			// get the JWT from the headers
			list($jwt) = sscanf($_SERVER["HTTP_AUTHORIZATION"], 'Bearer %s');

			// init the jwt auth class
			$authenticator = new JWTAuthenticator(new User());

			// get the application secret key
			$config     = \Erdiko::getConfig();
			$secretKey  = $config["site"]["secret_key"];

			// collect login params
			$params = array(
				'secret_key'    =>  $secretKey,
				'jwt'           =>  $jwt
			);

			$user = $authenticator->verify($params, 'jwt_auth');

			//TODO check the user's permissions via Resource & Authorization

			// no exceptions? welp, this is a valid request
			return true;
		} catch (\Exception $e) {
			return true;
		}
	}
protected function checkAuth()
	{
		try {

			// get the JWT from the headers
			list($jwt) = sscanf($_SERVER["HTTP_AUTHORIZATION"], 'Bearer %s');

			// init the jwt auth class
			$authenticator = new JWTAuthenticator(new User());

			// get the application secret key
			$config     = \Erdiko::getConfig();
			$secretKey  = $config["site"]["secret_key"];

			// collect login params
			$params = array(
				'secret_key'    =>  $secretKey,
				'jwt'           =>  $jwt
			);

			$user = $authenticator->verify($params, 'jwt_auth');

			//TODO check the user's permissions via Resource & Authorization

			// no exceptions? welp, this is a valid request
			return true;
		} catch (\Exception $e) {
			return true;
		}
	}
protected function checkAuth ( ) { try { // get the JWT from the headers list ( $ jwt ) = sscanf ( $ _SERVER [ "HTTP_AUTHORIZATION" ] , 'Bearer %s' ) ; // init the jwt auth class $ authenticator = new JWTAuthenticator ( new User ( ) ) ; // get the application secret key $ config = \ Erdiko :: getConfig ( ) ; $ secretKey = $ config [ "site" ] [ "secret_key" ] ; // collect login params $ params = array ( 'secret_key' => $ secretKey , 'jwt' => $ jwt ) ; $ user = $ authenticator -> verify ( $ params , 'jwt_auth' ) ; //TODO check the user's permissions via Resource & Authorization // no exceptions? welp, this is a valid request return true ; } catch ( \ Exception $ e ) { return true ; } }
It always returns true because login is not a must in this section, but we still want to create authenticator
instance if there's a logged in user to restrict some actions.

@return bool
It always returns true because login is not a must in this section but we still want to create authenticator instance if there s a logged in user to restrict some actions .