- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我是 Spring 的新手,刚刚获得了 Spring Security 和 Okta 的 SAML 身份验证,工作遵循 this tutorial .但是,Spring 拒绝超过 7200 秒的 SAML 身份验证,我想延长该时间。
docs说要在 WebSSOProfileConsumerImpl
bean 上设置 maxAuthenticationAge
,但是...我不知道该怎么做。
有人能给我举个例子或给我指明正确的方向吗?
最佳答案
通常,如果您创建了所有设置,则在@Configuration 类中使用@Been
// can put this been in any related config class, no need to create new one
@Configuration
public class Config {
@Bean
public WebSSOProfileConsumer getWebSSOProfileConsumerImpl(){
WebSSOProfileConsumerImpl consumer = new WebSSOProfileConsumerImpl();
consumer.setMaxAuthenticationAge(5000);
return consumer;
}
}
或者Xml(真实项目xml demo)
<bean class="org.springframework.security.saml.websso.WebSSOProfileConsumerImpl"
id="myWebSSOProfileConsumer">
<property name="maxAuthenticationAge" value="5000"/>
</bean>
但在您的案例中,演示示例使用 import static org.springframework.security.extensions.saml2.config.SAMLConfigurer.saml
并且您需要在其中注入(inject) WebSSOProfileConsumerImpl
并且根据 this pull request及其 source code你可能会这样做:
@Override
protected void configure(final HttpSecurity http) throws Exception {
http
.authorizeRequests()
.antMatchers("/saml*").permitAll()
.anyRequest().authenticated()
.and()
.apply(saml())
.webSSOProfileConsumer(getWebSSOProfileConsumerImpl())// <= here
// ... rest of the setup
}
public WebSSOProfileConsumerImpl getWebSSOProfileConsumerImpl() {
WebSSOProfileConsumerImpl profileConsumer = new WebSSOProfileConsumerImpl();
profileConsumer.setMaxAuthenticationAge(5000);
return profileConsumer;
}
可悲的是它还没有发布,你可能不得不重写你的SAMLConfigurer版本。或者只是从 git repo 复制粘贴新版本并使用它。
关于java - 如何在 WebSSOProfileConsumerImpl 中设置 maxAuthenticationAge?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46354521/
Spring Security中WebSSOProfileConsumerImpl.setMaxAuthenticationAge有什么用。我需要明确设置它的值吗? http://docs.sprin
我是 Spring 的新手,刚刚获得了 Spring Security 和 Okta 的 SAML 身份验证,工作遵循 this tutorial .但是,Spring 拒绝超过 7200 秒的 SA
我是一名优秀的程序员,十分优秀!