Search in sources :

Example 1 with SettingsBuilder

use of com.onelogin.saml2.settings.SettingsBuilder in project sonarqube by SonarSource.

the class SamlIdentityProvider method initSettings.

private Saml2Settings initSettings(@Nullable String callbackUrl) {
    Map<String, Object> samlData = new HashMap<>();
    samlData.put("onelogin.saml2.strict", true);
    samlData.put("onelogin.saml2.idp.entityid", samlSettings.getProviderId());
    samlData.put("onelogin.saml2.idp.single_sign_on_service.url", samlSettings.getLoginUrl());
    samlData.put("onelogin.saml2.idp.x509cert", samlSettings.getCertificate());
    samlData.put("onelogin.saml2.sp.entityid", samlSettings.getApplicationId());
    // During callback, the callback URL is by definition not needed, but the Saml2Settings does never allow this setting to be empty...
    samlData.put("onelogin.saml2.sp.assertion_consumer_service.url", callbackUrl != null ? callbackUrl : ANY_URL);
    SettingsBuilder builder = new SettingsBuilder();
    return builder.fromValues(samlData).build();
}
Also used : SettingsBuilder(com.onelogin.saml2.settings.SettingsBuilder) HashMap(java.util.HashMap)

Example 2 with SettingsBuilder

use of com.onelogin.saml2.settings.SettingsBuilder in project fess by codelibs.

the class SamlAuthenticator method getSettings.

protected Saml2Settings getSettings() {
    final Map<String, Object> params = new HashMap<>(defaultSettings);
    final DynamicProperties systemProperties = ComponentUtil.getSystemProperties();
    systemProperties.entrySet().stream().forEach(e -> {
        final String key = e.getKey().toString();
        if (!key.startsWith(SAML_PREFIX)) {
            return;
        }
        params.put("onelogin.saml2." + key.substring(SAML_PREFIX.length()), e.getValue());
    });
    return new SettingsBuilder().fromValues(params).build();
}
Also used : SettingsBuilder(com.onelogin.saml2.settings.SettingsBuilder) HashMap(java.util.HashMap) DynamicProperties(org.codelibs.core.misc.DynamicProperties)

Aggregations

SettingsBuilder (com.onelogin.saml2.settings.SettingsBuilder)2 HashMap (java.util.HashMap)2 DynamicProperties (org.codelibs.core.misc.DynamicProperties)1