test_class.file: herd-code/herd-app/src/test/java/org/finra/herd/app/security/TrustedUserAuthenticationFilterTest.java
test_class.identifier: TrustedUserAuthenticationFilterTest
test_class.superclass: extends AbstractAppTest
test_case.body: @Test
      public void testTrustedUserFilterSwitchTrustedUser() throws Exception
      {
          // Override configuration.
          Map<String, Object> overrideMap = getDefaultSecurityEnvironmentVariables();
          overrideMap.put(ConfigurationValue.SECURITY_ENABLED_SPEL_EXPRESSION.getKey(), "false");
          modifyPropertySourceInEnvironment(overrideMap);
  
          // Create HttpHeader user in session.
          MockHttpServletRequest request =
              getRequestWithHeaders("testUser", "testFirstName", "testLastName", "testEmail", "testRole", "Wed, 11 Mar 2015 10:24:09");
          // Invalidate user session if exists.
          invalidateApplicationUser(request);
  
          httpHeaderAuthenticationFilter.init(new MockFilterConfig());
          httpHeaderAuthenticationFilter.doFilter(request, new MockHttpServletResponse(), new MockFilterChain());
  
          assertNoUserInContext();
  
          // Now apply the trusted user filter to ensure that user is switched to trusted user
  
          try
          {
              trustedUserAuthenticationFilter.init(new MockFilterConfig());
              trustedUserAuthenticationFilter.doFilter(new MockHttpServletRequest(), new MockHttpServletResponse(), new MockFilterChain());
              validateTrustedApplicationUser();
          }
          finally
          {
              // Restore the property sources so we don't affect other tests.
              restorePropertySourceInEnvironment();
          }
      }
test_case.class_method_signature: TrustedUserAuthenticationFilterTest.testTrustedUserFilterSwitchTrustedUser()
test_case.full_signature: @Test public void testTrustedUserFilterSwitchTrustedUser()
test_case.identifier: testTrustedUserFilterSwitchTrustedUser
test_case.invocations: getDefaultSecurityEnvironmentVariables put getKey modifyPropertySourceInEnvironment getRequestWithHeaders invalidateApplicationUser init doFilter assertNoUserInContext init doFilter validateTrustedApplicationUser restorePropertySourceInEnvironment
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testTrustedUserFilterSwitchTrustedUser()
focal_class.declarator: securityHelper
focal_class.modifier: @Autowired
      private
focal_class.original_string: @Autowired
      private SecurityHelper securityHelper;
focal_class.type: SecurityHelper
focal_class.var_name: securityHelper
focal_class.declarator: authenticationManager = null
focal_class.modifier: private
focal_class.original_string: private AuthenticationManager authenticationManager = null;
focal_class.type: AuthenticationManager
focal_class.var_name: authenticationManager
focal_class.declarator: applicationUserBuilder
focal_class.modifier: private
focal_class.original_string: private ApplicationUserBuilder applicationUserBuilder;
focal_class.type: ApplicationUserBuilder
focal_class.var_name: applicationUserBuilder
focal_class.declarator: authenticationDetailsSource = new WebAuthenticationDetailsSource()
focal_class.modifier: private
focal_class.original_string: private AuthenticationDetailsSource<HttpServletRequest, WebAuthenticationDetails> authenticationDetailsSource = new WebAuthenticationDetailsSource();
focal_class.type: AuthenticationDetailsSource<HttpServletRequest, WebAuthenticationDetails>
focal_class.var_name: authenticationDetailsSource
focal_class.file: herd-code/herd-app/src/main/java/org/finra/herd/app/security/TrustedUserAuthenticationFilter.java
focal_class.identifier: TrustedUserAuthenticationFilter
focal_class.class_method_signature: TrustedUserAuthenticationFilter.TrustedUserAuthenticationFilter(AuthenticationManager authenticationManager, ApplicationUserBuilder applicationUserBuilder)
focal_class.full_signature: public  TrustedUserAuthenticationFilter(AuthenticationManager authenticationManager, ApplicationUserBuilder applicationUserBuilder)
focal_class.identifier: TrustedUserAuthenticationFilter
focal_class.modifiers: public
focal_class.parameters: (AuthenticationManager authenticationManager, ApplicationUserBuilder applicationUserBuilder)
focal_class.signature:  TrustedUserAuthenticationFilter(AuthenticationManager authenticationManager, ApplicationUserBuilder applicationUserBuilder)
focal_class.class_method_signature: TrustedUserAuthenticationFilter.doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain)
focal_class.full_signature: @Override @SuppressFBWarnings(value = "BC_UNCONFIRMED_CAST", justification = "The ServletRequest is cast to an HttpServletRequest which is always the case since all requests use the HTTP protocol.") public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain)
focal_class.identifier: doFilter
focal_class.modifiers: @Override @SuppressFBWarnings(value = "BC_UNCONFIRMED_CAST", justification = "The ServletRequest is cast to an HttpServletRequest which is always the case since all requests use the HTTP protocol.") public
focal_class.parameters: (ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain)
focal_class.return: void
focal_class.signature: void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain)
focal_class.class_method_signature: TrustedUserAuthenticationFilter.doHttpFilter(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
focal_class.full_signature: public void doHttpFilter(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
focal_class.identifier: doHttpFilter
focal_class.modifiers: public
focal_class.parameters: (HttpServletRequest request, HttpServletResponse response, FilterChain chain)
focal_class.return: void
focal_class.signature: void doHttpFilter(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
focal_class.superclass: extends GenericFilterBean
focal_method.body: @Override
      @SuppressFBWarnings(value = "BC_UNCONFIRMED_CAST",
          justification = "The ServletRequest is cast to an HttpServletRequest which is always the case since all requests use the HTTP protocol.")
      public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException
      {
          doHttpFilter((HttpServletRequest) servletRequest, (HttpServletResponse) servletResponse, filterChain);
      }
focal_method.class_method_signature: TrustedUserAuthenticationFilter.doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain)
focal_method.full_signature: @Override @SuppressFBWarnings(value = "BC_UNCONFIRMED_CAST", justification = "The ServletRequest is cast to an HttpServletRequest which is always the case since all requests use the HTTP protocol.") public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain)
focal_method.identifier: doFilter
focal_method.invocations: doHttpFilter
focal_method.modifiers: @Override @SuppressFBWarnings(value = "BC_UNCONFIRMED_CAST", justification = "The ServletRequest is cast to an HttpServletRequest which is always the case since all requests use the HTTP protocol.") public
focal_method.parameters: (ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain)
focal_method.return: void
focal_method.signature: void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain)