diff --git a/build.gradle b/build.gradle index dbed9f5..ff5c6cb 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,6 @@ buildscript { ext { - springBootVersion = '1.5.6.RELEASE' + springBootVersion = '2.0.2.RELEASE' } repositories { mavenCentral() @@ -14,6 +14,14 @@ apply plugin: 'java' apply plugin: 'eclipse' apply plugin: 'idea' apply plugin: 'org.springframework.boot' +apply plugin: 'io.spring.dependency-management' + +dependencyManagement { + imports { + mavenBom org.springframework.boot.gradle.plugin.SpringBootPlugin.BOM_COORDINATES + } + applyMavenExclusions = false +} version = '0.0.1-SNAPSHOT' sourceCompatibility = 1.8 @@ -33,17 +41,17 @@ dependencies { compile('org.springframework.boot:spring-boot-starter-data-jpa') compile('org.flywaydb:flyway-core') compile('org.springframework.boot:spring-boot-starter-hateoas') - compile('org.mybatis.spring.boot:mybatis-spring-boot-starter:1.3.0') + compile('org.mybatis.spring.boot:mybatis-spring-boot-starter:1.3.2') compile('org.springframework.boot:spring-boot-starter-web') - compile('io.jsonwebtoken:jjwt:0.7.0') + compile('io.jsonwebtoken:jjwt:0.9.0') compile('org.springframework.boot:spring-boot-starter-security') compile('joda-time:joda-time:2.9.9') compileOnly('org.projectlombok:lombok') runtime('com.h2database:h2') - testCompile 'io.rest-assured:rest-assured:3.0.2' - testCompile 'io.rest-assured:spring-mock-mvc:3.0.2' - testCompile 'org.springframework.security:spring-security-test:4.0.4.RELEASE' + testCompile 'io.rest-assured:rest-assured:3.1.0' + testCompile 'io.rest-assured:spring-mock-mvc:3.1.0' + testCompile 'org.springframework.security:spring-security-test' testCompile('org.springframework.boot:spring-boot-starter-test') testCompile('org.springframework.restdocs:spring-restdocs-mockmvc') - testCompile('org.mybatis.spring.boot:mybatis-spring-boot-starter-test:1.3.0') + testCompile('org.mybatis.spring.boot:mybatis-spring-boot-starter-test:1.3.2') } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 1a958be..91ca28c 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 8767f3b..e6a3091 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,5 @@ -#Mon Aug 07 11:04:20 CST 2017 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-4.7-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-3.5.1-all.zip diff --git a/gradlew b/gradlew index 543c9aa..4d1833a 100755 --- a/gradlew +++ b/gradlew @@ -33,11 +33,11 @@ DEFAULT_JVM_OPTS="" # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" -warn ( ) { +warn () { echo "$*" } -die ( ) { +die () { echo echo "$*" echo @@ -155,7 +155,7 @@ if $cygwin ; then fi # Escape application args -save ( ) { +save () { for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done echo " " } diff --git a/src/main/java/io/spring/api/security/CORSConfig.java b/src/main/java/io/spring/api/security/CORSConfig.java index e4f5d61..2d30d41 100644 --- a/src/main/java/io/spring/api/security/CORSConfig.java +++ b/src/main/java/io/spring/api/security/CORSConfig.java @@ -2,10 +2,10 @@ package io.spring.api.security; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.CorsRegistry; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; @Configuration -public class CORSConfig extends WebMvcConfigurerAdapter { +public class CORSConfig implements WebMvcConfigurer { @Override public void addCorsMappings(CorsRegistry registry) { registry.addMapping("/**") diff --git a/src/main/java/io/spring/api/security/WebSecurityConfig.java b/src/main/java/io/spring/api/security/WebSecurityConfig.java index 336d190..02c599c 100644 --- a/src/main/java/io/spring/api/security/WebSecurityConfig.java +++ b/src/main/java/io/spring/api/security/WebSecurityConfig.java @@ -1,14 +1,15 @@ package io.spring.api.security; import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.autoconfigure.security.Http401AuthenticationEntryPoint; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.http.HttpMethod; +import org.springframework.http.HttpStatus; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.config.http.SessionCreationPolicy; +import org.springframework.security.web.authentication.HttpStatusEntryPoint; import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; import org.springframework.web.cors.CorsConfiguration; import org.springframework.web.cors.CorsConfigurationSource; @@ -40,7 +41,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter { http.csrf().disable() .cors() .and() - .exceptionHandling().authenticationEntryPoint(new Http401AuthenticationEntryPoint("Unauthenticated")) + .exceptionHandling().authenticationEntryPoint(new HttpStatusEntryPoint(HttpStatus.UNAUTHORIZED)) .and() .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and() .authorizeRequests()