upgrade spring security cloud
This commit is contained in:
@@ -19,8 +19,8 @@
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.security.oauth</groupId>
|
||||
<artifactId>spring-security-oauth2</artifactId>
|
||||
<groupId>org.springframework.security.oauth.boot</groupId>
|
||||
<artifactId>spring-security-oauth2-autoconfigure</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
@@ -30,6 +30,7 @@
|
||||
<dependency>
|
||||
<groupId>org.springframework.security</groupId>
|
||||
<artifactId>spring-security-jwt</artifactId>
|
||||
<version>${spring-jwt.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
@@ -55,7 +56,8 @@
|
||||
</build>
|
||||
|
||||
<properties>
|
||||
<spring-cloud.version>Edgware.RELEASE</spring-cloud.version>
|
||||
<spring-cloud.version>Greenwich.SR1</spring-cloud.version>
|
||||
<spring-jwt.version>1.0.10.RELEASE</spring-jwt.version>
|
||||
</properties>
|
||||
|
||||
</project>
|
||||
|
||||
+7
-4
@@ -3,7 +3,7 @@ package com.baeldung.config;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
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.configuration.EnableWebSecurity;
|
||||
import org.springframework.security.config.http.SessionCreationPolicy;
|
||||
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer;
|
||||
import org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter;
|
||||
|
||||
@@ -11,15 +11,18 @@ import org.springframework.security.oauth2.config.annotation.web.configuration.R
|
||||
* REST API Resource Server.
|
||||
*/
|
||||
@Configuration
|
||||
@EnableWebSecurity
|
||||
@EnableResourceServer
|
||||
@EnableGlobalMethodSecurity(prePostEnabled = true) // Allow method annotations like @PreAuthorize
|
||||
public class ResourceConfigurer extends ResourceServerConfigurerAdapter {
|
||||
|
||||
@Override
|
||||
public void configure(HttpSecurity http) throws Exception {
|
||||
http.httpBasic().disable();
|
||||
http.authorizeRequests().anyRequest().authenticated();
|
||||
http.sessionManagement()
|
||||
.sessionCreationPolicy(SessionCreationPolicy.NEVER)
|
||||
.and()
|
||||
.authorizeRequests()
|
||||
.anyRequest().authenticated();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ server:
|
||||
|
||||
# Configure the public key to use for verifying the incoming JWT tokens
|
||||
security:
|
||||
sessions: NEVER
|
||||
oauth2:
|
||||
resource:
|
||||
jwt:
|
||||
|
||||
Reference in New Issue
Block a user