Search code examples
pingfederate

PingFederate REST API for /sp/adapter not working


PingFederate 8.2.2 is used for our systems.All the REST APIs to create PF objects are automated but /sp/adapter(https://pfhost:9999/pf-admin-api/v1/sp/adapters) is not working using the below JSON .Manually If I create the same configuration it works.The below mentioned JSON is retrieved from already manually created /sp/adapter.But when I use the same JSON in API call which says error as below, please help to solve this problem.

ERROR:

{
  "resultId": "validation_error",
  "message": "Validation error(s) occurred. Please review the error(s) and address accordingly.",
  "validationErrors": [
    {
      "message": "'' is not a valid selection for 'Send Extended Attributes'",
      "fieldPath": "configuration.fields[21].value",
      "errorId": "plugin_validation_error"
    }
  ]
}

JSON:

{
      "id": "opentokenadapt1",
      "name": "opentokenadapt1",
      "pluginDescriptorRef": {
        "id": "com.pingidentity.adapters.opentoken.SpAuthnAdapter"
      },
      "configuration": {
        "tables": [],
        "fields": [
          {
            "name": "Password",
            "value": "Password123"
          },
          {
            "name": "Confirm Password",
            "value": "Password123"
          },
          {
            "name": "Transport Mode",
            "value": "2"
          },
          {
            "name": "Token Name",
            "value": "opentoken"
          },
          {
            "name": "Cipher Suite",
            "value": "2"
          },
          {
            "name": "Authentication Service",
            "value": ""
          },
          {
            "name": "Account Link Service",
            "value": ""
          },
          {
            "name": "Logout Service",
            "value": ""
          },
          {
            "name": "Cookie Domain",
            "value": ""
          },
          {
            "name": "Cookie Path",
            "value": "/"
          },
          {
            "name": "Token Lifetime",
            "value": "300"
          },
          {
            "name": "Session Lifetime",
            "value": "43200"
          },
          {
            "name": "Not Before Tolerance",
            "value": "0"
          },
          {
            "name": "Force SunJCE Provider",
            "value": "false"
          },
          {
            "name": "Use Verbose Error Messages",
            "value": "false"
          },
          {
            "name": "Obfuscate Password",
            "value": "true"
          },
          {
            "name": "Session Cookie",
            "value": "false"
          },
          {
            "name": "Secure Cookie",
            "value": "false"
          },
          {
            "name": "HTTP Only Flag",
            "value": "true"
          },
          {
            "name": "Send Subject as Query Parameter",
            "value": ""
          },
          {
            "name": "Subject Query Parameter                 ",
            "value": ""
          },
          {
            "name": "Send Extended Attributes",
            "value": ""
          },
          {
            "name": "Skip Trimming of Trailing Backslashes",
            "value": "false"
          }
        ]
      },
      "attributeContract": {
        "coreAttributes": [
          {
            "name": "subject"
          }
        ],
        "extendedAttributes": [
          {
            "name": "nsroles"
          }
        ]
      }
    }

Solution

  • "Send Extended Attributes" needs a valid value (not the empty string you've given it). The possible values are "0" (None), "1" (Cookies) or "2" (Query Parameters).

    One tip in trying to narrow these issues down: try building the SP adapter instance in the PingFederate administrative console (UI) then compare it with the JSON model you GET from the API.