@Test public void doFilter() throws Exception { }
@Override public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest; if (shouldApply(httpServletRequest)) { if (auditLogger.isEnabled() && (AuthorizationHelper.getAuthenticatedName() == null)) { AuditEvent loginFailedAuditEvent = LoginAuditEvent.builder() .withRemoteIp(RequestUtils.getRemoteAddress(httpServletRequest)) .withTimestamp(System.currentTimeMillis()) .withReasonOfFailure("Authentication required") .withUserName(null) .build(); auditLogger.log(loginFailedAuditEvent); } super.doFilter(servletRequest, servletResponse, filterChain); } else { filterChain.doFilter(servletRequest, servletResponse); } }
AmbariKerberosAuthenticationFilter extends SpnegoAuthenticationProcessingFilter implements AmbariAuthenticationFilter { @Override public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest; if (shouldApply(httpServletRequest)) { if (auditLogger.isEnabled() && (AuthorizationHelper.getAuthenticatedName() == null)) { AuditEvent loginFailedAuditEvent = LoginAuditEvent.builder() .withRemoteIp(RequestUtils.getRemoteAddress(httpServletRequest)) .withTimestamp(System.currentTimeMillis()) .withReasonOfFailure("Authentication required") .withUserName(null) .build(); auditLogger.log(loginFailedAuditEvent); } super.doFilter(servletRequest, servletResponse, filterChain); } else { filterChain.doFilter(servletRequest, servletResponse); } } }
AmbariKerberosAuthenticationFilter extends SpnegoAuthenticationProcessingFilter implements AmbariAuthenticationFilter { @Override public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest; if (shouldApply(httpServletRequest)) { if (auditLogger.isEnabled() && (AuthorizationHelper.getAuthenticatedName() == null)) { AuditEvent loginFailedAuditEvent = LoginAuditEvent.builder() .withRemoteIp(RequestUtils.getRemoteAddress(httpServletRequest)) .withTimestamp(System.currentTimeMillis()) .withReasonOfFailure("Authentication required") .withUserName(null) .build(); auditLogger.log(loginFailedAuditEvent); } super.doFilter(servletRequest, servletResponse, filterChain); } else { filterChain.doFilter(servletRequest, servletResponse); } } AmbariKerberosAuthenticationFilter(AuthenticationManager authenticationManager, final AuthenticationEntryPoint entryPoint, Configuration configuration, final AuditLogger auditLogger, final PermissionHelper permissionHelper); }
AmbariKerberosAuthenticationFilter extends SpnegoAuthenticationProcessingFilter implements AmbariAuthenticationFilter { @Override public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest; if (shouldApply(httpServletRequest)) { if (auditLogger.isEnabled() && (AuthorizationHelper.getAuthenticatedName() == null)) { AuditEvent loginFailedAuditEvent = LoginAuditEvent.builder() .withRemoteIp(RequestUtils.getRemoteAddress(httpServletRequest)) .withTimestamp(System.currentTimeMillis()) .withReasonOfFailure("Authentication required") .withUserName(null) .build(); auditLogger.log(loginFailedAuditEvent); } super.doFilter(servletRequest, servletResponse, filterChain); } else { filterChain.doFilter(servletRequest, servletResponse); } } 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 void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest; if (shouldApply(httpServletRequest)) { if (auditLogger.isEnabled() && (AuthorizationHelper.getAuthenticatedName() == null)) { AuditEvent loginFailedAuditEvent = LoginAuditEvent.builder() .withRemoteIp(RequestUtils.getRemoteAddress(httpServletRequest)) .withTimestamp(System.currentTimeMillis()) .withReasonOfFailure("Authentication required") .withUserName(null) .build(); auditLogger.log(loginFailedAuditEvent); } super.doFilter(servletRequest, servletResponse, filterChain); } else { filterChain.doFilter(servletRequest, servletResponse); } } 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);  }