Использование: REST API и клиентские библиотеки SDK. REST API — только через POST-запросы.
Кто использует:
Enterprise Admin
Domain Admin
Pro
Analyst
Viewer
Basic
Сигнатура метода
Входные параметры
Имя
userOpenIdCredentials
Тип объекта
UserOpenIdCredentials
Описание
Учётные данные пользователя для аутентификации по словаре параметров OpenID.
Выходной ответ
Код успешного результата
200
Тип ответа
string
Описание типа ответа
Ответ представляет собой токен безопасности в виде строки base64. Обычно он сохраняется в cookie.
Примечания
Токен безопасности — это строка, которую нужно передавать в каждом вызове API, чтобы вызовы были авторизованы. Если сохранить его как cookie в веб-браузере, он может использоваться (для аутентифицированного пользователя) для автоматического входа в приложение. Предполагается, что пользователь уже прошёл аутентификацию через OpenID до попытки аутентификации в Дельта BI.
Примеры
Аутентификация пользователя с OpenID:
В этом примере показано, как выполнить аутентификацию пользователя с использованием OpenID.
// URL of the Pyramid installation and the path to the API 3.0 REST methods
var pyramidURL = "http://mysite.com/api3/";
// The response from the OpenId authentication
var openIdToken = “YOUR_OPEN_ID_TOKEN(RESPONSE)”;
//calling the API to receive the Pyramid token
let pyramidToken = callApi(
“authentication/authenticateUserOPENID”,
{
parameterMap: {
id_token: openIdToken,
state: “preferred_username”,
}
},
“”,
false
);
console.log(“fetch: " + pyramidToken);
// ##### generic REST API calling method ##############
function callApi(path,data,token=”",parseResult=true){
var xhttp = new XMLHttpRequest();
xhttp.open(“POST”, pyramidURL+path, false);
xhttp.setRequestHeader(“paToken”,token)
xhttp.send(JSON.stringify(data));
if(parseResult){
return JSON.parse(xhttp.responseText);
}else{
return xhttp.responseText;
}
}
importcom.pyramidanalytics.*;importcom.pyramidanalytics.auth.*;importcom.pyramidanalytics.model.*;importcom.pyramidanalytics.api.AuthenticationServiceApi;importjava.util.*;importjava.time.*;publicclassAuthenticationServiceApiExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=Configuration.getDefaultApiClient();defaultClient.setBasePath("http://Your.Server.URL/");// Create an instance of the API classAuthenticationServiceApiapiInstance=newAuthenticationServiceApi();// Initialize the userOpenIdCredentials parameter object for the callUserOpenIdCredentialsuserOpenIdCredentials=;// Create the input object for the operation, type: UserOpenIdCredentials try{Stringresult=apiInstance.authenticateUserOPENID(userOpenIdCredentials);System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling AuthenticationServiceApi#authenticateUserOPENID");e.printStackTrace();}}}
import*asPyramidAnalyticsWebApifrom"com.pyramidanalytics";// Create an instance of the API class
constapi=newPyramidAnalyticsWebApi.AuthenticationServiceApi("http://Your.Server.URL")constuserOpenIdCredentials=;// {UserOpenIdCredentials}
api.authenticateUserOPENID(userOpenIdCredentials).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 authenticateUserOPENIDExample
{
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 userOpenIdCredentials parameter object for the call
var userOpenIdCredentials = new UserOpenIdCredentials(); // UserOpenIdCredentials |
try {
// Generates a Pyramid access authentication token using OpenID authentication parameter map and custom data
string result = apiInstance.authenticateUserOPENID(userOpenIdCredentials);
Debug.WriteLine(result);
} catch (Exception e) {
Debug.Print("Exception when calling AuthenticationServiceApi.authenticateUserOPENID: " + e.Message );
}
}
}
importcom.pyramidanalyticsfromcom.pyramidanalyticsimportApiExceptionfromcom.pyramidanalyticsimportAuthenticationServiceApifrompprintimportpprintapi_config=com.pyramidanalytics.Configuration(host='http://Your.Server.URL')withcom.pyramidanalytics.ApiClient(api_config)asapi_client:# Create an instance of the API classapi_instance=AuthenticationServiceApi(api_client)# Initialize the userOpenIdCredentials parameter object for the calluserOpenIdCredentials=# UserOpenIdCredentials | try:# Generates a Pyramid access authentication token using OpenID authentication parameter map and custom dataapi_response=api_instance.authenticate_user_openid(userOpenIdCredentials)pprint(api_response)exceptApiExceptionase:print("Exception when calling AuthenticationServiceApi->authenticateUserOPENID: %s\n"%e)
<?phprequire_once(__DIR__.'/vendor/autoload.php');OpenAPITools\Client\Configuration::getDefaultConfiguration()->setHost('http://Your.Server.URL');// Create an instance of the API class
$api_instance=newOpenAPITools\Client\Api\AuthenticationServiceApi();$userOpenIdCredentials=;// UserOpenIdCredentials |
try{$result=$api_instance->authenticateUserOPENID($userOpenIdCredentials);print_r($result);}catch(Exception$e){echo'Exception when calling AuthenticationServiceApi->authenticateUserOPENID: ',$e->getMessage(),PHP_EOL;}?>