[英]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.