Аутентификация пользователя для встраивания с использованием OpenID

Генерирует токен аутентификации доступа Дельта BI для встраивания по словаре параметров OpenID

Метод

/API3/authentication/authenticateUserEmbedOPENID
  • Раздел API: /API3/authentication
  • Версия API: 3.0
  • Начиная с релиза: 2023.10
  • Использование: REST API и клиентские библиотеки SDK. REST API — только через POST-запросы.
  • Кто использует:
    • Enterprise Admin
    • Domain Admin
    • Pro
    • Analyst
    • Viewer
    • Basic

Сигнатура метода

Входные параметры

Имя

userOpenIdCredentials

Тип объекта

UserOpenIdCredentials

Описание

Учётные данные пользователя для аутентификации по словаре параметров OpenID.

Выходной ответ

Код успешного результата

200

Тип ответа

string

Описание типа ответа

Ответ представляет собой токен безопасности в виде строки base64. Обычно он сохраняется в cookie.

Примечания

Токен безопасности — это строка, которую нужно добавить в 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/";

// Domain of the Pyramid installation var domainName = “YOUR_DOMAIN”

// The response from the OpenId authentication var openIdToken = “YOUR_OPEN_ID_TOKEN(RESPONSE)”;

  function getAuthToken() {
    var URL = pyramidURL + "/authentication/authenticateUserEmbedOPENID";
    var credentials = {
      parameterMap: {
				id_token: openIdToken,
				state: "preferred_username",
			}
    };

    fetch(URL, {
      method: "POST",
      credentials: "include",
      body: JSON.stringify(credentials),
    })
      .then((response) => response.text())
      .then((token) => console.log("fetch: " + token));
  }

  getAuthToken();</pre></details>

Примеры кода

TypeScript

Curl

Java

C#

Python

PHP

curl -X POST \
 -H "Accept: text/plain,text/plain;charset=utf-8" \
 -H "Content-Type: application/json" \
 "http://Your.Server.URL/API3/authentication/authenticateUserEmbedOPENID" \
 -d '{
  "domain" : "domain",
  "idToken" : "idToken",
  "customData" : "customData",
  "parameterMap" : "parameterMap"
}'
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 userOpenIdCredentials parameter object for the call
        UserOpenIdCredentials userOpenIdCredentials = ; // Create the input object for the operation, type: UserOpenIdCredentials 

        try {
            String result = apiInstance.authenticateUserEmbedOPENID(userOpenIdCredentials);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AuthenticationServiceApi#authenticateUserEmbedOPENID");
            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 userOpenIdCredentials = ; // {UserOpenIdCredentials} 

api.authenticateUserEmbedOPENID(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 authenticateUserEmbedOPENIDExample
{
    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 for embedding using OpenID parameter map
            string result = apiInstance.authenticateUserEmbedOPENID(userOpenIdCredentials);
            Debug.WriteLine(result);
        } catch (Exception e) {
            Debug.Print("Exception when calling AuthenticationServiceApi.authenticateUserEmbedOPENID: " + 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 userOpenIdCredentials parameter object for the call
    userOpenIdCredentials =  # UserOpenIdCredentials | 

    try:
        # Generates a Pyramid access authentication token for embedding using OpenID parameter map
        api_response = api_instance.authenticate_user_embed_openid(userOpenIdCredentials)
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling AuthenticationServiceApi->authenticateUserEmbedOPENID: %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();
$userOpenIdCredentials = ; // UserOpenIdCredentials | 

try {
    $result = $api_instance->authenticateUserEmbedOPENID($userOpenIdCredentials);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling AuthenticationServiceApi->authenticateUserEmbedOPENID: ', $e->getMessage(), PHP_EOL;
}
?>