【发布时间】: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