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

Integrating Passive Federation

Integrating Passive Federation

Passive federation relies on the device's web browser to do most of the communication between the device and AD FS. That said, you still need to know what URL to request and how to acquire the SAML token from the Security Token Service's (STS) reply. The security benefit of passive federation is that the user never provides their AD credentials to your app.

The detailed passive federation workflow is presented in Introduction to Active Directory Federation Services Integration.

Prerequisites

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

Getting AD FS Metadata

You can use the GetAdfsMetadata() method to read the app's AD FS metadata from the server. The AdfsMetadata class contains MetadataUrl and Realm members that correspond to the settings that you configured for your app on the backend.

public async Task<AdfsMetadata> GetAdfsMetadata()
{
    return await this.everliveApp.WorkWith().Authentication().GetAdfsMetadata().ExecuteAsync();
}

Preparing the Request URL

After you have obtained the AD FS metadata, you are ready to open the device's web browser and point it to the appropriate URL.

The URL must be in the following format:

https:// + AD FS FQDN + /adfs/ls/ + ?wa=wsignin1.0&wreply= + MetadataUrl + /adfs/token + &wtrealm + Realm

Where:

  • AD FS FQDN is the fully qualified domain name of your AD FS.
  • MetadataUrl and Realm are contained in the AdfsMetadata class returned by GetAdfsMetadata.

For example:

https://adfs.example.com/adfs/ls?wa=wsignin1.0&wreply=https://api.everlive.com/v1/your-app-id/adfs/token&wtrealm=https://api.everlive.com/v1/your-app-id

Extracting the SAML Access Token

After the browser contacts the AD FS STS and performs authentication, the STS redirects the browser to the Reply URL and posts the SAML token to it. The server logic behind the Reply URL encodes the SAML response in base64 format and redirects the user device browser to localhost appended with the access_token HTML parameter containing the SAML token. You need to parse the resulting URL to extract the SAML token from it.

The URL has the following format:

http://localhost?access_token=saml-access-token

Where saml-access-token is the base64-encoded SAML access token.

Registering or Authenticating the User

After you obtain an SAML token from the AD FS STS, you can use the LoginWithAdfs() method overload that accepts a Base64-encoded token.

On first invocation, LoginWithAdfs registers the user. Consequent invocations for the same user authenticate the user.

On success, the method returns an object containing a Telerik Platform access token (not to be mistaken with the AD FS SAML security token) that can be used with further Backend Services .NET SDK operations. In that, the LoginWithAdfs() method behaves similarly to the Login() method.

public async Task<AccessToken> LoginUser(EverliveApp app, string token)
{
    return await app.WorkWith().Authentication().LoginWithAdfs(token).ExecuteAsync();
}

See Also

External resources:

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.