Проблема с хранилищем ключей JAVA jks, созданным из файла pfx - PullRequest
0 голосов
/ 11 октября 2019

Я сгенерировал файл хранилища ключей в формате JKS из входного файла pfx. При использовании файла хранилища ключей в веб-приложении tomcat при возникновении исключения просим помочь, если кто-либо сталкивался с такой же проблемой.

Исключение:

org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:351) ~[spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE]
            ... 124 common frames omitted
    Caused by: org.opensaml.common.SAMLRuntimeException: Can't obtain SP signing key
            at org.springframework.security.saml.key.JKSKeyManager.getCredential(JKSKeyManager.java:193) ~[spring-security-saml2-core-1.0.3.RELEASE.jar:1.0.3.RELEASE]
            at org.springframework.security.saml.key.JKSKeyManager.getDefaultCredential(JKSKeyManager.java:205) ~[spring-security-saml2-core-1.0.3.RELEASE.jar:1.0.3.RELEASE]
            at org.springframework.security.saml.trust.httpclient.TLSProtocolSocketFactory.initializeDelegate(TLSProtocolSocketFactory.java:113) ~[spring-security-saml2-core-1.0.3.RELEASE.jar:1.0.3.RELEASE]
            at org.springframework.security.saml.trust.httpclient.TLSProtocolSocketFactory.<init>(TLSProtocolSocketFactory.java:77) ~[spring-security-saml2-core-1.0.3.RELEASE.jar:1.0.3.RELEASE]
            at org.springframework.security.saml.trust.httpclient.TLSProtocolConfigurer.afterPropertiesSet(TLSProtocolConfigurer.java:50) ~[spring-security-saml2-core-1.0.3.RELEASE.jar:1.0.3.RELEASE]
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1633) ~[spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE]
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1570) ~[spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE]
            ... 131 common frames omitted
    Caused by: org.opensaml.xml.security.SecurityException: Could not retrieve entry from keystore
            at org.opensaml.xml.security.credential.KeyStoreCredentialResolver.resolveFromSource(KeyStoreCredentialResolver.java:136) ~[xmltooling-1.4.4.jar:na]

1 Ответ

0 голосов
/ 11 октября 2019

В исключении указывается, что openSAML не может найти ваш (SP) закрытый ключ для подписи сообщения SAML.

Должна существовать следующая конфигурация SAML (например, в spring-security.xml)

<bean id="keyManager" class="org.springframework.security.saml.key.JKSKeyManager">
        <constructor-arg type="org.springframework.core.io.Resource" value="file:/path/to/keystore/jks"/>
        <constructor-arg type="java.lang.String" value="<keystorePassword>"/>
        <constructor-arg>
            <map>
                <entry key="<keyAlias>" value="<privateKeyPassphrase>"/>
            </map>
        </constructor-arg>
        <constructor-arg type="java.lang.String" value="<defaultKeyAlias>"/>
    </bean>

Если у вас уже есть вышеупомянутая конфигурация, проверьте ваш JKS, содержит ли он частную / открытую пару ключей с псевдонимом.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...