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

公開メンバ関数

 __construct ()
 
 define_variables ($configOBJECT)
 
 oxd_socket_request ($data, $char_count=8192)
 
 error_message ($error)
 
 log ($process, $message)
 

限定公開変数類

 $base_url = __DIR__
 

静的限定公開変数類

static $socket = null
 

詳解

構築子と解体子

◆ __construct()

oxdrp\Client_Socket_OXD_RP::__construct ( )

Constructor

戻り値
void
79  {
80 
81  $configJSON = file_get_contents($this->base_url.'/oxd-rp-settings.json');
82  $configOBJECT = json_decode($configJSON);
83  if(!$configOBJECT->authorization_redirect_uri){
84  if(!$configJSON = file_get_contents($this->base_url.'/oxd-rp-settings-test.json')){
85  $error = error_get_last();
86  $this->log("oxd-configuration-test: ", 'Error problem with json data.');
87  $this->error_message("HTTP request failed. Error was: " . $error['message']);
88  }
89  }
90  $configOBJECT = json_decode($configJSON);
91  $this->define_variables($configOBJECT);
92 
94 
95  }else{
96  $this->error_message(Oxd_RP_config::$oxd_host_port."is not a valid port for socket. Port must be integer and between from 0 to 65535.");
97  }
98  }
static $oxd_host_port
Definition: Oxd_RP_config.php:72
error_message($error)
Definition: Client_Socket_OXD_RP.php:150
log($process, $message)
Definition: Client_Socket_OXD_RP.php:161
define_variables($configOBJECT)
Definition: Client_Socket_OXD_RP.php:105

関数詳解

◆ define_variables()

oxdrp\Client_Socket_OXD_RP::define_variables (   $configOBJECT)

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)

Showing errors and exit.

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

◆ log()

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

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 
)

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

メンバ詳解

◆ $base_url

oxdrp\Client_Socket_OXD_RP::$base_url = __DIR__
protected

◆ $socket

oxdrp\Client_Socket_OXD_RP::$socket = null
staticprotected

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