gluu
公開メンバ関数 | 限定公開変数類 | 静的限定公開変数類 | 非公開変数類 | 全メンバ一覧
oxdrp\Uma_rp_get_gat クラス
oxdrp\Uma_rp_get_gat の継承関係図
Inheritance graph
oxdrp\Uma_rp_get_gat 連携図
Collaboration graph

公開メンバ関数

 __construct ()
 
 getRequestOxdId ()
 
 setRequestOxdId ($request_oxd_id)
 
 getRequestScopes ()
 
 setRequestScopes (array $request_scopes)
 
 getResponseGat ()
 
 setCommand ()
 
 setParams ()
 
 request ()
 
 getResponseStatus ()
 
 setResponseStatus ()
 
 getResponseData ()
 
 getData ()
 
 getCommand ()
 
 getResponseObject ()
 
 getResponseJSON ()
 
 getParams ()
 
 is_JSON ($string)
 
 define_variables ($configOBJECT)
 
 oxd_socket_request ($data, $char_count=8192)
 
 error_message ($error)
 
 log ($process, $message)
 

限定公開変数類

 $command
 
 $params = array()
 
 $data = array()
 
 $response_json
 
 $response_object
 
 $response_status
 
 $response_data = array()
 
 $base_url = __DIR__
 

静的限定公開変数類

static $socket = null
 

非公開変数類

 $request_oxd_id = null
 
 $request_scopes = null
 
 $response_gat
 

詳解

構築子と解体子

◆ __construct()

oxdrp\Uma_rp_get_gat::__construct ( )

Constructor

戻り値
void
91  {
92  parent::__construct(); // TODO: Change the autogenerated stub
93  }

関数詳解

◆ define_variables()

oxdrp\Client_Socket_OXD_RP::define_variables (   $configOBJECT)
inherited

Defining oxd-setting.json file for static object Oxd_RP_config

戻り値
void
105  {
106  Oxd_RP_config::$op_host = $configOBJECT->op_host;
107  Oxd_RP_config::$oxd_host_port = $configOBJECT->oxd_host_port;
108  Oxd_RP_config::$authorization_redirect_uri = $configOBJECT->authorization_redirect_uri;
109  Oxd_RP_config::$post_logout_redirect_uri = $configOBJECT->post_logout_redirect_uri;
110  Oxd_RP_config::$scope = $configOBJECT->scope;
111  Oxd_RP_config::$application_type = $configOBJECT->application_type;
112  Oxd_RP_config::$response_types = $configOBJECT->response_types;
113  Oxd_RP_config::$grant_types = $configOBJECT->grant_types;
114  Oxd_RP_config::$acr_values = $configOBJECT->acr_values;
115 
116  }
static $op_host
Definition: Oxd_RP_config.php:67
static $authorization_redirect_uri
Definition: Oxd_RP_config.php:77
static $application_type
Definition: Oxd_RP_config.php:92
static $oxd_host_port
Definition: Oxd_RP_config.php:72
static $acr_values
Definition: Oxd_RP_config.php:108
static $grant_types
Definition: Oxd_RP_config.php:102
static $response_types
Definition: Oxd_RP_config.php:97
static $post_logout_redirect_uri
Definition: Oxd_RP_config.php:82
static $scope
Definition: Oxd_RP_config.php:87

◆ error_message()

oxdrp\Client_Socket_OXD_RP::error_message (   $error)
inherited

Showing errors and exit.

引数
string$error
戻り値
void
151  {
152  die($error);
153  }

◆ getCommand()

oxdrp\Client_OXD_RP::getCommand ( )
inherited

Protocol name for request.

戻り値
string
229  {
230  return $this->command;
231  }
$command
Definition: Client_OXD_RP.php:84

◆ getData()

oxdrp\Client_OXD_RP::getData ( )
inherited

Data which need to send oXD server.

戻り値
array
218  {
219  $this->data = array('command' => $this->getCommand(), 'params' => $this->getParams());
220  return $this->data;
221  }
getParams()
Definition: Client_OXD_RP.php:273
$data
Definition: Client_OXD_RP.php:92
getCommand()
Definition: Client_OXD_RP.php:228

◆ getParams()

oxdrp\Client_OXD_RP::getParams ( )
inherited

Parameters for request.

戻り値
array
274  {
275  return $this->params;
276  }
$params
Definition: Client_OXD_RP.php:88

◆ getRequestOxdId()

