diff --git a/spring-security-basic-auth/src/main/java/org/baeldung/security/filter/CustomFilter.java b/spring-security-basic-auth/src/main/java/org/baeldung/security/filter/CustomFilter.java
new file mode 100644
index 0000000000..8d2b919cb0
--- /dev/null
+++ b/spring-security-basic-auth/src/main/java/org/baeldung/security/filter/CustomFilter.java
@@ -0,0 +1,18 @@
+package org.baeldung.security.filter;
+
+import org.springframework.web.filter.GenericFilterBean;
+
+import javax.servlet.FilterChain;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import java.io.IOException;
+
+public class CustomFilter extends GenericFilterBean {
+
+ @Override
+ public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
+ chain.doFilter(request, response);
+ }
+
+}
diff --git a/spring-security-basic-auth/src/main/java/org/baeldung/security/filter/configuration/CustomWebSecurityConfigurerAdapter.java b/spring-security-basic-auth/src/main/java/org/baeldung/security/filter/configuration/CustomWebSecurityConfigurerAdapter.java
new file mode 100644
index 0000000000..468c99cb2a
--- /dev/null
+++ b/spring-security-basic-auth/src/main/java/org/baeldung/security/filter/configuration/CustomWebSecurityConfigurerAdapter.java
@@ -0,0 +1,17 @@
+package org.baeldung.security.filter.configuration;
+
+import org.baeldung.security.filter.CustomFilter;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.security.config.annotation.web.builders.HttpSecurity;
+import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
+import org.springframework.security.web.authentication.www.BasicAuthenticationFilter;
+
+@Configuration
+public class CustomWebSecurityConfigurerAdapter extends WebSecurityConfigurerAdapter {
+
+ @Override
+ protected void configure(HttpSecurity http) throws Exception {
+ http.addFilterAfter(new CustomFilter(), BasicAuthenticationFilter.class);
+ }
+
+}
diff --git a/spring-security-basic-auth/src/main/resources/webSecurityConfig.xml b/spring-security-basic-auth/src/main/resources/webSecurityConfig.xml
index 48302e8e93..f840d3014e 100644
--- a/spring-security-basic-auth/src/main/resources/webSecurityConfig.xml
+++ b/spring-security-basic-auth/src/main/resources/webSecurityConfig.xml
@@ -12,6 +12,7 @@
+
@@ -22,4 +23,6 @@
+
+
\ No newline at end of file