Authenticate User with SAML Authentication
{ authenticateUserSAML }
Generates a Pyramid access authentication token using SAML authentication tokens
Method
- Enterprise Admin
- Domain Admin
- Pro
- Analyst
- Viewer
- Basic
Input Parameters
Name
token
Object Type
Description
The user credentials for authentication by SAML token.
Output Response
Successful Result Code
200
Response Type
string
Description of Response Type
The response is the security token as a base64 string. It is usually stored in a cookie.
Notes
The security token is a string that needs to be embedded in every API call to ensure the API calls are authorized. If saved as a cookie in a web browser, it can be used (for the authenticated user) to auto-login into the application. The assumption is that the user has already authenticated via SAML before attempting to authenticate into Pyramid.
Examples
This example demonstrates how to authenticate a user for embedding using SAML tokens from JavaScript.
// URL of the Pyramid installation and the path to the API 3.0 REST methods
var pyramidURL = "http://mysite.com/api3/";
function getAuthToken(samlToken) {
var URL = pyramidURL + "/authentication/authenticateUserEmbedSAML";
var credentials = {
domain: document.domain,
token: samlToken,
};
fetch(URL, {
method: "POST",
body: JSON.stringify(credentials),
})
.then((response) => response.text())
.then((token) => console.log("fetch: " + token));
}
getAuthToken("SAML TOKEN");
Code Snippets
curl -X POST \
-H "Accept: text/plain,text/plain;charset=utf-8" \
-H "Content-Type: application/json" \
"http://Your.Server.URL/API3/authentication/authenticateUserSAML" \
-d '{
"domain" : "domain",
"customData" : "customData",
"token" : "token"
}'
import com.pyramidanalytics.*;
import com.pyramidanalytics.auth.*;
import com.pyramidanalytics.model.*;
import com.pyramidanalytics.api.AuthenticationServiceApi;
import java.util.*;
import java.time.*;
public class AuthenticationServiceApiExample {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("http://Your.Server.URL/");
// Create an instance of the API class
AuthenticationServiceApi apiInstance = new AuthenticationServiceApi();
// Initialize the token parameter object for the call
UserSamlCredentials token = ; // Create the input object for the operation, type: UserSamlCredentials
try {
String result = apiInstance.authenticateUserSAML(token);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling AuthenticationServiceApi#authenticateUserSAML");
e.printStackTrace();
}
}
}
import * as PyramidAnalyticsWebApi from "com.pyramidanalytics";
// Create an instance of the API class
const api = new PyramidAnalyticsWebApi.AuthenticationServiceApi("http://Your.Server.URL")
const token = ; // {UserSamlCredentials}
api.authenticateUserSAML(token).then(function(data) {
console.log('API called successfully. Returned data: ' + data);
}, function(error) {
console.error(error);
});
using System;
using System.Diagnostics;
using PyramidAnalytics.Sdk.Api;
using PyramidAnalytics.Sdk.Client;
using PyramidAnalytics.Sdk.Model;
public class authenticateUserSAMLExample
{
public static void Main()
{
Configuration conf = new Configuration();
conf.BasePath = "http://Your.Server.URL/";
GlobalConfiguration.Instance = conf;
// Create an instance of the API class
var apiInstance = new AuthenticationServiceApi();
// Initialize the token parameter object for the call
var token = new UserSamlCredentials(); // UserSamlCredentials |
try {
// Generates a Pyramid access authentication token using SAML authentication tokens
string result = apiInstance.authenticateUserSAML(token);
Debug.WriteLine(result);
} catch (Exception e) {
Debug.Print("Exception when calling AuthenticationServiceApi.authenticateUserSAML: " + e.Message );
}
}
}
import com.pyramidanalytics
from com.pyramidanalytics import ApiException
from com.pyramidanalytics import AuthenticationServiceApi
from pprint import pprint
api_config = com.pyramidanalytics.Configuration(host = 'http://Your.Server.URL')
with com.pyramidanalytics.ApiClient(api_config) as api_client:
# Create an instance of the API class
api_instance = AuthenticationServiceApi(api_client)
# Initialize the token parameter object for the call
token = # UserSamlCredentials |
try:
# Generates a Pyramid access authentication token using SAML authentication tokens
api_response = api_instance.authenticate_user_saml(token)
pprint(api_response)
except ApiException as e:
print("Exception when calling AuthenticationServiceApi->authenticateUserSAML: %s\n" % e)
<?php
require_once(__DIR__ . '/vendor/autoload.php');
OpenAPITools\Client\Configuration::getDefaultConfiguration()->setHost('http://Your.Server.URL');
// Create an instance of the API class
$api_instance = new OpenAPITools\Client\Api\AuthenticationServiceApi();
$token = ; // UserSamlCredentials |
try {
$result = $api_instance->authenticateUserSAML($token);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling AuthenticationServiceApi->authenticateUserSAML: ', $e->getMessage(), PHP_EOL;
}
?>