Hi,
I am developing a REST API and using spring security but every time the authentication fails I get a "Spring Security Application" popup. How do to prevent this from coming ?
applicationContext.xml:
Code:<sec:http auto-config="false" create-session="never" entry-point-ref="restAuthenticationEntryPoint"> <sec:http-basic/> <sec:intercept-url pattern="/**" access="ROLE_USER"/> </sec:http> <bean id="authenticationProvider" class="com.jani.rest.CustomAuthenticationProvider"/> <sec:authentication-manager> <sec:authentication-provider ref="authenticationProvider"/> </sec:authentication-manager>
in the CustomAuthenticationProvider I just check the username and password and in the restAuthenticationEntryPoint i send and Unauthorized error if authentication fails
I appreciate any advice, I would like to always throw the authorized error when authentication fails, in my case it does not work using popups since I am developing an APICode:@Override public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) throws IOException{ response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "Unauthorized"); }
Thanks,
JaniR


Reply With Quote
