List of usage examples for org.springframework.security.web AuthenticationEntryPoint commence
void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) throws IOException, ServletException;
From source file:es.osoco.grails.plugins.otp.web.TwoFactorExceptionTranslationFilter.java
@Override protected void sendStartAuthentication(HttpServletRequest request, HttpServletResponse response, FilterChain chain, AuthenticationException reason) throws ServletException, IOException { // SEC-112: Clear the SecurityContextHolder's Authentication, as the // existing Authentication is no longer considered valid SecurityContextHolder.getContext().setAuthentication(null); requestCache.saveRequest(request, response); AuthenticationEntryPoint entryPoint = entryPointByReason(reason); if (logger.isDebugEnabled()) { logger.debug("Commence authentication using [" + entryPoint.getClass().getName() + " authentication entry point"); }//from ww w. j a va 2 s. com entryPoint.commence(request, response, reason); }
From source file:org.springframework.security.web.authentication.DelegatingAuthenticationEntryPoint.java
public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) throws IOException, ServletException { for (RequestMatcher requestMatcher : entryPoints.keySet()) { if (logger.isDebugEnabled()) { logger.debug("Trying to match using " + requestMatcher); }/*from www. j av a 2 s . c o m*/ if (requestMatcher.matches(request)) { AuthenticationEntryPoint entryPoint = entryPoints.get(requestMatcher); if (logger.isDebugEnabled()) { logger.debug("Match found! Executing " + entryPoint); } entryPoint.commence(request, response, authException); return; } } if (logger.isDebugEnabled()) { logger.debug("No match found. Using default entry point " + defaultEntryPoint); } // No EntryPoint matched, use defaultEntryPoint defaultEntryPoint.commence(request, response, authException); }