首页 文章

Spring SAML wso2

提问于
浏览
0

我正在使用Spring saml示例执行saml身份验证,并在wso2身份服务器中执行saml的基本配置

到目前为止,当wso2服务器响应我的应用程序时,我在登录后收到此错误 .

我不知道要注意什么 .

org.springframework.security.authentication.AuthenticationServiceException:在org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter)的org.springframework.security.saml.SAMLProcessingFilter.attemptAuthentication(SAMLProcessingFilter.java:91)中确定元数据 Contract 时出错.java:211)org.springframework上的org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:342)org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192) . security.web.FilterChainProxy.doFilter(FilterChainProxy.java:166)位于org.springframework.security.web.context.request.async的org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:342) . org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequ)中的WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:50) estFilter.java:107)org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:342)org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)at org位于org.springframework.security.web.FilterChainProxy的org.springframework.security.saml.metadata.MetadataGeneratorFilter.doFilter(MetadataGeneratorFilter.java:87)中的.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:342) org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)中的$ VirtualFilterChain.doFilter(FilterChainProxy.java:342)位于org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)at at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344)位于org.eclipse.jetty.servlet.S的org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261) ervletHandler $ CachedChain.doFilter(ServletHandler.java:1636)位于org.eclipse.jetty.server.hand.SvpedHandler.handle的org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:564)(ScopedHandler.java: 143)org.eclipse.jetty上的org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:578)或org.eclipse.jetty.server上的org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:221) .handler.ContextHandler.doHandle(ContextHandler.java:1111)在org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:498)在org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java :183)在org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1045)在org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)在org.eclipse . 在org.ecli的org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:109)的jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:199) pse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:98)在org.eclipse.jetty.server.Server.handle(Server.java:461)在org.eclipse.jetty.server.HttpChannel.handle( HttpChannel.java:284)在org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:244)在org.eclipse.jetty.io.AbstractConnection $ 2.run(AbstractConnection.java:534)在org.eclipse . jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:607)在org.eclipse.jetty.util.thread.QueuedThreadPool $ 3.run(QueuedThreadPool.java:536)在java.lang.Thread.run(Thread.java :744)造成的:org.opensaml.saml2.metadata.provider.MetadataProviderException:元数据发行人的东西是没有组织的org.springframework.security.saml.processor.SAMLProcessorImpl.retrieveMessage(SAMLProcessorImpl.java:108)找到 . orframe.springframework.security.saml.SAMLProcessingFilter.attemptAuthentication(SAMLProcessingFilter)中的springframework.security.saml.processor.SAMLProcessorImpl.retrieveMessage(SAMLProcessorImpl.java:172) .java:77)......还有36个

2 回答

  • 0

    我能够通过确保“身份提供商实体ID”与“IdP元数据实体ID”匹配来解决这个问题 . “身份提供商实体ID”设置位于WSO2 IS(版本5.2.0)管理控制台的下方:身份提供商/驻留身份提供商/ SAML2 Web SSO配置 .

    "IdP metadata entityID"是EntityDescriptor标记的属性(根据spec) . 我手动创建了WSO2 IdP元数据 . 这是我的IdP元数据:

    <EntityDescriptor entityID="localhost_wso2" validUntil="2023-09-23T06:57:15.396Z" xmlns="urn:oasis:names:tc:SAML:2.0:metadata" >
    <IDPSSODescriptor protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol">
    <KeyDescriptor use="signing">
     <ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
       <ds:X509Data>
        <ds:X509Certificate>...</ds:X509Certificate>
       </ds:X509Data>
     </ds:KeyInfo>
    </KeyDescriptor>
    <SingleLogoutService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect" Location="https://localhost:9443/samlsso" ResponseLocation="https://localhost:9443/samlsso"/>
    <SingleSignOnService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST" Location="https://localhost:9443/samlsso"/>
    <SingleSignOnService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect" Location="https://localhost:9443/samlsso"/>
    </IDPSSODescriptor>
    </EntityDescriptor>
    

    我在Spring-Saml配置中引用了上面的IdP元数据,如下所示:

    <bean id="metadata" class="org.springframework.security.saml.metadata.CachingMetadataManager">
    <constructor-arg>
      <list>
        <!-- Example of classpath metadata with Extended Metadata -->
        <bean class="org.springframework.security.saml.metadata.ExtendedMetadataDelegate">
          <constructor-arg>
            <bean class="org.opensaml.saml2.metadata.provider.ResourceBackedMetadataProvider">
              <constructor-arg>
                <bean class="java.util.Timer"/>
              </constructor-arg>
              <constructor-arg>
                <bean class="org.opensaml.util.resource.ClasspathResource">
                  <constructor-arg value="/metadata/wso2idp_metadata.xml"/>
                </bean>
              </constructor-arg>
              <property name="parserPool" ref="parserPool"/>
            </bean>
          </constructor-arg>
          <constructor-arg>
            <bean class="org.springframework.security.saml.metadata.ExtendedMetadata">
            </bean>
          </constructor-arg>
        </bean>
      </list>
    </constructor-arg>
    </bean>
    
  • 1

    我认为Spring SAML样本正在寻找IDP元数据 . 它可以假设WSO2 Identity Server支持SAML元数据轮廓 . 但据我所知,Identity Server仍然不支持this配置文件 . 但是,您可以在此处手动配置示例中的IDP元数据 . 因此,请检查它 . 因为通常所有IDP都不需要支持此配置文件,所以必须有一些选项可以忽略它并手动执行 .

    此外,您还可以找到已从[this]博客手动创建的Identity Server的IDP元数据

相关问题