2017-01-30 141 views
0

我使用了Spring SAML示例應用程序並按照說明操作。當使用SSOCircle IDP時,我的配置完美地按預期工作。不過,我想用ADFS來解決這個問題。所以,我遵循了關於如何使用ADFS配置Spring SAML的說明。我通過訪問Spring SAML應用程序的地方得知了它,它顯示了帶有adfs/services/trust的URL的IDP Selection頁面。當我點擊它時,它會提示我進行AD認證,這正是我所期望的。但是,當我提供AD身份驗證的用戶標識/密碼時,它會處理它並顯示一條消息,顯示「無法顯示頁面」。Spring SAML和ADFS 2.0

在地址欄中的URL頁面顯示爲:

https://localhost:8443/spring-security-saml2-sample/saml/login?idp=http%3A%2F%2FTest-DC.TEST.local%2Fadfs%2Fservices%2Ftrust

Test-DC.TEST.local是ADFS和AD託管的服務器。

在tomcat日誌或任何地方沒有錯誤。

是否有人可以使用ADFS設置Spring SAML?

+0

您可以首先使用SAML示蹤器來獲取斷言。基於所使用的綁定,可能存在XML簽名的問題。 如果沒有來自日誌的錯誤消息,即使對於使用ADFS成功設置的人也很難說。 Spring SAML文檔也有ADFS集成的一部分。 –

+0

謝謝。我會嘗試使用SAML示蹤劑。僅供參考:我使用Spring Docs的ADFS集成 – kumaran

+0

查看ADFS事件日誌並查看錯誤是什麼。 – nzpcmad

回答

0

確保您使用的是SHA2而不是SHA1。

要麼重寫的afterPropertiesSet方法:

public class SSOConfigBean 
    implements InitializingBean 
{ 

    private String signatureAlgorithmSHA = SignatureConstants.ALGO_ID_SIGNATURE_RSA_SHA256; 
    private String digestAlgorithmSHA = SignatureConstants.ALGO_ID_DIGEST_SHA256; 

    @Override 
    public void afterPropertiesSet() throws Exception 
    { 
    BasicSecurityConfiguration config = (BasicSecurityConfiguration) Configuration.getGlobalSecurityConfiguration(); 
    config.registerSignatureAlgorithmURI("RSA", signatureAlgorithmSHA); 
    config.setSignatureReferenceDigestMethod(digestAlgorithmSHA); 
    } 
} 

,並添加到您的SecurityContext:

<!-- setting encryption to SHA2 instead of default SHA1 --> 
    <bean class="path.to.SSOConfigBean"/> 

或更新你在設置你的SP元數據如下使用的SecurityContext:

<bean id="metadataGeneratorFilter" class="org.springframework.security.saml.metadata.MetadataGeneratorFilter"> 
    <constructor-arg> 
     <bean class="org.springframework.security.saml.metadata.MetadataGenerator"> 
     <property name="entityId" value="urn:samltest"/> 
     <property name="extendedMetadata"> 
      <bean class="org.springframework.security.saml.metadata.ExtendedMetadata"> 
      <property name="idpDiscoveryEnabled" value="false"/> 
      <property name="local" value="true"/> 
      <property name="signingAlgorithm" value="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"/> 
      </bean> 
     </property> 
     </bean> 
    </constructor-arg> 
    </bean>