oxdrp\Uma_rp_get_gat::getRequestOxdId ( )
戻り値
string
99  {
100  return $this->request_oxd_id;
101  }
$request_oxd_id
Definition: Uma_rp_get_gat.php:70

◆ getRequestScopes()

oxdrp\Uma_rp_get_gat::getRequestScopes ( )
戻り値
array
116  {
117  return $this->request_scopes;
118  }
$request_scopes
Definition: Uma_rp_get_gat.php:75

◆ getResponseData()

oxdrp\Client_OXD_RP::getResponseData ( )
inherited

If data is not empty it is returning response data from oxd-server in format array. If data empty or error , you have problem with parameter or protocol.

戻り値
array
202  {
203  if (!$this->getResponseObject()) {
204  $this->response_data = 'Data is empty';
205  $this->error_message($this->response_data);
206  } else {
207  $this->response_data = $this->getResponseObject()->data;
208  }
209  return $this->response_data;
210  }
$response_data
Definition: Client_OXD_RP.php:108
error_message($error)
Definition: Client_Socket_OXD_RP.php:150
getResponseObject()
Definition: Client_OXD_RP.php:246

◆ getResponseGat()

oxdrp\Uma_rp_get_gat::getResponseGat ( )
戻り値
string
133  {
134  return $this->response_gat;
135  }
$response_gat
Definition: Uma_rp_get_gat.php:83

◆ getResponseJSON()

oxdrp\Client_OXD_RP::getResponseJSON ( )
inherited

If response data is not empty it is returning response data from oxd-server in format json. If response data empty or error , you have problem with parameter or protocol.

戻り値
string
257  {
258  return $this->response_json;
259  }
$response_json
Definition: Client_OXD_RP.php:96

◆ getResponseObject()

oxdrp\Client_OXD_RP::getResponseObject ( )
inherited

If response data is not empty it is returning response data from oxd-server in format object. If response data empty or error , you have problem with parameter or protocol.

戻り値
object
247  {
248  return $this->response_object;
249  }
$response_object
Definition: Client_OXD_RP.php:100

◆ getResponseStatus()

oxdrp\Client_OXD_RP::getResponseStatus ( )
inherited

Response status

戻り値
string, OK on success, error on failure
182  {
183  return $this->response_status;
184  }
$response_status
Definition: Client_OXD_RP.php:104

◆ is_JSON()

oxdrp\Client_OXD_RP::is_JSON (   $string)
inherited

Checking format string.

引数
string$string
戻り値
bool
284  {
285  return is_string($string) && is_object(json_decode($string)) ? true : false;
286  }

◆ log()

oxdrp\Client_Socket_OXD_RP::log (   $process,
  $message 
)
inherited

Saving process in log file.

引数
string$process
string$message
戻り値
void
161  {
162  $OldFile = $this->base_url.'/logs/oxd-php-server-'.date("Y-m-d") .'.log';
163  $person = "\n".date('l jS \of F Y h:i:s A')."\n".$process.$message."\n";
164  file_put_contents($OldFile, $person, FILE_APPEND | LOCK_EX);
165 
166  }

◆ oxd_socket_request()

oxdrp\Client_Socket_OXD_RP::oxd_socket_request (   $data,
  $char_count = 8192 
)
inherited

Sending request to oXD server via socket

引数
string$data
int$char_count
戻り値
object
124  {
125  if (!self::$socket = stream_socket_client( '127.0.0.1:' . Oxd_RP_config::$oxd_host_port, $errno, $errstr, STREAM_CLIENT_PERSISTENT)) {
126  $this->log("Client: socket::socket_connect is not connected, error: ",$errstr);
127  die($errno);
128  }else{
129  $this->log("Client: socket::socket_connect", "socket connected");
130  }
131  $this->log("Client: oxd_socket_request", fwrite(self::$socket, $data));
132  fwrite(self::$socket, $data);
133  $result = fread(self::$socket, $char_count);
134  if($result){
135  $this->log("Client: oxd_socket_response", $result);
136  }else{
137  $this->log("Client: oxd_socket_response", 'Error socket reading process.');
138  }
139  if(fclose(self::$socket)){
140  $this->log("Client: oxd_socket_connection", "disconnected.");
141  }
142  return $result;
143  }
static $oxd_host_port
Definition: Oxd_RP_config.php:72
log($process, $message)
Definition: Client_Socket_OXD_RP.php:161

◆ request()

oxdrp\Client_OXD_RP::request ( )
inherited

send function sends the command to the oxD server.

Args: command (dict) - Dict representation of the JSON command string

