saml post请求中间歇性缺少spring会话cookie

0md85ypi  于 2021-07-13  发布在  Java
关注(0)|答案(0)|浏览(163)

我使用的spring saml基于以下示例:https://github.com/vdenotaris/spring-boot-security-saml-sample
配置在大多数情况下都有效。我能够将saml请求发送给idp,并得到有效的saml响应。但是,我从idp返回的post请求在10-20%的时间里不包含会话cookie。不过,它确实包含其他饼干。我不知所措是有原因的。如果它不包括会话cookie,我想它会更容易理解。
会话未超时。我添加了一个httpsessionlistener。它不响应任何被销毁的会话。但它确实对正在创建的新会话做出了响应。我不认为这会有任何影响,但我调整了sessionfixation为无。
我很感激你提供的任何见解。谢谢,
安全配置为:

@Override  
    protected void configure(HttpSecurity http) throws Exception {
        http
            .httpBasic()
                .authenticationEntryPoint(samlEntryPoint());      
        http
                .addFilterBefore(metadataGeneratorFilter(), ChannelProcessingFilter.class)
                .addFilterAfter(samlFilter(), BasicAuthenticationFilter.class)
                .addFilterBefore(samlFilter(), CsrfFilter.class);
        http        
            .authorizeRequests()
                .antMatchers("/").permitAll()
                .antMatchers("/saml/**").permitAll()
                .antMatchers("/css/**").permitAll()
                .antMatchers("/img/**").permitAll()
                .antMatchers("/js/**").permitAll()
                .anyRequest().authenticated();
        http
                .logout()
                    .disable(); // The logout procedure is already handled by SAML filters.
    }

application.yml文件包含以下内容。我自定义了会话cookie名称,以避免与其他应用程序冲突。

server:
  port: 8091
  servlet:
    context-path: /saml
    session:
      timeout: 30m
      cookie:
        name: SAMLSESSIONID
        secure: false

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题