Difference between revisions of "I2Rest Advanced Setup"

From i2Rest
Jump to: navigation, search
 
(13 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
This section describes configuration options of i2Rest Server. [[I2Rest_quick_config|Basic configuration]] allows only demo server functionality, and must be extended to supply full functional server instancence. Combining examples bellow you can achieve server functionality that suits your requirements. <br>
 
This section describes configuration options of i2Rest Server. [[I2Rest_quick_config|Basic configuration]] allows only demo server functionality, and must be extended to supply full functional server instancence. Combining examples bellow you can achieve server functionality that suits your requirements. <br>
  
* [[SSL conections secure]]
+
* [[Using secured connections]]
* [[i2Rest Gate URL definition using unix socket]]
+
* [[i2Rest Gate URL definition using Unix socket|Serving incoming connections using Unix sockets]]
* [[How to require OAuth2 authentication]] (тут только *LOCAL сессии и минимальную настройку юзера, клиента и скоупа для run_program, pcml для echo)
+
* [[I2Rest_with_syslog|Using syslog with i2Rest Server]]
* [[How to allow command call API]] (тут только *LOCAL сессии и минимальную настройку юзера, клиента и скоупа для run_command)
+
* [[Configuring OAuth2 authorization]]
* [[Managment_API_config|How to allow calls to management API]]
+
* [[Run_command_Api_config|How to allow calls to run_command API]]
* [[How to call API located on remote IBM i server]]
+
* [[Management_API_config|How to allow calls to management API]]
* [[Custom scopes]] Это на будущее, сейчас можно не описывать. Мы с тобой как-то обсуждали про то, что можно добавить собственный скоуп, использовать его в настройке полномочий и передавать его в сессию
+
* [[Remote_API_call_config|How to call API located on remote IBM i server]]
* [[API configuration examples]]
+
* [[I2Rest_Basic_PowerApps_Connector|How to create Microsoft Power Apps custom adapter to i2Rest Server]]
 
+
i2Rest server should be [[I2Rest_Start|restarted]] to aplly your new configuration *.json.
 
 
 
 
 
 
== run_program API call==
 
Unlike anonimous API call we performed in our [[I2Rest_Server#basic_guide|basic guide]], authorized API call requires Oauth2 token with [[I2Rest_scopes#run_program|"run_program" scope]] and <code>*local</code> [[I2Rest_Gates#Session_System|Session System]] defined.
 
So that's how we  will change your [[I2Rest_quick_config|basic server configuration]] (with or without ssl protection) to perform authorized run_program API call:
 
:a) Add the snippet bellow to the [[Session_system_object|session systems object]]:
 
<pre>{
 
      "name": "*LOCAL",
 
      "submit": SBMJOB JOB(I2RESTS) USER(${user})
 
                  CMD(CALL I2REST PARM(
 
                      '-session'
 
                      '-url' '${surl}'
 
                      '-uid' '${uid}'
 
                      '-user' '${user}'
 
                      '-init' 'ADDLIBLE I2REST'))
 
                      '-dcm_client_id' 'MYCLIENT'))"
 
},
 
</pre>
 
:b) Register two users on IBM i - one for a "сlient" parameter and one for a "user" parameter.
 
:c) Fill the [[I2Rest_Advanced_Setup#Oauth2_obj_template|OAuth2 object template]] above with IBM i users values and add to your *.json.
 
:d) Add the "run_program" scope to scopes object.
 
:e) Change the pscms object as follows:
 
    "pcmls":
 
    [
 
      {
 
          "pcml_mount"        : "echo",
 
          "pcml_file"          : "<complete name of i2restecho.pcml on IFS (for example /tmp/PCML/i2restecho.pcml)>",
 
          "valid_in_anonymous" : <span style="color:red;">false</span>
 
      }
 
    ]
 
:f) Restart server to apply your new configuration *.json.
 
Now you can update your [[I2Rest_Basic_Test#SOAP_UI|SoapUI ECHO test project]] with [[Auth_profile_SoapUI|Authorization profile]] and perform your authorized API call.
 

Latest revision as of 20:25, 12 July 2020

This section describes configuration options of i2Rest Server. Basic configuration allows only demo server functionality, and must be extended to supply full functional server instancence. Combining examples bellow you can achieve server functionality that suits your requirements.

i2Rest server should be restarted to aplly your new configuration *.json.