简体   繁体   English

Mule Http侦听器的自定义身份验证筛选器

[英]Custom Authentication Filter for Mule Http Listener

I would like to implement a Security Filter in Mule 3 extending OncePerRequestFilter from Spring Security. 我想在Mule 3中实现一个安全过滤器,从Spring Security扩展了OncePerRequestFilter。 But I am unable to make it work because the code for authentication hadn't been reach. 但是我无法使其工作,因为尚未到达身份验证代码。

Here is the code for registering the filter on mule xml. 这是用于在mule xml上注册过滤器的代码。

 <spring:bean id="requestContextFilter" class="com.sample.authentication.BeforeBasicAuthFilter"/>

      <ss:http entry-point-ref="restAuthenticationEntryPoint"> 
        <ss:custom-filter ref="requestContextFilter" before="FIRST"/>
     </ss:http>


   public class BeforeBasicAuthFilter extends OncePerRequestFilter {

     private HttpServletRequest request;
     public HttpServletRequest getRequest() {
       return request;
    }
    public void setRequest(HttpServletRequest request) {
      this.request = request;
    }

   @Override
    protected void doFilterInternal(HttpServletRequest request, 
    HttpServletResponse response, FilterChain filterChain)
        throws ServletException, IOException {
    this.request = request;
    System.out.println("XXXX ");
    filterChain.doFilter(request, response);
   }

 }

I believe that that filter is not registered to be used by the http listener or authentication manager. 我相信该筛选器未注册供http侦听器或身份验证管理器使用。 Was there a way in Mule to register a filter to be used on a http Listener? Mule中有没有办法注册要在http侦听器上使用的过滤器? My goal is that I should be able to intercept the raw http request before the authentication will take place. 我的目标是我应该能够在身份验证发生之前拦截原始的HTTP请求。

Use before BASIC_AUTH_FILTER in the custom-filter . custom-filter中的BASIC_AUTH_FILTER之前使用。

 <ss:http entry-point-ref="restAuthenticationEntryPoint"> 
    <ss:custom-filter ref="requestContextFilter" before="BASIC_AUTH_FILTER"/>
 </ss:http>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 具有拦截URL的Mule HTTP基本身份验证 - Mule HTTP Basic Authentication with intercept url JWT自定义筛选器中的身份验证管理器 - Authentication Manager in JWT Custom Filter 带有自定义过滤器远程访问的spring security获得401 HTTP状态401-需要完全身份验证,但在使用localhost时不需要 - spring security with custom filter remote access gets 401 HTTP Status 401 - Full authentication is required, but not when using localhost 添加自定义过滤器在Spring Security认证过程 - Adding a custom filter to authentication process in Spring Security CORS 允许自定义身份验证过滤器 | Spring开机 - CORS allowed custom authentication filter | Spring boot Grails Spring安全身份验证提供程序和自定义过滤器 - Grails spring security authentication provider and custom filter Spring Security 3.0.3和自定义身份验证处理过滤器 - Spring Security 3.0.3 and custom authentication processing filter 具有自定义身份验证过滤器的WebSecurityConfigurerAdapter - 依赖性问题 - WebSecurityConfigurerAdapter with custom authentication filter - dependency issue 无法使用Spring自定义过滤器对用户进行身份验证 - Unable to authentication a user with spring custom filter Spring boot 自定义身份验证过滤器未应用 - Spring boot Custom authentication filter is not applied
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM