Esempio n. 1
0
 public static function log_user_from_authenticated_action($app_id, $action, $auth_data, $to_check)
 {
     $result = array('ok' => false, 'auth_error' => '');
     $auth_engine = AuthenticationSettings::get_auth_engine_instance();
     //First check the validity of what was sent :
     $result = $auth_engine->check_authenticated_action($app_id, $action, $auth_data, $to_check);
     if ($result['ok']) {
         //OK, log the user in for the current script execution :
         $user_wp = get_user_by('login', $result['user']);
         self::$current_user = wp_set_current_user($user_wp->ID);
     }
     return $result;
 }
Esempio n. 2
0
 public static function read($service_answer, $query_vars, $app_id)
 {
     $service_answer = array();
     $auth_params = WpakWebServiceContext::getClientAppParams();
     if (!empty($auth_params['auth_action'])) {
         $app_id = WpakApps::get_app_id($app_id);
         $auth_engine = AuthenticationSettings::get_auth_engine_instance();
         $service_answer = $auth_engine->get_webservice_answer($app_id);
     } else {
         $service_answer = array('error' => 'no-auth-action');
         //This will set webservice answer status to 0.
     }
     return (object) $service_answer;
 }