use of org.springframework.boot.actuate.autoconfigure.security.servlet.EndpointRequest in project cas by apereo.
the class CasWebSecurityConfigurerAdapter method configureEndpointAccessToDenyUndefined.
/**
* Configure endpoint access to deny undefined.
*
* @param http the http
* @param requests the requests
*/
protected void configureEndpointAccessToDenyUndefined(final HttpSecurity http, final ExpressionUrlAuthorizationConfigurer<HttpSecurity>.ExpressionInterceptUrlRegistry requests) {
val endpoints = casProperties.getMonitor().getEndpoints().getEndpoint().keySet();
val endpointDefaults = casProperties.getMonitor().getEndpoints().getDefaultEndpointProperties();
pathMappedEndpoints.getObject().forEach(endpoint -> {
val rootPath = endpoint.getRootPath();
if (endpoints.contains(rootPath)) {
LOGGER.trace("Endpoint security is defined for endpoint [{}]", rootPath);
} else {
val defaultAccessRules = endpointDefaults.getAccess();
LOGGER.trace("Endpoint security is NOT defined for endpoint [{}]. Using default security rules [{}]", rootPath, endpointDefaults);
val endpointRequest = EndpointRequest.to(rootPath).excludingLinks();
defaultAccessRules.forEach(Unchecked.consumer(access -> configureEndpointAccess(http, requests, access, endpointDefaults, endpointRequest)));
}
});
}
Aggregations