use of org.springframework.security.config.annotation.web.builders.WebSecurity in project promregator by promregator.
the class SecurityConfig method determineWebSecurityForEndpoint.
private WebSecurity determineWebSecurityForEndpoint(WebSecurity secInitial, String endpoint, InboundAuthorizationMode iam) throws Exception {
WebSecurity sec = secInitial;
if (iam == InboundAuthorizationMode.NONE) {
System.err.println(String.format("Endpoint %s is NOT authentication protected", endpoint));
sec = sec.ignoring().antMatchers(endpoint).and();
}
return sec;
}
use of org.springframework.security.config.annotation.web.builders.WebSecurity in project promregator by promregator.
the class SecurityConfig method configure.
// see also
// https://stackoverflow.com/questions/30366405/how-to-disable-spring-security-for-particular-url
@Override
public void configure(WebSecurity webInitial) throws Exception {
if (!this.isInboundAuthSecurityEnabled()) {
return;
}
WebSecurity web = webInitial;
web = this.determineWebSecurityForEndpoint(web, "/discovery", this.discoveryAuth);
web = this.determineWebSecurityForEndpoint(web, "/metrics", this.endpointAuth);
web = this.determineWebSecurityForEndpoint(web, "/singleTargetMetrics/**", this.endpointAuth);
web = this.determineWebSecurityForEndpoint(web, "/promregatorMetrics", this.promregatorMetricsAuth);
}
Aggregations