@Test public void testIsRequestFromAdminShouldReturnFalseWhenHostIsNotAdminAndSecurityIsEnabled() { given(httpServletRequest.getRemoteAddr()).willReturn("ip"); given(ipAddressResolver.resolveToHostName("ip")).willReturn("host"); given(wilmaAdminHostsDTO.isSecurityEnabled()).willReturn(true); given(allowedHosts.contains("host")).willReturn(false); boolean result = underTest.isRequestFromAdmin(httpServletRequest); assertFalse(result); }
public boolean isRequestFromAdmin(final ServletRequest request) { String host = ipAddressResolver.resolveToHostName(request.getRemoteAddr()); return !wilmaAdminHostsDTO.isSecurityEnabled() || allowedHosts.contains(host); }
HostValidatorService implements ApplicationListener<ContextRefreshedEvent> { public boolean isRequestFromAdmin(final ServletRequest request) { String host = ipAddressResolver.resolveToHostName(request.getRemoteAddr()); return !wilmaAdminHostsDTO.isSecurityEnabled() || allowedHosts.contains(host); } }
HostValidatorService implements ApplicationListener<ContextRefreshedEvent> { public boolean isRequestFromAdmin(final ServletRequest request) { String host = ipAddressResolver.resolveToHostName(request.getRemoteAddr()); return !wilmaAdminHostsDTO.isSecurityEnabled() || allowedHosts.contains(host); }  }
HostValidatorService implements ApplicationListener<ContextRefreshedEvent> { public boolean isRequestFromAdmin(final ServletRequest request) { String host = ipAddressResolver.resolveToHostName(request.getRemoteAddr()); return !wilmaAdminHostsDTO.isSecurityEnabled() || allowedHosts.contains(host); }  boolean isRequestFromAdmin(final ServletRequest request); @Override void onApplicationEvent(final ContextRefreshedEvent event); }
HostValidatorService implements ApplicationListener<ContextRefreshedEvent> { public boolean isRequestFromAdmin(final ServletRequest request) { String host = ipAddressResolver.resolveToHostName(request.getRemoteAddr()); return !wilmaAdminHostsDTO.isSecurityEnabled() || allowedHosts.contains(host); }  boolean isRequestFromAdmin(final ServletRequest request); @Override void onApplicationEvent(final ContextRefreshedEvent event);  }