diff --git a/pom.xml b/pom.xml index 7b20e42..e73970a 100644 --- a/pom.xml +++ b/pom.xml @@ -7,13 +7,13 @@ demo 0.0.1.SNAPSHOT - error + Demo Project Demo project org.springframework.boot spring-boot-starter-parent - 1.0.0.BUILD-SNAPSHOT + 1.1.3.RELEASE @@ -32,7 +32,7 @@ org.springframework.security.oauth spring-security-oauth2 - 2.0.0.BUILD-SNAPSHOT + 2.0.1.RELEASE jackson-mapper-asl diff --git a/src/main/java/demo/Application.java b/src/main/java/demo/Application.java index 4e715fd..441ab93 100644 --- a/src/main/java/demo/Application.java +++ b/src/main/java/demo/Application.java @@ -12,8 +12,8 @@ import org.springframework.security.oauth2.config.annotation.web.configuration.EnableAuthorizationServer; import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer; import org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter; -import org.springframework.security.oauth2.config.annotation.web.configurers.OAuth2AuthorizationServerConfigurer; -import org.springframework.security.oauth2.config.annotation.web.configurers.OAuth2ResourceServerConfigurer; +import org.springframework.security.oauth2.config.annotation.web.configurers.AuthorizationServerEndpointsConfigurer; +import org.springframework.security.oauth2.config.annotation.web.configurers.ResourceServerSecurityConfigurer; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -48,7 +48,7 @@ public void configure(HttpSecurity http) throws Exception { } @Override - public void configure(OAuth2ResourceServerConfigurer resources) throws Exception { + public void configure(ResourceServerSecurityConfigurer resources) throws Exception { resources.resourceId("sparklr"); } @@ -62,7 +62,7 @@ protected static class OAuth2Config extends AuthorizationServerConfigurerAdapter private AuthenticationManager authenticationManager; @Override - public void configure(OAuth2AuthorizationServerConfigurer oauthServer) throws Exception { + public void configure(AuthorizationServerEndpointsConfigurer oauthServer) throws Exception { oauthServer.authenticationManager(authenticationManager); } diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index af1bb9f..cf43904 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -4,4 +4,4 @@ security: user: password: password -debug: true \ No newline at end of file +debug: false \ No newline at end of file diff --git a/src/test/java/demo/AuthorizationCodeProviderTests.java b/src/test/java/demo/AuthorizationCodeProviderTests.java index 378326d..2db383d 100755 --- a/src/test/java/demo/AuthorizationCodeProviderTests.java +++ b/src/test/java/demo/AuthorizationCodeProviderTests.java @@ -47,8 +47,8 @@ import org.springframework.security.oauth2.common.OAuth2AccessToken; import org.springframework.security.oauth2.common.exceptions.RedirectMismatchException; import org.springframework.security.oauth2.common.util.OAuth2Utils; -import org.springframework.security.oauth2.provider.token.InMemoryTokenStore; import org.springframework.security.oauth2.provider.token.TokenStore; +import org.springframework.security.oauth2.provider.token.store.InMemoryTokenStore; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.web.WebAppConfiguration; import org.springframework.util.LinkedMultiValueMap; diff --git a/src/test/java/demo/ServerRunning.java b/src/test/java/demo/ServerRunning.java index f907319..84b1b0b 100644 --- a/src/test/java/demo/ServerRunning.java +++ b/src/test/java/demo/ServerRunning.java @@ -1,13 +1,5 @@ package demo; -import java.net.HttpURLConnection; -import java.net.URI; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.Map; - import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.junit.Assume; @@ -15,13 +7,8 @@ import org.junit.rules.MethodRule; import org.junit.runners.model.FrameworkMethod; import org.junit.runners.model.Statement; -import org.springframework.boot.test.RestTemplates; -import org.springframework.http.HttpEntity; -import org.springframework.http.HttpHeaders; -import org.springframework.http.HttpMethod; -import org.springframework.http.HttpStatus; -import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; +import org.springframework.boot.test.TestRestTemplate; +import org.springframework.http.*; import org.springframework.security.oauth2.client.test.RestTemplateHolder; import org.springframework.util.MultiValueMap; import org.springframework.web.client.RestClientException; @@ -29,6 +16,10 @@ import org.springframework.web.client.RestTemplate; import org.springframework.web.util.UriTemplate; +import java.net.HttpURLConnection; +import java.net.URI; +import java.util.*; + /** *

* A rule that prevents integration tests from failing if the server application is not running or not accessible. If @@ -287,7 +278,7 @@ public RestOperations getRestTemplate() { } public RestOperations createRestTemplate() { - RestTemplate client = RestTemplates.get(); + RestTemplate client = new TestRestTemplate(); return client; }