MUnit和Spring安全架构

时间:2019-07-09 21:30:58

标签: spring-security mule munit

我有一个包含Spring Security基本身份验证的API-kit项目。该应用程序无需MUnit测试即可构建并成功运行。包括MUnit测试时,它无法生成以下内容:

WARN  2019-07-09 11:21:18,619 [main] org.springframework.beans.factory.xml.XmlBeanDefinitionReader: Ignored XML validation warning
org.xml.sax.SAXParseException: schema_reference.4: Failed to read schema document 'http://www.mulesoft.org/schema/mule/spring-security/current/mule-spring-security.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.

运行MUnit自己测试,全部通过。

实现此安全性的流使用以下内容:

<mule-ss:http-security-filter
            doc:name="API Secutiry filter"
            realm="mule-realm"
            securityProviders="delegateSecurityProvider" />

其中安全管理器定义为:

<mule-ss:security-manager
    name="Spring_Security_Provider"
    doc:name="Spring Security Provider">
    <mule-ss:delegate-security-provider
        name="delegateSecurityProvider"
        delegate-ref="authenticationManager" />
</mule-ss:security-manager>

,并且身份验证管理器定义为:

<spring:beans>
    <ss:authentication-manager alias="authenticationManager">
        <ss:authentication-provider>
            <ss:user-service id="userService">
                <ss:user
                    name="${gov.mt.dphhs.telcor.authentication.user}"
                    password="${gov.mt.dphhs.telcor.authentication.password}"
                    authorities="ROLE_ADMIN" />
            </ss:user-service>
        </ss:authentication-provider>
    </ss:authentication-manager>
</spring:beans>

XML名称空间如下:

xmlns:mule-ss="http://www.mulesoft.org/schema/mule/spring-security"
xmlns:ss="http://www.springframework.org/schema/security"

http://www.mulesoft.org/schema/mule/spring-security http://www.mulesoft.org/schema/mule/spring-security/current/mule-spring-security.xsd
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd

其他信息:

<mule.version>3.8.0</mule.version>
<mule.tools.version>1.2</mule.tools.version>
<munit.version>1.3.7</munit.version>

1 个答案:

答案 0 :(得分:0)

似乎您缺少弹簧安全模块

<dependency>
  <groupId>org.mule.modules</groupId>
  <artifactId>mule-module-spring-security</artifactId>
  <version>${mule.version}</version>
</dependency>