2016-08-19 130 views
0

我使用Spring基于Spring Security Manager进行基本身份验证,使用HTTP从另一个调用一个mule流。Mule 3.7调用本地服务时的HTTP基本安全过滤错误

https://docs.mulesoft.com/mule-user-guide/v/3.7/configuring-the-spring-security-manager

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

<mule-ss:security-manager> 
    <mule-ss:delegate-security-provider name="memory-dao" delegate-ref="authenticationManager" /> 
</mule-ss:security-manager> 

<http:listener-config name="httpLocalListener" host="${local.host}" port="${local.port}" 
    basePath="${local.path}" doc:name="HTTP Local Listener" connectionIdleTimeout="${local.timeout}"/> 

<http:request-config name="httpLocalRequest" doc:name="HTTP Local Configuration" responseTimeout="${local.timeout}" 
    basePath="${local.path}" host="${local.host}" port="${local.port}"> 
    <http:basic-authentication username="${security.user.id}" password="${security.user.password}"/> 
</http:request-config> 

<flow name="ServiceFlow1" processingStrategy="synchronous"> 
    <http:listener config-ref="httpLocalListener" path="/status/*" doc:name="HTTP" allowedMethods="GET"/> 
    <http:basic-security-filter realm="${security.filter.realm}"/> 
    <!-- Omitted code --> 
    <http:request config-ref="httpLocalRequest" path="/ping/txt?siteId=#[sessionVars['siteId']]" method="GET" doc:name="HTTP" parseResponse="false"> 
     <http:success-status-code-validator values="0..599"/> 
    </http:request> 
</flow> 

<flow name="ServiceFlow2" processingStrategy="synchronous"> 
    <http:listener config-ref="httpLocalListener" path="/ping/txt" doc:name="HTTP" allowedMethods="GET"/> 
    <http:basic-security-filter realm="${security.filter.realm}"/> 
    <!-- Omitted code --> 
</flow> 

我碰到下面的错误(我从由于StackOverflow的要求HTTP链接去掉“//”):我根据在文档使用骡子3.7和配置好了一切

ERROR 2016年8月19日10:28:09539 [[服务] .httpLocalListener.worker.02] org.mule.exception.DefaultMessagingExceptionStrategy:


消息:已将注册身份验证设置为org.mule.transport.http.filters.HttpBasicAuthenticationFilter,但会话中没有安全上下文。身份验证在端点http:0.0.0.0:8081/services/ping/txt上被拒绝。消息有效负载类型为:NullPayload 类型:org.mule.api.security.UnauthorisedException 代码:MULE_ERROR - 2 JavaDoc:http:www.mulesoft.org/docs/site/current3/apidocs/org/mule/api /security/UnauthorisedException.html 有效载荷:{NullPayload}


异常堆栈是: 1.注册认证设置为org.mule.transport.http.filters.HttpBasicAuthenticationFilter但没有安全上下文对会话。身份验证在端点http:0.0.0.0:8081/services/ping/txt上被拒绝。消息有效负载的类型为:NullPayload(org.mule.api.security.UnauthorisedException) org.mule.transport.http.filters.HttpBasicAuthenticationFilter:156(http:www.mulesoft.org/docs/site/current3/apidocs/org /mule/api/security/UnauthorisedException.html)


任何帮助将不胜感激! 谢谢, 丹尼斯

+0

我使用SoapUI将用户/密码传递给第一个流程,这很好。这是内部调用第二个流程记录异常,但它仍然按预期工作。 –

回答

0

我有同样的此类问题的一次,但这个问题消失了,当我从邮递员调用同一个网址,让我们与基本身份验证凭据一起打服务。这同样不适用于普通的基于浏览器的测试,因为当你调用服务时,它需要基本认证的凭证,然后在下一个实例中给出相同的弹出窗口。

HTTPs basic auth using Postman Client

我不知道这是否有助于或没有,因为我的解释是有点稚嫩,但可以帮助你得到落实更好的主意。唯一我能说的是,它会抛出一个错误,但会按需要工作。

+0

看到上面的评论 –

相关问题