@Test public void shouldMapAuthAttributesToCRESTAttributesWithNulls() throws IOException, ServletException { HttpServletRequest request = mock(HttpServletRequest.class); HttpServletResponse response = mock(HttpServletResponse.class); FilterChain filterChain = mock(FilterChain.class); given(request.getHeader(AMAuthNFilter.ATTRIBUTE_AUTH_PRINCIPAL)).willReturn(null); given(request.getAttribute(AMAuthNFilter.ATTRIBUTE_AUTH_CONTEXT)).willReturn(null); restSecurityContextMapper.doFilter(request, response, filterChain); verify(request).setAttribute(SecurityContextFactory.ATTRIBUTE_AUTHCID, null); verify(request).setAttribute(SecurityContextFactory.ATTRIBUTE_AUTHZID, null); verify(filterChain).doFilter(request, response); }
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { HttpServletRequest request = (HttpServletRequest) servletRequest; String authcid = request.getHeader(AuthNFilter.ATTRIBUTE_AUTH_PRINCIPAL); Map<String, Object> authzid = (Map<String, Object>) request.getAttribute(AuthNFilter.ATTRIBUTE_AUTH_CONTEXT); request.setAttribute(SecurityContextFactory.ATTRIBUTE_AUTHCID, authcid); request.setAttribute(SecurityContextFactory.ATTRIBUTE_AUTHZID, authzid); filterChain.doFilter(request, servletResponse); }
RestSecurityContextMapper implements Filter { public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { HttpServletRequest request = (HttpServletRequest) servletRequest; String authcid = request.getHeader(AuthNFilter.ATTRIBUTE_AUTH_PRINCIPAL); Map<String, Object> authzid = (Map<String, Object>) request.getAttribute(AuthNFilter.ATTRIBUTE_AUTH_CONTEXT); request.setAttribute(SecurityContextFactory.ATTRIBUTE_AUTHCID, authcid); request.setAttribute(SecurityContextFactory.ATTRIBUTE_AUTHZID, authzid); filterChain.doFilter(request, servletResponse); } }
RestSecurityContextMapper implements Filter { public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { HttpServletRequest request = (HttpServletRequest) servletRequest; String authcid = request.getHeader(AuthNFilter.ATTRIBUTE_AUTH_PRINCIPAL); Map<String, Object> authzid = (Map<String, Object>) request.getAttribute(AuthNFilter.ATTRIBUTE_AUTH_CONTEXT); request.setAttribute(SecurityContextFactory.ATTRIBUTE_AUTHCID, authcid); request.setAttribute(SecurityContextFactory.ATTRIBUTE_AUTHZID, authzid); filterChain.doFilter(request, servletResponse); }  }
RestSecurityContextMapper implements Filter { public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { HttpServletRequest request = (HttpServletRequest) servletRequest; String authcid = request.getHeader(AuthNFilter.ATTRIBUTE_AUTH_PRINCIPAL); Map<String, Object> authzid = (Map<String, Object>) request.getAttribute(AuthNFilter.ATTRIBUTE_AUTH_CONTEXT); request.setAttribute(SecurityContextFactory.ATTRIBUTE_AUTHCID, authcid); request.setAttribute(SecurityContextFactory.ATTRIBUTE_AUTHZID, authzid); filterChain.doFilter(request, servletResponse); }  void init(FilterConfig filterConfig); void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain); void destroy(); }
RestSecurityContextMapper implements Filter { public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { HttpServletRequest request = (HttpServletRequest) servletRequest; String authcid = request.getHeader(AuthNFilter.ATTRIBUTE_AUTH_PRINCIPAL); Map<String, Object> authzid = (Map<String, Object>) request.getAttribute(AuthNFilter.ATTRIBUTE_AUTH_CONTEXT); request.setAttribute(SecurityContextFactory.ATTRIBUTE_AUTHCID, authcid); request.setAttribute(SecurityContextFactory.ATTRIBUTE_AUTHZID, authzid); filterChain.doFilter(request, servletResponse); }  void init(FilterConfig filterConfig); void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain); void destroy();  }