UserCreds.SAML2

Syntax

SAML2: PP.Mb.SAML2LogonData

Description

The SAML2 property sets credentials for repository login using the SAML 2.0 protocol.

Example

Executing the example requires Prognoz Platform 9 web application. This requires that repository login using SAML 2.0 protocol is set up. Execute the following code in the browser console:

var samlUrl = PP.AppConfig.SAMLUrl;
var body = {};
var req = new PP.Ajax({
    Url: samlUrl,
    Type: PP.Ajax.Type.GET,
    Success: PP.Delegate(function (sender, args) {
        var res = JSON.parse(args.ResponseText);
        var saml = PP.getProperty(res, "GetSAMLRequestResult.samlRequest");
        if (saml) {
            window.location.href = saml; // redirecting to identification provider
            return;
        }
        if (!PP.App.getActiveModule() && PP.App._moduleObject)
            PP.App._moduleObject.show();
        args.Args.Waiter.hide();
        if (res.OpenMetabaseResult) {
            PP.App._onMetabaseOpenedSuccess(sender, args);
            return;
        }
        // Opening the repository
        saml = res.GetSAMLResponseResult || {};
        var mbCfg = PP.App.getMetabaseConfig();
        mbCfg.UserCreds = {
            SAML2: new PP.Mb.SAML2LogonData({
                ResponseUrl: saml.responseUrl,
                RemoteAddr: saml.remoteAddr,
                SamlResponse: saml.samlResponse
            })
        };
        mbCfg.Authentication = PP.App.AuthenticationMode.Ignore;
        PP.App.openMetabase(mbCfg);
    }),
    Body: body
});
req.send(JSON.stringify(body));

After executing the example the repository opens using SAML 2.0.

See also:

UserCreds