title: How to read username and password from a properties file for WS-Security in Mule
body: <p>I have implemented WS-security in CXF webservice and following is the Mule flow :-</p>
  
  <pre><code>&lt;context:property-placeholder location="classpath:conf/DBConnectionProp.properties"/&gt;
      &lt;!-- Authentication security--&gt;
       &lt;mule-ss:security-manager&gt;
              &lt;mule-ss:delegate-security-provider name="memory-provider" delegate-ref="authenticationManager" /&gt;
          &lt;/mule-ss:security-manager&gt;
          &lt;spring:beans&gt;
              &lt;ss:authentication-manager alias="authenticationManager"&gt;
                  &lt;ss:authentication-provider&gt;
                      &lt;ss:user-service id="userService" &gt;
                          &lt;ss:user name="${username}" password="${password}" authorities="ROLE_ADMIN" /&gt;
                      &lt;/ss:user-service&gt;
                  &lt;/ss:authentication-provider&gt;
              &lt;/ss:authentication-manager&gt;
          &lt;/spring:beans&gt;
  
      &lt;cxf:ws-security name="inboundSecurityConfig"&gt;
      &lt;cxf:mule-security-manager /&gt;
      &lt;cxf:ws-config&gt;
      &lt;cxf:property key="action" value="UsernameToken" /&gt;
      &lt;/cxf:ws-config&gt;
      &lt;/cxf:ws-security&gt;
  
      &lt;!-- Authentication security ends--&gt;
  
      &lt;flow name="securedSoapService"&gt;
      &lt;http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8090" path="designation" doc:name="HTTP"&gt;
      &lt;cxf:jaxws-service serviceClass="com.getdesignation.test.services.schema.maindata.v1.GetDesignation"&gt;
      &lt;cxf:ws-security ref="inboundSecurityConfig"/&gt;
      &lt;/cxf:jaxws-service&gt;
      &lt;/http:inbound-endpoint&gt;
      &lt;component class="com.getdesignation.vertu.services.schema.maindata.v1.Impl.GetDesignationImpl" /&gt;
      &lt;/flow&gt;
  </code></pre>
  
  <p>Now the issue is, it is not reading the value of username and password from properties file ..
  If I try to read the values from properties file  <code>&lt;ss:user name="${username}" password="${password}" authorities="ROLE_ADMIN" /&gt;</code> then it will read the whole value as a string and will result following exception as <strong>invalid</strong> username and password :-</p>
  
  <pre><code>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)
  </code></pre>
  
  <p>But if the remove ${username} and ${password} and provide the username and password directly then it runs fine .. I am not getting how to make it to read the username and password from the properties file .. Please help .. Is there a way to implement ws-security reading from a proprties file ???</p>