SAML ACS Endpoint for Inbound SSO
POST {{authPath}}/{{envID}}/saml20/sp/acs
The POST /{{envID}}/saml20/sp/acs operation is a service provider (SP-initiated) SAML single sign-on flow that passes the application ID in the RelayState post parameter in the body of the request.
The RelayState parameter needs to be in the URL-encoded format of applicationId=<your-appID>. For example: RelayState=applicationId%3D280686bb-cfca-4825-88a1-67dc1c89c73c.
Prerequisites
-
Refer to SAML 2.0 for important overview information.
-
Create an application to get an
appID. Refer to Application Operations. Run Read All Applications to find an existing application.
Request Model
| Property | Type | Required? |
|---|---|---|
|
String |
Required |
Example Request
-
cURL
-
C#
-
Go
-
HTTP
-
Java
-
jQuery
-
NodeJS
-
Python
-
PHP
-
Ruby
-
Swift
curl --location --globoff '{{authPath}}/{{envID}}/saml20/sp/acs' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'RelayState={applicationId={{appID}}}'
var options = new RestClientOptions("{{authPath}}/{{envID}}/saml20/sp/acs")
{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("", Method.Post);
request.AddHeader("Content-Type", "application/x-www-form-urlencoded");
request.AddParameter("RelayState", "{applicationId={{appID}}}");
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{authPath}}/{{envID}}/saml20/sp/acs"
method := "POST"
payload := strings.NewReader("RelayState=%7BapplicationId%3D%7B%7BappID%7D%7D%7D")
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := io.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
POST /{{envID}}/saml20/sp/acs HTTP/1.1
Host: {{authPath}}
Content-Type: application/x-www-form-urlencoded
RelayState=%7BapplicationId%3D%7B%7BappID%7D%7D%7D
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
RequestBody body = RequestBody.create(mediaType, "RelayState={applicationId={{appID}}}");
Request request = new Request.Builder()
.url("{{authPath}}/{{envID}}/saml20/sp/acs")
.method("POST", body)
.addHeader("Content-Type", "application/x-www-form-urlencoded")
.build();
Response response = client.newCall(request).execute();
var settings = {
"url": "{{authPath}}/{{envID}}/saml20/sp/acs",
"method": "POST",
"timeout": 0,
"headers": {
"Content-Type": "application/x-www-form-urlencoded"
},
"data": {
"RelayState": "{applicationId={{appID}}}"
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
var request = require('request');
var options = {
'method': 'POST',
'url': '{{authPath}}/{{envID}}/saml20/sp/acs',
'headers': {
'Content-Type': 'application/x-www-form-urlencoded'
},
form: {
'RelayState': '{applicationId={{appID}}}'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
import requests
url = "{{authPath}}/{{envID}}/saml20/sp/acs"
payload = 'RelayState=%7BapplicationId%3D%7B%7BappID%7D%7D%7D'
headers = {
'Content-Type': 'application/x-www-form-urlencoded'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('{{authPath}}/{{envID}}/saml20/sp/acs');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'Content-Type' => 'application/x-www-form-urlencoded'
));
$request->addPostParameter(array(
'RelayState' => '{applicationId={{appID}}}'
));
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
require "uri"
require "net/http"
url = URI("{{authPath}}/{{envID}}/saml20/sp/acs")
http = Net::HTTP.new(url.host, url.port);
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/x-www-form-urlencoded"
request.body = "RelayState=%7BapplicationId%3D%7B%7BappID%7D%7D%7D"
response = http.request(request)
puts response.read_body
let parameters = "RelayState=%7BapplicationId%3D%7B%7BappID%7D%7D%7D"
let postData = parameters.data(using: .utf8)
var request = URLRequest(url: URL(string: "{{authPath}}/{{envID}}/saml20/sp/acs")!,timeoutInterval: Double.infinity)
request.addValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type")
request.httpMethod = "POST"
request.httpBody = postData
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
}
task.resume()