Skip to main content

com.sabre.redapp.example3.desktop.sso Sample

This sample shows exemplary use of the SSO service.

Prerequisites

In order to use the SSO service, the appropriate configuration must be created first. After the SSO configuration request is successfully processed, the requester will receive the information required to use the SSO service (Read more about SSO Setup Procedure).

How the sample works

The sample allows for opening a view containing a webkit browser. You can read more about how to configure it here. The HTML page is then opened in the browser, which executes the following JavaScript:

function initSso() {
    const params = { // (1)
        'address': 'Cracow, Poland',
        'provider': 'Sabre'
    };
    const serviceProvider = 'http://sampleRedAppSP.sabre.com'; // (2)

    const responseJson = JSON.parse(SrwApi.sso(serviceProvider, params)); // (3)
    const assertion = responseJson.response.payload.assertion;

    document.getElementById('SAMLResponse').value = assertion; // (4)
    document.forms[0].submit();
}
  1. When generating a SAML assertion, you can define additional attributes to be included in the assertion.

  2. Service Provider ID received after successful SSO configuration request.

  3. Retrieving SAML assertion from SSO service via a JavaScript API.

  4. Posting assertion to the server-side via an HTML form.

After receiving the assertion, the server-side validates it and then performs appropriate actions depending on the validation result (for example, informs the user about errors or creates a session with the client).