@@ -0,0 +1,2049 @@
+/*%0A * Copyright 2017 Crown Copyright%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0A%0Apackage stroom.security.server;%0A%0Aimport org.apache.shiro.web.servlet.AbstractFilter;%0Aimport org.slf4j.Logger;%0Aimport org.slf4j.LoggerFactory;%0Aimport stroom.servlet.HttpServletRequestHolder;%0A%0Aimport javax.servlet.FilterChain;%0Aimport javax.servlet.ServletException;%0Aimport javax.servlet.ServletRequest;%0Aimport javax.servlet.ServletResponse;%0Aimport javax.servlet.http.HttpServletRequest;%0Aimport java.io.IOException;%0A%0Apublic class RequestCaptureFilter extends AbstractFilter %7B%0A    private static final Logger LOGGER = LoggerFactory.getLogger(RequestCaptureFilter.class);%0A%0A    private final HttpServletRequestHolder httpServletRequestHolder;%0A%0A    public RequestCaptureFilter(final HttpServletRequestHolder httpServletRequestHolder) %7B%0A        this.httpServletRequestHolder = httpServletRequestHolder;%0A    %7D%0A%0A    @Override%0A    public void doFilter(final ServletRequest request,%0A                         final ServletResponse response,%0A                         final FilterChain chain) throws IOException, ServletException %7B%0A%0A        if (request instanceof HttpServletRequest) %7B%0A            httpServletRequestHolder.set((HttpServletRequest) request);%0A        %7D%0A%0A        chain.doFilter(request, response);%0A%0A        if (request instanceof HttpServletRequest) %7B%0A            //clear the held request in case the thread holding the thread scoped holder is re-used%0A            //for something else%0A            httpServletRequestHolder.set(null);%0A        %7D%0A    %7D%0A%7D

Add RequestCaptureFilter to get the httpReq for getToken endpoint