에 나는 CXF의 웹 서비스에 WS-보안을 구현하고 다음은 뮬 흐름입니다 : -가 파일 WS-Security는 뮬
가<context:property-placeholder location="classpath:conf/DBConnectionProp.properties"/>
<!-- Authentication security-->
<mule-ss:security-manager>
<mule-ss:delegate-security-provider name="memory-provider" 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="${username}" password="${password}" authorities="ROLE_ADMIN" />
</ss:user-service>
</ss:authentication-provider>
</ss:authentication-manager>
</spring:beans>
<cxf:ws-security name="inboundSecurityConfig">
<cxf:mule-security-manager />
<cxf:ws-config>
<cxf:property key="action" value="UsernameToken" />
</cxf:ws-config>
</cxf:ws-security>
<!-- Authentication security ends-->
<flow name="securedSoapService">
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8090" path="designation" doc:name="HTTP">
<cxf:jaxws-service serviceClass="com.getdesignation.test.services.schema.maindata.v1.GetDesignation">
<cxf:ws-security ref="inboundSecurityConfig"/>
</cxf:jaxws-service>
</http:inbound-endpoint>
<component class="com.getdesignation.vertu.services.schema.maindata.v1.Impl.GetDesignationImpl" />
</flow>
지금 문제는, 그것이 속성 파일에서 사용자 이름과 암호의 값을 읽지 않습니다. 속성 파일 <ss:user name="${username}" password="${password}" authorities="ROLE_ADMIN" />
에서 값을 읽으려는 경우 전체 값을 문자열로 읽으므로 은 다음과 같이 예외가됩니다. 사용자 이름 및 암호 :
WARN 2014-09-18 21:23:41,426 [[SOAPSecurity2].connector.http.mule.default.receiver.02] org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor:
org.apache.ws.security.WSSecurityException: The security token could not be authenticated or authorized
at org.mule.module.cxf.support.MuleSecurityManagerValidator.validate(MuleSecurityManagerValidator.java:57)
at org.apache.ws.security.processor.UsernameTokenProcessor.handleUsernameToken(UsernameTokenProcessor.java:153)
at org.apache.ws.security.processor.UsernameTokenProcessor.handleToken(UsernameTokenProcessor.java:66)
at org.apache.ws.security.WSSecurityEngine.processSecurityHeader(WSSecurityEngine.java:396)
at org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.handleMessage(WSS4JInInterceptor.java:281)
at org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.handleMessage(WSS4JInInterceptor.java:100)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:122)
하지만 $ {username}과 $ {password}를 제거하고 사용자 이름과 암호를 직접 입력하면 잘 돌아갑니다. 등록 정보 파일에서 사용자 이름과 암호를 읽는 방법을 알지 못합니다. 도와주세요 .. proprties 파일에서 ws 보안 읽기를 구현하는 방법이 있습니까 ??? 사용
"전체 값을 문자열로 읽음"이란 무엇을 의미합니까? 'username/password '속성은'conf/DBConnectionProp.properties'에 정의되어 있습니까? 나는 그 이름으로이 파일이 DB 접근을위한 특성을 포함하고 끝점을 확보하는 것이 아니라고 생각하기 때문에 상상할 수 없다. –
예 David 거기에 정의한 사용자 이름 = 사용자 이름 password = password하지만 $ {username} 또는 $ {password}를 사용할 때 여전히 읽지 않습니다 –
Mmmh, 속성 파일이로드되지 않은 것 같습니다. 'context-property-placeholder'에'ignore-resource-not-found = "false"를 추가 할 수 있습니까? –