Использование Spring Security SAML Siteminder - PullRequest
0 голосов
/ 17 февраля 2019

Я пытаюсь интегрировать Siteminder с Spring Security.Пользователи, уже подключенные к Windows (проверка подлинности домена), могут получить доступ к веб-приложению (Tomcat-RHEL) с текущим именем пользователя Windows, роли управляются самим веб-приложением.это возможно ?есть какой-нибудь пример, который может помочь мне начать этот проект

Я раньше читал о Spring Security, но я не могу понять, как реализовать эту конфигурацию.https://docs.spring.io/spring-security-saml/docs/1.0.0.RELEASE/reference/html/chapter-quick-start.html

1 Ответ

0 голосов
/ 18 февраля 2019

В настоящее время мы переписываем SAML для Spring Security, чтобы улучшить взаимодействие с пользователем.

Тем временем вы можете ознакомиться с нашей новой версией 2.0.0.M24, которая является самой последней.

URL-адрес Gradle

    repositories {
        ...
        maven { url "https://repo.spring.io/milestone" }
        ...
    }

Импорт зависимости

compile "org.springframework.security.extensions:spring-security-saml2-core:2.0.0.M24")

Для примера доступен пример проекта [1], если вы хотите попробовать его.Это часть основного репозитория.

Участник github также создал отдельный образец и руководство

Это должно помочь вам начать.

Будущеебудет выглядеть примерно так (еще не выпущено) :


@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        // @formatter:off
        http
            //application security
            .authorizeRequests()
                .anyRequest().authenticated()
                .and()
            //saml security
            .apply(
                SamlServiceProviderConfigurer.saml2Login()
            )
        ;
        // @formatter:on
    }

    @Bean
    protected ServiceProviderConfigurationResolver configurationResolver() {
        return fromConfiguration(
            config -> config
                .keys(
                    KeyData.builder()
                        .id("sp-signing-key")
                        .privateKey(privateKey)
                        .certificate(certificate)
                        .passphrase("sppassword")
                        .build()
                )
                .providers(
                    ExternalIdentityProviderConfiguration.builder()
                        .alias("simplesamlphp")
                        .metadata("http://simplesaml-for-spring-saml.cfapps.io/saml2/idp/metadata.php")
                        .build()
                )
        );
    }

    private String privateKey = "-----BEGIN RSA PRIVATE KEY-----\n" +
        "Proc-Type: 4,ENCRYPTED\n" +
        "DEK-Info: DES-EDE3-CBC,7C8510E4CED17A9F\n" +
        "\n" +
        "...==\n" +
        "-----END RSA PRIVATE KEY-----";
    private String certificate = "-----BEGIN CERTIFICATE-----\n" +
        "...\n" +
        "RZ/nbTJ7VTeZOSyRoVn5XHhpuJ0B\n" +
        "-----END CERTIFICATE-----";

}

Ссылки:

[1] https://github.com/spring-projects/spring-security-saml/blob/ca29a44d4777425e9553d8e97ef960ef1b95d935/samples/boot/simple-service-provider/src/main/resources/application.yml#L23-L168

[2] https://github.com/Endeios/samlv2app

...