class ConvertAuthTokenInUriToCookieFilter extends ZuulFilter {

    public Object run() {
        RequestContext context = RequestContext.getCurrentContext();
        AuthConfigurationProperties.CookieProperties cp = authConfigurationProperties.getCookieProperties();
        if ((context.getRequestQueryParams() != null) && context.getRequestQueryParams().containsKey(cp.getCookieName())) {
            HttpServletResponse servletResponse = context.getResponse();
            Cookie cookie = new Cookie(cp.getCookieName(), context.getRequestQueryParams().get(cp.getCookieName()).get(0));
            cookie.setPath(cp.getCookiePath());
            cookie.setSecure(true);
            cookie.setHttpOnly(true);
            cookie.setMaxAge(cp.getCookieMaxAge());
            cookie.setComment(cp.getCookieComment());
            servletResponse.addCookie(cookie);

            String url = context.getRequest().getRequestURL().toString();
            String newUrl;
            if (url.endsWith("/apicatalog/")) {
                newUrl = url + "#/dashboard";
            } else {
                newUrl = url;
            }
            context.addZuulResponseHeader("Location", newUrl);
            context.setResponseStatusCode(HttpServletResponse.SC_MOVED_TEMPORARILY);
        }
        return null;
    }

    public  ConvertAuthTokenInUriToCookieFilter(AuthConfigurationProperties authConfigurationProperties);

}