File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
publish-service/src/main/java/com/ericsson/eiffel/remrem/publish/config Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change 1010import org .slf4j .LoggerFactory ;
1111import org .springframework .http .HttpStatus ;
1212import org .springframework .security .authentication .BadCredentialsException ;
13+ import org .springframework .security .authentication .InsufficientAuthenticationException ;
1314import org .springframework .security .authentication .InternalAuthenticationServiceException ;
1415import org .springframework .security .core .AuthenticationException ;
1516import org .springframework .security .web .AuthenticationEntryPoint ;
@@ -24,8 +25,11 @@ public class CustomAuthenticationEntryPoint implements AuthenticationEntryPoint
2425 @ Override
2526 public void commence (HttpServletRequest request , HttpServletResponse response ,
2627 AuthenticationException authException ) throws IOException , ServletException {
27- if (authException instanceof BadCredentialsException ) {
28+ if (authException instanceof BadCredentialsException ||
29+ authException instanceof InsufficientAuthenticationException ) {
2830 LOGGER .warn ("Bad Credentials {}" , HttpStatus .UNAUTHORIZED );
31+ // Ensure pop-up window is opened when request comes from a web browser.
32+ response .setHeader ("WWW-Authenticate" , "Basic" );
2933 response .sendError (HttpServletResponse .SC_UNAUTHORIZED , "Invalid credentials" );
3034 }
3135 else if (authException instanceof InternalAuthenticationServiceException ) {
You can’t perform that action at this time.
0 commit comments