@Test public void shouldApplyNotFalseEnabled() throws Exception { HttpServletRequest httpServletRequest = createMock(HttpServletRequest.class); AmbariKerberosAuthenticationProperties properties = createMock(AmbariKerberosAuthenticationProperties.class); expect(properties.isKerberosAuthenticationEnabled()).andReturn(false).once(); Configuration configuration = createMock(Configuration.class); expect(configuration.getKerberosAuthenticationProperties()).andReturn(properties).once(); AuthenticationManager authenticationManager = createMock(AuthenticationManager.class); AuthenticationEntryPoint entryPoint = createMock(AuthenticationEntryPoint.class); AuditLogger auditLogger = createMock(AuditLogger.class); PermissionHelper permissionHelper = createMock(PermissionHelper.class); replayAll(); AmbariKerberosAuthenticationFilter filter = new AmbariKerberosAuthenticationFilter( authenticationManager, entryPoint, configuration, auditLogger, permissionHelper ); Assert.assertFalse(filter.shouldApply(httpServletRequest)); verifyAll(); }
@Override public boolean shouldApply(HttpServletRequest httpServletRequest) { if (kerberosAuthenticationEnabled) { String header = httpServletRequest.getHeader("Authorization"); return (header != null) && (header.startsWith("Negotiate ") || header.startsWith("Kerberos ")); } else { return false; } }
AmbariKerberosAuthenticationFilter extends SpnegoAuthenticationProcessingFilter implements AmbariAuthenticationFilter { @Override public boolean shouldApply(HttpServletRequest httpServletRequest) { if (kerberosAuthenticationEnabled) { String header = httpServletRequest.getHeader("Authorization"); return (header != null) && (header.startsWith("Negotiate ") || header.startsWith("Kerberos ")); } else { return false; } } }
AmbariKerberosAuthenticationFilter extends SpnegoAuthenticationProcessingFilter implements AmbariAuthenticationFilter { @Override public boolean shouldApply(HttpServletRequest httpServletRequest) { if (kerberosAuthenticationEnabled) { String header = httpServletRequest.getHeader("Authorization"); return (header != null) && (header.startsWith("Negotiate ") || header.startsWith("Kerberos ")); } else { return false; } } AmbariKerberosAuthenticationFilter(AuthenticationManager authenticationManager, final AuthenticationEntryPoint entryPoint, Configuration configuration, final AuditLogger auditLogger, final PermissionHelper permissionHelper); }
AmbariKerberosAuthenticationFilter extends SpnegoAuthenticationProcessingFilter implements AmbariAuthenticationFilter { @Override public boolean shouldApply(HttpServletRequest httpServletRequest) { if (kerberosAuthenticationEnabled) { String header = httpServletRequest.getHeader("Authorization"); return (header != null) && (header.startsWith("Negotiate ") || header.startsWith("Kerberos ")); } else { return false; } } AmbariKerberosAuthenticationFilter(AuthenticationManager authenticationManager, final AuthenticationEntryPoint entryPoint, Configuration configuration, final AuditLogger auditLogger, final PermissionHelper permissionHelper); @Override boolean shouldApply(HttpServletRequest httpServletRequest); @Override void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain); }
AmbariKerberosAuthenticationFilter extends SpnegoAuthenticationProcessingFilter implements AmbariAuthenticationFilter { @Override public boolean shouldApply(HttpServletRequest httpServletRequest) { if (kerberosAuthenticationEnabled) { String header = httpServletRequest.getHeader("Authorization"); return (header != null) && (header.startsWith("Negotiate ") || header.startsWith("Kerberos ")); } else { return false; } } AmbariKerberosAuthenticationFilter(AuthenticationManager authenticationManager, final AuthenticationEntryPoint entryPoint, Configuration configuration, final AuditLogger auditLogger, final PermissionHelper permissionHelper); @Override boolean shouldApply(HttpServletRequest httpServletRequest); @Override void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain);  }