@Override
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException {
HttpServletRequest request = (HttpServletRequest) req;
HttpServletResponse response = (HttpServletResponse) res;
AuthorizationRequest authorizationRequest = findAuthorizationRequest(request);
if (authorizationRequest == null) {
response
.sendError(HttpServletResponse.SC_BAD_REQUEST, "No valid AbstractAuthenticator.AUTH_STATE on the Request");
}
if (initialRequest(request)) {
storePrincipal(request, response, authorizationRequest);
request.setAttribute(AbstractAuthenticator.RETURN_URI, RETURN_URI);
request.setAttribute(AbstractUserConsentHandler.CLIENT, authorizationRequest.getClient());
if (!authorizationRequest.getClient().isSkipConsent()) {
userConsentHandler.doFilter(request, response, chain);
} else {
chain.doFilter(request, response);
}
} else {