@Bean FilterRegistrationBean<BasicAuthFilter> authFilter(EurekaProperties props) {
    FilterRegistrationBean<BasicAuthFilter> registrationBean = new FilterRegistrationBean<>();
    registrationBean.setFilter(new BasicAuthFilter(props.getUsername(), props.getPassword()));
    registrationBean.addUrlPatterns("/eureka/*"); // Auth /eureka, though only v2 is valid
    registrationBean.setOrder(2);
    return registrationBean;
  }
This enables security, particularly only BASIC auth, when {@code EUREKA_USERNAME} is set.
docker/test-images/zipkin-eureka/src/main/java/zipkin/test/EurekaSecurity.java