【问题标题】:How to set forceAuthn as true in webssoprofileoption?如何在 webssoprofileoption 中将 forceAuthn 设置为 true?
【发布时间】:2019-02-01 08:40:03
【问题描述】:

我是 Spring-boot 的新手,刚刚获得了 Spring Security 和 Okta 的 SAML 身份验证,并按照本教程工作。在使用 WebSecurityConfigurerAdapter 进行配置时,我无法在 WebSSOProfileOptions 下设置 ForceAuthN。

谁能给我一个例子或指出正确的方向?

我尝试下面的代码但出现类型错误,请帮助解决它

public class SecurityConfiguration extends WebSecurityConfigurerAdapter {

 @Override
    protected void configure(final HttpSecurity http) throws Exception {
        http
            .authorizeRequests()
                .antMatchers("/saml*").permitAll()
                .anyRequest().authenticated()
                .and() 
            .apply(saml())
                .serviceProvider()
                    .keyStore()
                        .storeFilePath("saml/keystore.jks")
                        .password(this.password)
                        .keyname(this.keyAlias)
                        .keyPassword(this.password)
                    .and()
                    .protocol("https")
                    .hostname(String.format("%s:%s", "localhost", this.port))
                    .basePath("/")
                .and()
                .identityProvider()
                    .metadataFilePath(this.metadataUrl)
                .and()
                .WebSSOProfileOptions(getWebSSOProfileOptions());

    }
 @Bean
    public WebSSOProfileOptions getWebSSOProfileOptions() {
        WebSSOProfileOptions profile = new WebSSOProfileOptions();
        profile.setForceAuthN(true);
        return profile;
    }

}

【问题讨论】:

    标签: java spring-boot saml


    【解决方案1】:

    您应该尝试实例化 SAMLEntryPoint 并使用您的 WebSSOProfileOptions bean 配置其 defaultProfileOptions 属性。

    samlEntryPoint.setDefaultProfileOptions(getWebSSOProfileOptions());
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-02-26
      • 2016-02-05
      • 2020-06-04
      • 2010-12-12
      • 1970-01-01
      • 2021-02-07
      • 2017-06-06
      相关资源
      最近更新 更多