public Saml2Settings getSamlSettings() throws GuacamoleException {

        // Try to get the XML file, first.
        URI idpMetadata = getIdpMetadata();
        Map<String, Object> samlMap;
        if (idpMetadata != null) {
            try {
                samlMap = IdPMetadataParser.parseRemoteXML(idpMetadata.toURL());
            }
            catch (Exception e) {
                throw new GuacamoleServerException(
                        "Could not parse SAML IdP Metadata file.", e);
            }
        }

        // If no XML metadata is provided, fall-back to individual values.
        else {
            samlMap = new HashMap<>();
            samlMap.put(SettingsBuilder.IDP_ENTITYID_PROPERTY_KEY,
                    getIdpUrl().toString());
            samlMap.put(SettingsBuilder.IDP_SINGLE_SIGN_ON_SERVICE_URL_PROPERTY_KEY,
                    getIdpUrl().toString());
            samlMap.put(SettingsBuilder.IDP_SINGLE_SIGN_ON_SERVICE_BINDING_PROPERTY_KEY,
                    Constants.BINDING_HTTP_REDIRECT);
        }

        // Read entity ID from properties if not provided within metadata XML
        if (!samlMap.containsKey(SettingsBuilder.SP_ENTITYID_PROPERTY_KEY)) {
            URI entityId = getEntityId();
            if (entityId == null)
                throw new GuacamoleServerException("SAML Entity ID was not found"
                        + " in either the metadata XML file or guacamole.properties");
            samlMap.put(SettingsBuilder.SP_ENTITYID_PROPERTY_KEY, entityId.toString());
        }

        // Derive ACS URL from properties if not provided within metadata XML
        if (!samlMap.containsKey(SettingsBuilder.SP_ASSERTION_CONSUMER_SERVICE_URL_PROPERTY_KEY)) {
            samlMap.put(SettingsBuilder.SP_ASSERTION_CONSUMER_SERVICE_URL_PROPERTY_KEY,
                    UriBuilder.fromUri(getCallbackUrl()).path("api/ext/saml/callback").build().toString());
        }

        // If a private key file is set, load the value into the builder now
        File privateKeyFile = getPrivateKeyFile();
        if (privateKeyFile != null)
            samlMap.put(SettingsBuilder.SP_PRIVATEKEY_PROPERTY_KEY,
                    readFileContentsIntoString(privateKeyFile, "Private Key"));

        // If a certificate file is set, load the value into the builder now
        File certificateFile = getCertificateFile();
        if (certificateFile != null)
            samlMap.put(SettingsBuilder.SP_X509CERT_PROPERTY_KEY,
                    readFileContentsIntoString(certificateFile, "X.509 Certificate"));

        SettingsBuilder samlBuilder = new SettingsBuilder();
        Saml2Settings samlSettings = samlBuilder.fromValues(samlMap).build();
        samlSettings.setStrict(getStrict());
        samlSettings.setDebug(getDebug());
        samlSettings.setCompressRequest(getCompressRequest());
        samlSettings.setCompressResponse(getCompressResponse());

        // Request that the SAML library sign everything that it can, if
        // both private key and certificate are specified
        if (privateKeyFile != null && certificateFile != null) {
            samlSettings.setAuthnRequestsSigned(true);
            samlSettings.setLogoutRequestSigned(true);
            samlSettings.setLogoutResponseSigned(true);
        }

        return samlSettings;
    }
Returns the collection of SAML settings used to initialize the client.

@return
    The collection of SAML settings used to initialize the SAML client.

@throws GuacamoleException
    If guacamole.properties cannot be parsed or if required parameters
    are missing.
extensions/guacamole-auth-sso/modules/guacamole-auth-sso-saml/src/main/java/org/apache/guacamole/auth/saml/conf/ConfigurationService.java