Skip to main content

Check out Interactive Visual Stories to gain hands-on experience with the SSE product features. Click here.

Skyhigh Security

Authenticating to the interface

Before you can use the REST interface to perform any activities on an appliance you need to authenticate.To authenticate, you submit user name and password in the logon request that you send to the REST interface.

There are two ways to submit them:

  • Using query parameters
  • Using an authentication header

After a successful authentication, the response contains the session ID, which you must include in each of your following requests.

Using query parameters for authentication

You can submit your credentials with query parameters that you add to the URL in your logon request.

curl -i -X POST "$REST/login?userName=myusername&pass=mypassword"
Using an authentication header

You can also use the Basis Access Authentication method to authenticate, which requires that you submit your credentials in an authentication header.

curl -i -H "Authorization: Basic YWRtaW46d2ViZ2F0ZXdheQ==" -X POST "$REST/login"

In the authentication header, the string after Authorization: Basic is the Base64-encoded representation of your user name and password. 

Session ID

The session ID is sent to you in the response to your logon request. A session ID looks, for example, like this:
D0EFF1F50909466159728F28465CF763

It is either contained in the response body:
<entryxmlns="http://www.w3.org/2005/Atom">
<contenttype="text">D0EFF1F50909466159728F28465CF763</content></entry>

or in a Set-Cookie header:
Set-Cookie: JSESSIONID=D0EFF1F50909466159728F28465CF763

In the requests of the sessions that follow the logon request, you must include the session ID as JSESSIONID.

For easier code writing and reading, you can set a variable to the value of the ID and use it for including the ID.

export SESSIONID=D0EFF1F50909466159728F28465CF763

You can append the ID as a matrix parameter to the URL, preceded by a semicolon.

curl -i "$REST/appliances;jsessionid=$SESSIONID"

Alternatively, you can send the ID in a Cookie header.

curl -i -H "Cookie: JSESSIONID=$SESSIONID" "$REST/appliances"

The -c option in curl allows you to collect all cookies in a text file, which is then sent with subsequent requests.

curl -i -c cookies.txt -H "Authorization: Basic YWRtaW46d2ViZ2F0ZXdheQ=="
-X POST "$REST/login"

For sending a cookie file with a request, the -b option is used:

curl -i -b cookies.txt "$REST/appliances"

 

  • Was this article helpful?