Skip to content

HttpAuth

Miriam McMahon edited this page Apr 27, 2023 · 7 revisions

Description

Define the authentication method to use with an HTTP request

Parameters

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

Types

Credentials

For Basic authentication:

Property Name Description Type Resolved Type Required
Login The name of the account Value String Yes
Password Password of the account Value String Yes

For Digest authentication:

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

Compatibility

This command was introduced in Safeguard 2.8

Examples:

Example: 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"
    }
  }
}

Example: 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.