是否可以在 Mule Flow 中添加安全性 url,例如 Spring 安全性?

Is it possible to add a security url in a Mule Flow, like Spring Security?

例如,在Spring中我使用了下面的代码:

<http pattern="/users(?!\/emails).*" request-matcher="regex" create-session="stateless" entry-point-ref="authenticationEntryPoint" use-expressions="true"
    xmlns="http://www.springframework.org/schema/security">

    <anonymous enabled="false" />

    <intercept-url method="GET" pattern="/user(?:([^/](?s).*)?)" />

所以,在 Mule 上,我想在流程的开头添加安全性,或者(如果可能的话)配置 标签。

如果可能的话,我可以在社区版上这样做吗?

分点回答你的问题:-

  1. 是的,可以在 Mule Community Edition 中使用 [= 添加 security 64=] 安全性 因为它支持 基本身份验证
    对于您的上述要求,您需要在 Mule
    中实施 Spring security Mule 可以配置 Spring security 以提供 usernamepassword 的基本身份验证。

  2. 无论何时您点击该服务,它都会要求该服务的 用户名密码
    因此,这回答了您在流程的 beginning 实施安全性的问题。

一个简单的例子是:-

<spring:beans>
    <ss:authentication-manager alias="authenticationManager">
      <ss:authentication-provider>
        <ss:user-service id="userService">
          <ss:user name="john" password="abc123" authorities="ROLE_ADMIN" />
          <ss:user name="anon" password="anon" authorities="ROLE_ANON" />
        </ss:user-service>
      </ss:authentication-provider>
    </ss:authentication-manager> 
  </spring:beans>

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

  <http:listener-config name="HTTP_Listener_Configuration" host="localhost" port="8081" doc:name="HTTP Listener Configuration" />

  <flow name="SpringExampleFlow">
    <http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="HTTP"/>
    <http:basic-security-filter realm="mule-realm"/>      
    <logger level="INFO" message="passed security successfully !!! " doc:name="Logger"/>
  </flow>
</mule>

spring 安全性也可以配置为提供基于 角色 的支持,其中多个用户涉及 <mule-ss:authorization-filter/>
因此,您可以根据 角色 过滤用户。

您可以在此处参考一些示例以获得更多关于它及其实现的想法:- http://confluex.com/blog/http-inbound-endpoint-basic-authentication/

https://developer.mulesoft.com/docs/display/current/Configuring+the+Spring+Security+Manager