Skip to content

HttpAuth

Rob Fone edited this page Apr 9, 2019 · 7 revisions

Define the authentication method to use with an HTTP request

Parameters

Parameter Name Description Required
RequestObjectName The name of the Request object to apply the authentication method Yes
Type The type of authentication. Basic and Digest are currently supported Yes
Credentials The values to provide for the selected authentication Yes

Credentials

For Basic authentication:

Property Name Description Required
Login The name of the account Yes
Password Password of the account Yes

For Digest authentication:

Property Name Description Required
Login The name of the account Yes
Password Password of the account Yes
Uri Uri associated with authentication Yes
Domain Domain associated with authentication No

Examples:

Set up Basic authentication for a request

{
  "NewHttpRequest": {
    "ObjectName": "SystemRequest"
  }
},
{
  "HttpAuth": {
    "RequestObjectName": "SystemRequest",
    "Type": "Basic",
    "Credentials": {
      "Login": "%FuncUserName%",
      "Password": "%FuncPassword%"
    }
  }
},
{
  "Request": {
    "RequestObjectName": "SystemRequest",
    "ResponseObjectName": "SystemResponse",
    "Verb": "GET",
    "Url": "/HTTP/Basic/",
    "IgnoreServerCertAuthentication": true,
    "Content": {
      "ContentType": "text/html"
    }
  }
}

Set up Digest authentication for a request

{
  "NewHttpRequest": {
    "ObjectName": "SystemRequest"
  }
},
{
  "HttpAuth": {
    "RequestObjectName": "SystemRequest",
    "Type": "Digest",
    "Credentials": {
      "Login": "%FuncUserName%",
      "Password": "%FuncPassword%",
      "Uri": "%AddressGiven%/HTTP/Digest/"
    }
  }
},
{
  "Request": {
    "RequestObjectName": "SystemRequest",
    "ResponseObjectName": "SystemResponse",
    "Verb": "GET",
    "Url": "/HTTP/Digest/",
    "IgnoreServerCertAuthentication": true,
    "Content": {
      "ContentType": "text/html"
    }
  }
}

NOTE: It is strongly advised that you only use https:// URI scheme.

Compatibility

This command was introduced in Safeguard 2.7