Mule ESB:实现基于Basic和数据库的Spring Security身份验证

时间:2016-04-21 07:40:56

标签: spring authentication spring-security mule

我正在尝试使用Spring-Security框架在我的Mule应用程序中实现基于Basic和Database(jdbc-data-source)的身份验证。

以下是我的基本身份验证代码:

    <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="${basic.username}" password="${basic.password}" authorities="ROLE_ADMIN" />
            </ss:user-service>
        </ss:authentication-provider>
    </ss:authentication-manager>
</spring:beans>
<flow name="BasicAuthenticationFlow">
    <http:listener config-ref="HTTP_Listener" path="basicauth" doc:name="HTTP"/>
     <logger message="Request received ...!!!" level="INFO" doc:name="Request Logger"/>
    <mule-ss:http-security-filter realm="mule-realm"/>
    <set-payload value="You are logged in !!!!!!"/>

以下代码用于基于数据库的身份验证:

 <ss:authentication-manager  alias="authenticationManager">
        <ss:authentication-provider>
       <ss:jdbc-user-service data-source-ref="mssqlds" users-by-username-query="${db.users.by.username.query}"
              authorities-by-username-query="${db.authorities.by.username.query}" />
    </ss:authentication-provider>
  </ss:authentication-manager>
</spring:beans>
<mule-ss:security-manager>
      <mule-ss:delegate-security-provider name="jdbc-provider" delegate-ref="authenticationManager"/>
</mule-ss:security-manager>

当我运行应用程序时,基本身份验证工作正常,但基于Db的部分不起作用。为了确认相同,我评论了基本的auth部分并重新运行了应用程序。那么基于数据库的auth工作正常。我是否可以获得任何关于实现两种身份验证的输入而不会影响其他人的功能?

0 个答案:

没有答案