Progress will discontinue Telerik Platform on May 10th, 2018. Learn more

Integrating Passive SAML Federation

Integrating Passive Federation

Passive federation relies on a user agent (the device's web browser) to do most of the communication between the device and the SAML IdP. That said, you still need to know what URL to request and how to acquire the SAML assertion from the SAML IdP. The security benefit of passive federation is that the user never provides their SAML IdP credentials to your app.

The detailed passive federation workflow is presented in Introduction to SAML Login Integration.

Prerequisites

You need to make certain settings before you can successfully log in your app users through SAML authentication.

Preparing the Request URL

To request a SAML assertion from the SAML IdP you need to open the device's web browser and point it to the appropriate URL. This URL depends on the SAML IdP that you use. Consult its documentation for details.

Extracting the SAML Assertion

After the browser contacts the SAML IdP and performs authentication, the SAML IdP redirects the browser to the Telerik Platform Reply URL and posts the SAML token to it. The server logic behind the Reply URL URL-encodes the SAML response and redirects the user device browser to localhost appended with the access_token HTML parameter containing the SAML assertion. You need to parse the resulting URL to extract the SAML assertion from it.

The URL has the following format:

http://localhost?access_token=saml-assertion

Where saml-assertion is the URL-encoded SAML assertion.

Registering or Authenticating a User

The Backend Services RESTful API provides a single endpoint that is used for both registration and authentication. On first invocation the user is registered with Telerik Platform. On consequent invocations for the same user Telerik Platform authenticates the user.

You register or log in a SAML IdP user by making a POST request to the built-in Users content type. You need to specify the Provider as SAML and to use the URL-encoded SAML token that you acquired earlier.

The request result contains the Telerik Platform access token and its type in the access_token and token_type fields. Registration requests will also return the Id of the created user along with its CreatedAt date on the server. Use the Telerik Platform access token in subsequent requests to Telerik Platform endpoints.

The SAML security token issued by the SAML IdP has an expiration date. This expiration date is automatically transferred to the Telerik Platform access token. When it is reached, obtain a fresh SAML authentication token before issuing a new registration/authentication call.

Request:
    POST https://api.everlive.com/v1/your-app-id/Users
Headers:
     Content-Type: application/json
Body:
    {
        "Identity": {
            "Provider": "SAML",
            "Token": "your-URL-encoded-SAML-token"
        }
    }

Response:
    -When registering:-

    Status: 201 Created
    Content-Type: application/json
    Body: {
        Id: 'user id',
        CreatedAt: 'date',
        access_token: 'Telerik Platform token',
        token_type: 'bearer'
    }

    -When authenticating:-

    Status: 200 OK
    Content-Type: application/json
    Body: {
        access_token: 'Telerik Platform token',
        token_type: 'bearer'
    }
var user = {
    "Identity": {
        "Provider": "SAML",
        "Token": "your-URL-encoded-SAML-token"
    }
};
$.ajax({
    type: "POST",
    url: 'https://api.everlive.com/v1/your-app-id/Users',
    contentType: "application/json",
    data: JSON.stringify(user),
    success: function(data){
        alert(JSON.stringify(data));
    },
    error: function(error){
        alert(JSON.stringify(error));
    }
});

See Also

Start a free trial Request a demo
Contact us: +1-888-365-2779
sales@telerik.com
Copyright © 2016-2017, Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.