diff --git a/pom.xml b/pom.xml index 76465a5..cf7ce67 100644 --- a/pom.xml +++ b/pom.xml @@ -19,7 +19,7 @@ org.springframework.boot spring-boot-starter-parent - 1.5.6.RELEASE + 2.2.2.RELEASE @@ -66,25 +66,25 @@ io.springfox springfox-swagger2 - 2.7.0 + 2.9.2 io.springfox springfox-swagger-ui - 2.7.0 + 2.9.2 io.jsonwebtoken jjwt - 0.7.0 + 0.9.1 org.modelmapper modelmapper - 1.1.0 + 2.3.5 diff --git a/src/main/java/murraco/exception/GlobalExceptionHandlerController.java b/src/main/java/murraco/exception/GlobalExceptionHandlerController.java index 0fc25fd..f958eda 100644 --- a/src/main/java/murraco/exception/GlobalExceptionHandlerController.java +++ b/src/main/java/murraco/exception/GlobalExceptionHandlerController.java @@ -5,14 +5,14 @@ import javax.servlet.http.HttpServletResponse; -import org.springframework.boot.autoconfigure.web.DefaultErrorAttributes; -import org.springframework.boot.autoconfigure.web.ErrorAttributes; +import org.springframework.boot.web.servlet.error.DefaultErrorAttributes; +import org.springframework.boot.web.servlet.error.ErrorAttributes; import org.springframework.context.annotation.Bean; import org.springframework.http.HttpStatus; import org.springframework.security.access.AccessDeniedException; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.RestControllerAdvice; -import org.springframework.web.context.request.RequestAttributes; +import org.springframework.web.context.request.WebRequest; @RestControllerAdvice public class GlobalExceptionHandlerController { @@ -22,8 +22,8 @@ public ErrorAttributes errorAttributes() { // Hide exception field in the return object return new DefaultErrorAttributes() { @Override - public Map getErrorAttributes(RequestAttributes requestAttributes, boolean includeStackTrace) { - Map errorAttributes = super.getErrorAttributes(requestAttributes, includeStackTrace); + public Map getErrorAttributes(WebRequest webRequest, boolean includeStackTrace) { + Map errorAttributes = super.getErrorAttributes(webRequest, includeStackTrace); errorAttributes.remove("exception"); return errorAttributes; } diff --git a/src/main/java/murraco/security/WebSecurityConfig.java b/src/main/java/murraco/security/WebSecurityConfig.java index 3324d57..ce52669 100644 --- a/src/main/java/murraco/security/WebSecurityConfig.java +++ b/src/main/java/murraco/security/WebSecurityConfig.java @@ -3,6 +3,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.builders.WebSecurity; @@ -68,4 +69,10 @@ public PasswordEncoder passwordEncoder() { return new BCryptPasswordEncoder(12); } + @Override + @Bean + public AuthenticationManager authenticationManagerBean() throws Exception { + return super.authenticationManagerBean(); + } + }