Commit a3096422 authored by Joe Fajen's avatar Joe Fajen
Browse files

Adding information about Authentication from Shaun Case. Addresses Bugzilla bug #15423.

parent 074e2727
Pipeline #43 canceled with stages
......@@ -14,6 +14,8 @@
* [Recalling Presets](#recalling-presets)
* [Dealing with Authentication](#dealing-with-authentication)
<a name="recording-and-streaming-commands">&nbsp;</a>
### Recording and Streaming Commands
......@@ -399,5 +401,59 @@ The resulting http response should look something like:
This shows the result value is "2", which corresponds to the name "Complete".
<a name="dealing-with-authentication">&nbsp;</a>
### Dealing with Authentication
When User Authentication is disabled--that is, when 'eParamID_Authentication' is set to the value 0--REST accesses can be completed without worrying about passwords or authentication. However, when User Authentication is enabled ('eParamID_Authentication' is set to the value 0) then REST accesses to HELO as described elsewhere will fail with an error that looks like this:
```
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head><title>404 Not Found</title></head><body>
The document requested was not found on this server.
</body></html>
```
In order for REST commands to HELO to succeed when User Authentication is enabled, a few extra steps are necessary:
1. Send a request to authenticate to HELO which contains the password using POST.
2. Save the cookie the web server sends back in the authentication response.
3. Provide the cookie in each request from then on.
### Example: Get Record State with Authentication Enabled
Via cURL with a password of honk (HELO with IP address 10.3.36.88):
1. Authenticate with password via HTTP POST.
```
$ curl -d "password_provided=honk" -X POST "http://10.3.36.88/authenticator/login" -i
HTTP/1.1 200 OK
Server: Seminole/2.71 (Linux; DF7)
Date: Mon, 19 Mar 2018 19:13:11 GMT
Connection: keep-alive
Cache-Control: no-cache
Content-Type: text/html
Set-Cookie: session=0000000e-5Qn9uwpiYiMpCxePZekIwjeREBsBA6k; path=/
Transfer-encoding: chunked
{"login":"success"}
```
2. Save the cookie returned by the web server. The cookie sent back in the response above is:
```
session=0000000e-5Qn9uwpiYiMpCxePZekIwjeREBsBA6k; path=/
```
3. Return the cookie with each REST request. In this example the cookie is simply cut and pasted onto the command line. In production it would typically be stored in a file or variable.
```
$ curl --cookie "session=0000000e-5Qn9uwpiYiMpCxePZekIwjeREBsBA6k; path=/" "10.3.36.88/config?action=get&paramid=eParamID_ReplicatorRecordState"
{"paramid":"2097225226","name":"eParamID_ReplicatorRecordState","value":"3","value_name":"eRRSFailingInIdle"}
```       
Repeat step 3 as desired.
&nbsp;
<div style="text-align: left; float:left">[<--PREV CHAPTER](/02_Using_the_REST_Interface_Developer_Page.md)</div> <div style="text-align: right; float:right">[](/)</div>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment