@@ -0,0 +1,1737 @@
+package com.elia.em.security;%0A%0Aimport org.springframework.core.Ordered;%0Aimport org.springframework.core.annotation.Order;%0Aimport org.springframework.stereotype.Component;%0A%0Aimport javax.servlet.*;%0Aimport javax.servlet.http.HttpServletRequest;%0Aimport javax.servlet.http.HttpServletResponse;%0Aimport java.io.IOException;%0A%0A@Component%0A@Order(Ordered.HIGHEST_PRECEDENCE)%0Apublic class MyCorsFilter implements Filter %7B%0A%0A    public MyCorsFilter () %7B%0A        super();%0A    %7D%0A%0A    @Override%0A    public final void doFilter(final ServletRequest req, final ServletResponse res, final FilterChain chain) throws IOException, ServletException %7B%0A        final HttpServletResponse response = (HttpServletResponse) res;%0A        response.setHeader(%22Access-Control-Allow-Origin%22, %22http://localhost:4200%22);%0A%0A        // without this header jquery.ajax calls returns 401 even after successful login and SSESSIONID being succesfully stored.%0A        response.setHeader(%22Access-Control-Allow-Credentials%22, %22true%22);%0A%0A        response.setHeader(%22Access-Control-Allow-Methods%22, %22POST, PUT, GET, OPTIONS, DELETE%22);%0A        response.setHeader(%22Access-Control-Max-Age%22, %223600%22);%0A        response.setHeader(%22Access-Control-Allow-Headers%22, %22X-Requested-With, Authorization, Origin, Content-Type, Version%22);%0A        response.setHeader(%22Access-Control-Expose-Headers%22, %22X-Requested-With, Authorization, Origin, Content-Type%22);%0A%0A        final HttpServletRequest request = (HttpServletRequest) req;%0A        if (request.getMethod() != %22OPTIONS%22) %7B%0A            chain.doFilter(req, res);%0A        %7D else %7B%0A            //%0A        %7D%0A    %7D%0A%0A    @Override%0A    public void destroy() %7B%0A%0A    %7D%0A%0A    @Override%0A    public void init(FilterConfig filterConfig) throws ServletException %7B%0A    %7D%0A%7D

add cors filter