戻り値
void
143  {
144  $this->setParams();
145 
146  $jsondata = json_encode($this->getData(), JSON_UNESCAPED_SLASHES);
147 
148  if(!$this->is_JSON($jsondata)){
149  $this->log("Sending parameters must be JSON.",'Exiting process.');
150  $this->error_message('Sending parameters must be JSON.');
151  }
152  $lenght = strlen($jsondata);
153  if($lenght<=0){
154  $this->log("Length must be more than zero.",'Exiting process.');
155  $this->error_message("Length must be more than zero.");
156  }else{
157  $lenght = $lenght <= 999 ? "0" . $lenght : $lenght;
158  }
159 
160  $this->response_json = $this->oxd_socket_request(utf8_encode($lenght . $jsondata));
161 
162  $this->response_json = str_replace(substr($this->response_json, 0, 4), "", $this->response_json);
163  if ($this->response_json) {
164  $object = json_decode($this->response_json);
165  if ($object->status == 'error') {
166  $this->error_message($object->data->error . ' : ' . $object->data->error_description);
167  } elseif ($object->status == 'ok') {
168  $this->response_object = json_decode($this->response_json);
169  }
170  } else {
171  $this->log("Response is empty...",'Exiting process.');
172  $this->error_message('Response is empty...');
173  }
174  }
error_message($error)
Definition: Client_Socket_OXD_RP.php:150
is_JSON($string)
Definition: Client_OXD_RP.php:284
oxd_socket_request($data, $char_count=8192)
Definition: Client_Socket_OXD_RP.php:124
log($process, $message)
Definition: Client_Socket_OXD_RP.php:161
getData()
Definition: Client_OXD_RP.php:217

◆ setCommand()

oxdrp\Uma_rp_get_gat::setCommand ( )

Protocol command to oxd server

戻り値
void
142  {
143  $this->command = 'uma_rp_get_gat';
144  }

◆ setParams()

oxdrp\Uma_rp_get_gat::setParams ( )

Protocol parameter to oxd server

戻り値
void
151  {
152  $this->params = array(
153  "oxd_id" => $this->getRequestOxdId(),
154  "scopes" => $this->getRequestScopes()
155 
156  );
157  }
getRequestScopes()
Definition: Uma_rp_get_gat.php:115
getRequestOxdId()
Definition: Uma_rp_get_gat.php:98

◆ setRequestOxdId()

oxdrp\Uma_rp_get_gat::setRequestOxdId (   $request_oxd_id)
引数
string$request_oxd_id
戻り値
void
108  {
109  $this->request_oxd_id = $request_oxd_id;
110  }
$request_oxd_id
Definition: Uma_rp_get_gat.php:70

◆ setRequestScopes()

oxdrp\Uma_rp_get_gat::setRequestScopes ( array  $request_scopes)
引数
array$request_scopes
戻り値
void
125  {
126  $this->request_scopes = $request_scopes;
127  }
$request_scopes
Definition: Uma_rp_get_gat.php:75

◆ setResponseStatus()

oxdrp\Client_OXD_RP::setResponseStatus ( )
inherited

Setting response status

戻り値
void
192  {
193  $this->response_status = $this->getResponseObject()->status;
194  }
getResponseObject()
Definition: Client_OXD_RP.php:246

メンバ詳解

◆ $base_url

oxdrp\Client_Socket_OXD_RP::$base_url = __DIR__
protectedinherited

◆ $command

oxdrp\Client_OXD_RP::$command
protectedinherited

◆ $data

oxdrp\Client_OXD_RP::$data = array()
protectedinherited

◆ $params

oxdrp\Client_OXD_RP::$params = array()
protectedinherited

◆ $request_oxd_id

oxdrp\Uma_rp_get_gat::$request_oxd_id = null
private

◆ $request_scopes

oxdrp\Uma_rp_get_gat::$request_scopes = null
private

◆ $response_data

oxdrp\Client_OXD_RP::$response_data = array()
protectedinherited

◆ $response_gat

string oxdrp\Uma_rp_get_gat::$response_gat
private

Response parameter from oxd-server GAT stands for Gluu Access Token

◆ $response_json

oxdrp\Client_OXD_RP::$response_json
protectedinherited

◆ $response_object

oxdrp\Client_OXD_RP::$response_object
protectedinherited

◆ $response_status

oxdrp\Client_OXD_RP::$response_status
protectedinherited

◆ $socket

oxdrp\Client_Socket_OXD_RP::$socket = null
staticprotectedinherited

このクラス詳解は次のファイルから抽出されました: