2016-12-20 35 views
2

spring saml tutorialで説明したように、私は私がw3.domクラスが見つからない問題を克服するためのpom.xmlにHTTPステータス401 - 認証に失敗しました:エラーデコードし、着信SAMLメッセージ

<dependency> 
    <groupId>xml-apis</groupId> 
    <artifactId>xml-apis</artifactId> 
    <version>1.4.01</version> 
</dependency> 

を追加することを除いて、すべてをしました。サンプルプロジェクトを実行すると、ブラウザには HTTP Status 401 - Authentication Failed: Error decoding incoming SAML message、コンソールには(CertPathPKIXTrustEvaluator.java:81) ERROR org.springframework.security.saml.trust.MetadataCredentialResolver - PKIX path construction failed for untrusted credential: [subjectName='CN=idp.ssocircle.com' |credential entityID='https://idp.ssocircle.com']: unable to find valid certification path to requested targetと表示されます。

パッケージフローのスクリーンショット: package flow screenshot

DAY 2: 私はkeytool -importcert -alias identtrustca -file ca.cer -keystore samlKeystore.jksを実行して、新しい生成ものとsecurity/samlKeystore.jksを交換してください。 securityContext.xml

<bean id="keyManager" class="org.springframework.security.saml.key.JKSKeyManager"> 
    <constructor-arg value="classpath:security/samlKeystore.jks"/> 
    <constructor-arg type="java.lang.String" value="nalle123"/> 
    <constructor-arg> 
     <map> 
      <entry key="apollo" value="nalle123"/> 
     </map> 
    </constructor-arg> 
    <constructor-arg type="java.lang.String" value="apollo"/> 
</bean> 

それから私は持っている:

<bean id="keyManager" class="org.springframework.security.saml.key.JKSKeyManager"> 
    <constructor-arg value="classpath:security/samlKeystore.jks"/> 
    <constructor-arg type="java.lang.String" value="123456"/> 
    <constructor-arg> 
     <map> 
      <entry key="apollo" value="123456"/> 
     </map> 
    </constructor-arg> 
    <constructor-arg type="java.lang.String" value="apollo"/> 
</bean> 

するとコンソールは言う:

Servlet.service() for servlet [jsp] in context with path [/spring-security-saml2-sample] threw exception 
java.lang.RuntimeException: Key for alias apollo not found 
    at org.springframework.security.saml.metadata.MetadataGenerator.getServerKeyInfo(MetadataGenerator.java:201) 
を使用 keytoolがとき

Caused by: java.io.IOException: Keystore was tampered with, or password was incorrect 
    at sun.security.provider.JavaKeyStore.engineLoad(Unknown Source) 
    at sun.security.provider.JavaKeyStore$JKS.engineLoad(Unknown Source) 
    at java.security.KeyStore.load(Unknown Source) 
    at org.springframework.security.saml.key.JKSKeyManager.initialize(JKSKeyManager.java:117) 
    ... 57 more 
Caused by: java.security.UnrecoverableKeyException: Password verification failed 
    ... 61 more 

は、それから私は私が入ったものにパスワードを変更します

だから私はidenttrustcaapolloを変更します。

<bean id="keyManager" class="org.springframework.security.saml.key.JKSKeyManager"> 
    <constructor-arg value="classpath:security/samlKeystore.jks"/> 
    <constructor-arg type="java.lang.String" value="123456"/> 
    <constructor-arg> 
     <map> 
      <entry key="identtrustca" value="123456"/> 
     </map> 
    </constructor-arg> 
    <constructor-arg type="java.lang.String" value="identtrustca"/> 
</bean> 

とコンソールは言う:

Servlet.service() for servlet [jsp] in context with path [/spring-security-saml2-sample] threw exception 
java.lang.UnsupportedOperationException: trusted certificate entries are not password-protected 

は、その後、私はthisthisを読んで、私は(私はそれが秘密鍵のものであると考えている)entry要素を削除し、それは次のようになります。

