@ -22,14 +22,11 @@ import java.util.List;
import java.util.Set ;
import javax.annotation.PostConstruct ;
import javax.servlet.http.HttpServletRequest ;
import javax.servlet.http.HttpServletResponse ;
import org.springframework.beans.factory.annotation.Autowired ;
import org.springframework.boot.actuate.endpoint.Endpoint ;
import org.springframework.boot.actuate.endpoint.mvc.EndpointHandlerMapping ;
import org.springframework.boot.actuate.endpoint.mvc.MvcEndpoint ;
import org.springframework.boot.actuate.web.ErrorController ;
import org.springframework.boot.autoconfigure.AutoConfigureAfter ;
import org.springframework.boot.autoconfigure.AutoConfigureBefore ;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration ;
@ -43,12 +40,12 @@ import org.springframework.boot.autoconfigure.security.SecurityAutoConfiguration
import org.springframework.boot.autoconfigure.security.SecurityPrequisite ;
import org.springframework.boot.autoconfigure.security.SecurityProperties ;
import org.springframework.boot.autoconfigure.security.SpringBootWebSecurityConfiguration ;
import org.springframework.boot.autoconfigure.web.ErrorController ;
import org.springframework.boot.context.properties.EnableConfigurationProperties ;
import org.springframework.context.annotation.Bean ;
import org.springframework.context.annotation.Configuration ;
import org.springframework.core.Ordered ;
import org.springframework.core.annotation.Order ;
import org.springframework.security.access.AccessDeniedException ;
import org.springframework.security.config.annotation.web.WebSecurityConfigurer ;
import org.springframework.security.config.annotation.web.builders.HttpSecurity ;
import org.springframework.security.config.annotation.web.builders.WebSecurity ;
@ -56,12 +53,9 @@ import org.springframework.security.config.annotation.web.builders.WebSecurity.I
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity ;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration ;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter ;
import org.springframework.security.core.AuthenticationException ;
import org.springframework.security.web.AuthenticationEntryPoint ;
import org.springframework.security.web.authentication.www.BasicAuthenticationEntryPoint ;
import org.springframework.util.StringUtils ;
import org.springframework.web.bind.annotation.ControllerAdvice ;
import org.springframework.web.bind.annotation.ExceptionHandler ;
/ * *
* { @link EnableAutoConfiguration Auto - configuration } for security of framework endpoints .
@ -91,19 +85,6 @@ public class ManagementSecurityAutoConfiguration {
return new IgnoredPathsWebSecurityConfigurerAdapter ( ) ;
}
@ConditionalOnWebApplication
@ControllerAdvice
@Order ( Ordered . HIGHEST_PRECEDENCE + 10 )
protected static class SecurityExceptionRethrowingAdvice {
@ExceptionHandler ( { AccessDeniedException . class , AuthenticationException . class } )
public void handle ( HttpServletRequest request , HttpServletResponse response ,
Exception e ) throws Exception {
throw e ;
}
}
@Configuration
protected static class ManagementSecurityPropertiesConfiguration implements
SecurityPrequisite {