簡體   English   中英

Spring SAML wso2

[英]Spring SAML wso2

我正在使用Spring saml示例和wso2身份服務器中saml的基本配置來執行saml身份驗證的實現

到目前為止,當wso2服務器響應我的應用程序時,我在登錄后收到此錯誤。

而且我不知道該怎么看。

org.springframework.security.authentication.AuthenticationServiceException: 確定 org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter。 org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:342)處org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)處org.springframework.security org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:166)org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter處的.web.FilterChainProxy.doFilter(FilterChainProxy.java:166) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerReques處的.doFilterInternal(WebAsyncManagerIntegrationFilter.java:50) org上org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:342)上的org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)上的tFilter.java:107) org.springframework.security.saml.metadata.MetadataGeneratorFilter.doFilter(MetadataGeneratorFilter.java:87)上的.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:342)在org.springframework.security.web.FilterChainProxy org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)上的org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)上的$ VirtualFilterChain.doFilter(FilterChainProxy.java:342) org.eclipse.jetty.servlet.Ser上的org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344)在org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261) org.eclipse.jetty.servlet.ServletHandler.ServletHandler.doHandle(ServletHandler.java:564)上的vletHandler $ CachedChain.doFilter(ServletHandler.java:1636)在org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java: 143),位於org.eclipse.jetty.server.session的org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:578),位於org.eclipse.jetty.server的org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:221) org.eclipse.jetty.servlet.ServletHandler.ServletHandler.doScope(ServletHandler.java:498)的.handler.ContextHandler.doHandle(ContextHandler.java:1111)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.eclipse上的jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:199)org.eclips上的jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:109) e.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:98)位於org.eclipse.jetty.server.Server.handle(Server.java:461)位於org.eclipse.jetty.server.HttpChannel.handle(在org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:244)在org.eclipse.jetty.io.AbstractConnection $ 2.run(AbstractConnection.java:534)上的HttpChannel.java:284)。 org.eclipse.jetty.util.thread.QueuedThreadPool $ 3.run(QueuedThreadPool.java:536)上的jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:607)在java.lang.Thread.run(Thread.java :744)造成的:org.opensaml.saml2.metadata.provider.MetadataProviderException: 元數據發行人的東西是沒有組織的org.springframework.security.saml.processor.SAMLProcessorImpl.retrieveMessage(SAMLProcessorImpl.java:108) 找到 。 org.springframework.security.saml.SAMLProcessingFilter.attemptAuthentication(SAMLProcessingFilter.j)上的springframework.security.saml.processor.SAMLProcessorImpl.retrieveMessage(SAMLProcessorImpl.java:172) ava:77)...還有36

我能夠通過確保“身份提供者實體ID”與“ IdP元數據EntityID”匹配來解決此問題。 在WSO2 IS(版本5.2.0)管理控制台中的“身份提供者實體ID”設置位於:身份提供者/居民身份提供者/ SAML2 Web SSO配置。

“ IdP元數據entityID”是EntityDescriptor標記的屬性(根據規范 )。 我手動創建了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>

我認為春季SAML示例正在尋找IDP元數據。 可以假定WSO2 Identity Server支持SAML元數據配置文件。 但是據我所知,Identity Server仍不支持配置文件。 但是,可能在某個地方可以手動配置樣本中的IDP元數據。 因此,請檢查。 因為通常所有IDP都不需要支持此配置文件,所以必須有一些選項可以忽略它並手動執行。

此外,您還可以找到從[this]博客手動創建的Identity Server的IDP元數據。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM