Использование Spring SAML Extension Файловый поставщик метаданных с пакетом jar - PullRequest
0 голосов
/ 31 октября 2019

Я использую файловый поставщик метаданных opensaml для расширения SAML Spring Boot.

Я использую следующие версии зависимостей

  • Версия Spring Boot: 1.5.13.RELEASE
  • Spring Security SAML2 Core: 1.0.2.RELEASE

Конфигурация в SecurityContext.xml:

<bean class="org.springframework.security.saml.metadata.ExtendedMetadataDelegate">
    <constructor-arg>
        <bean class="org.opensaml.saml2.metadata.provider.FilesystemMetadataProvider">
            <constructor-arg>
                <value type="java.io.File">classpath:/metadata/localhost_sp.xml</value>
            </constructor-arg>
            <property name="parserPool" ref="parserPool"/>
        </bean>

    <!-- some other providers here -->

    </constructor-arg>
</bean>

localhost_sp.xml находится под src/main/resources/metadata/

Это прекрасно работает при запуске war, но не при сборке jar пакета.

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.opensaml.saml2.metadata.provider.FilesystemMetadataProvider#4d63b624' defined in class path resource [secur
ityContext.xml]: Error converting typed String value for constructor argument; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert value of type 'java.lang.String' to required
 type 'java.io.File'; nested exception is java.lang.IllegalArgumentException: Could not retrieve file for class path resource [metadata/localhost_sp.xml]: class path resource [metadata/localhost_sp.xml] cannot 
be resolved to absolute file path because it does not reside in the file system: jar:file:/tmp/my-spring-application.jar!/BOOT-INF/classes!/metadata/localhost_sp.xml
...