@@ -0,0 +1,3277 @@
+package com.telefonica.euro_iaas.sdc.puppetwrapper.auth;%0A%0Aimport static org.mockito.Matchers.any;%0Aimport static org.mockito.Matchers.anyString;%0Aimport static org.mockito.Mockito.mock;%0Aimport static org.mockito.Mockito.when;%0A%0Aimport java.io.IOException;%0A%0Aimport javax.servlet.FilterChain;%0Aimport javax.servlet.ServletException;%0Aimport javax.servlet.http.HttpServletRequest;%0Aimport javax.servlet.http.HttpServletResponse;%0Aimport javax.servlet.http.HttpSession;%0A%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0Aimport org.springframework.security.authentication.AuthenticationManager;%0Aimport org.springframework.security.core.Authentication;%0Aimport org.springframework.security.web.AuthenticationEntryPoint;%0A%0Apublic class OpenStackAuthenticationFilterTest %7B%0A%0A    private OpenStackAuthenticationFilter openStackAuthenticationFilter;%0A%0A    private AuthenticationManager authenticationManager;%0A    private AuthenticationEntryPoint authenticationEntryPoint;%0A%0A    @Before%0A    public void setup() %7B%0A        authenticationManager = mock(AuthenticationManager.class);%0A        authenticationEntryPoint = mock(AuthenticationEntryPoint.class);%0A%0A        openStackAuthenticationFilter = new OpenStackAuthenticationFilter();%0A        openStackAuthenticationFilter.setAuthenticationManager(authenticationManager);%0A        openStackAuthenticationFilter.setAuthenticationEntryPoint(authenticationEntryPoint);%0A    %7D%0A%0A    @Test%0A    public void doFilterTestRootPath() throws IOException, ServletException %7B%0A        HttpServletRequest servletRequest = mock(HttpServletRequest.class);%0A        HttpServletResponse servletResponse = mock(HttpServletResponse.class);%0A        FilterChain filterChain = mock(FilterChain.class);%0A        HttpSession httpSession = mock(HttpSession.class);%0A%0A        when(servletRequest.getHeader(anyString())).thenReturn(%223df25213cac246f8bccad5c70cb3582e%22);%0A        when(servletRequest.getPathInfo()).thenReturn(%22/%22);%0A        when(servletRequest.getSession()).thenReturn(httpSession);%0A        when(httpSession.getId()).thenReturn(%221234%22);%0A%0A        openStackAuthenticationFilter.doFilter(servletRequest, servletResponse, filterChain);%0A    %7D%0A%0A    @Test%0A    public void doFilterTestAnyPath() throws IOException, ServletException %7B%0A        HttpServletRequest servletRequest = mock(HttpServletRequest.class);%0A        HttpServletResponse servletResponse = mock(HttpServletResponse.class);%0A        FilterChain filterChain = mock(FilterChain.class);%0A        HttpSession httpSession = mock(HttpSession.class);%0A        Authentication authResult = mock(Authentication.class);%0A        PaasManagerUser paasUser=mock(PaasManagerUser.class);%0A        %0A%0A        when(servletRequest.getHeader(anyString())).thenReturn(%223df25213cac246f8bccad5c70cb3582e%22)%0A                .thenReturn(%2200000000000000000000000000000194%22).thenReturn(%221234%22);%0A        when(servletRequest.getPathInfo()).thenReturn(%22/path%22);%0A        when(servletRequest.getSession()).thenReturn(httpSession);%0A        when(httpSession.getId()).thenReturn(%221234%22);%0A        when(authenticationManager.authenticate(any(Authentication.class))).thenReturn(authResult);%0A        %0A        when(authResult.getPrincipal()).thenReturn(paasUser);%0A%0A        openStackAuthenticationFilter.doFilter(servletRequest, servletResponse, filterChain);%0A    %7D%0A%7D%0A

add auth unit test