<bean id="keyManager" class="org.springframework.security.saml.key.JKSKeyManager"> 
    <constructor-arg value="classpath:security/samlKeystore.jks"/> 
    <constructor-arg type="java.lang.String" value="123456"/> 
    <constructor-arg> 
     <map/> 
    </constructor-arg> 
    <constructor-arg type="java.lang.String" value="identtrustca"/> 
</bean> 

今の問題は、次のようになります。

Servlet.service() for servlet [jsp] in context with path [/spring-security-saml2-sample] threw exception 
java.lang.RuntimeException: Key with alias identtrustca doesn't have a private key 

DAY 2第二の部分: は今、私の代わりに新しいキーストアを作成する私は古いsamlKeystore.jksを使用する必要があることを理解しています。 keytool -list -V -keystore d:\temp\samlKeystore.jksを使用している場合、3つの項目が含まれていることがわかります(もともとは2です)。

SPがIdPメタデータから公開鍵を取得する理由はわかりませんが、依然としてIdPのca.cerは必要ですか?それは1と異なっているが、私は今、私が午前、私が代わりにError decoding incoming SAML messageを得るための今、またopenssl s_client -connect idp.ssocircle.com:443 -showcerts

により取得し、認証Webサイトからca.cerは、IdPの証明書であると考えていHTTP Status 401 - Authentication Failed: Response issue time is either too old or with date in the future

DAY 3 SPを起動したときに、クロムとFirefoxの両方からhttp://localhost:8080/spring-security-saml2-sample/にアクセスしたときに、あるエクスプローラでグローバルログアウトを押して、もう一方をリフレッシュすると、ログアウトページは表示されません。私はSSOのために、同じSPからのグローバルログアウトはマルチセッションを無視しなければならないと考えました。例えば、一度グローバルログインしてからもう一度ログアウトすると、ログアウトページが表示されます。もう一方のエクスプローラも(私がリフレッシュする場合)。実際には、複数のSP、私は1つにログアウト1のために、私は一度に記録されたすべてのSPにログアウトを見ることができるはずです。

DAY N SAMLプロジェクトのURLを変更することにより、一つはメタデータを変更する必要がありますidp.ssocircle.com(メタデータの管理)。そうしないと、idpのWebサイトにエラーが表示されます。これはdocs/reference/htmlsingle/index.htmlに書かれています

+0

http://stackoverflow.com/questions/40991685/saml-error-pkix-path-construction-failed-for-untrusted-credentialを参照してください。 –

+0

@VladimírSchäferこんにちは、私は質問2日目を更新しました。どうもありがとうございます。 – Tiina

+0

@VladimírSchäfer2日目の2日目を参照してください。2日目はクリアされています。 :) – Tiina

答えて

2

IDPメタデータの証明書は、SAML XML文書にデジタル署名するために使用されます。失敗した証明書は、www.ssocircle.comのHTTPSエンドポイントからのもので、Spring SAMLがArtifact Resolution中に呼び出すものです。これらの2つの証明書は通常異なるものです。

SSOCircleは最近、www.ssocircle.comの証明書を発行する証明機関を変更しました。SAML ERROR: PKIX path construction failed for untrusted credentialに記載されている操作は、そのCAを信頼できるようにすることです。

最新のエラーは、Spring SAMLマシンの時刻が正しく同期されていないことが原因です。

+0

応答メッセージを調べると、私はssocircleが3分後にあることに気付きました。だからこれをhttp://stackoverflow.com/questions/25647925/spring-security-saml-time-difference-between-sp-and-idp – Tiina

+0

に従って解決してください。第3日の問題を見てください。ありがとう。 – Tiina

+0

デフォルトでは、Spring SAMLはユーザーのセッションに関する情報をHTTPセッション(=クッキー)に保存し、SP側のグローバルログアウトはブラウザがアクセスできるセッションを無効にします。 Spring SAMLのLogoutProcessingはカスタムLogoutHandlerの追加をサポートしているため、アプリケーションにアプリケーション全体のセッションがあるストレージがある場合は、そのすべてを無効にすることができます。 –

関連する問題