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

标签 java spring-security mule mule-studio

例如,在 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中可以使用Spring security添加安全性,因为它支持基本身份验证
    对于您的上述要求,您需要在 Mule 中实现 Spring security
    Mule 可以使用Spring security进行配置,以提供带有用户名密码的基本身份验证。

  2. 每当您访问该服务时,它都会要求输入该服务的用户名密码
    因此,这回答了您在流程开始时实现安全性的问题。

一个简单的例子是:-

<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 Security 还可以配置为提供基于角色的支持,其中多个用户涉及 <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

关于java - 是否可以在 Mule Flow 中添加安全 url,例如 Spring Security?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31965582/

相关文章:

java - 西蒙说按下按钮后按钮颜色不会恢复正常

java - 展平静态成员类中的 JUnit 测试

java - 防止主 UI 从子线程崩溃

tomcat - nginx 代理添加 servlet 路径

java - 部署在 Linux-Server 上时 Spring Security 崩溃

java - 在 mule 中将线性 json 转换为嵌套 json

java - 获取属性中的 session 变量

java - 从结果集中选择(单击而不是 SQL Select)特定结果

java - 无法导入 springframework.security.extensions 并找到 saml() 方法

file - 无法在 mule 中创建动态文件入站端点