[JAVA-28945] Upgrade cloud-foundry-uaa to Spring Boot 3 (#16181)
This commit is contained in:
parent
da41c860a1
commit
e65c1f851f
@ -1,6 +1,7 @@
|
|||||||
package com.baeldung.cfuaa.oauth2.resourceserver;
|
package com.baeldung.cfuaa.oauth2.resourceserver;
|
||||||
|
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.security.config.Customizer;
|
||||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
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.EnableWebSecurity;
|
||||||
import org.springframework.security.web.SecurityFilterChain;
|
import org.springframework.security.web.SecurityFilterChain;
|
||||||
@ -10,16 +11,14 @@ public class CFUAAOAuth2ResourceServerSecurityConfiguration {
|
|||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
|
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
|
||||||
http.authorizeRequests()
|
http.authorizeHttpRequests(auth -> auth
|
||||||
.antMatchers("/read/**")
|
.requestMatchers("/read/**")
|
||||||
.hasAuthority("SCOPE_resource.read")
|
.hasAuthority("SCOPE_resource.read")
|
||||||
.antMatchers("/write/**")
|
.requestMatchers("/write/**")
|
||||||
.hasAuthority("SCOPE_resource.write")
|
.hasAuthority("SCOPE_resource.write")
|
||||||
.anyRequest()
|
.anyRequest()
|
||||||
.authenticated()
|
.authenticated())
|
||||||
.and()
|
.oauth2ResourceServer((oauth2) -> oauth2.jwt(Customizer.withDefaults()));
|
||||||
.oauth2ResourceServer()
|
|
||||||
.jwt();
|
|
||||||
return http.build();
|
return http.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,9 +9,9 @@
|
|||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.baeldung</groupId>
|
<groupId>com.baeldung</groupId>
|
||||||
<artifactId>parent-boot-2</artifactId>
|
<artifactId>parent-boot-3</artifactId>
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
<relativePath>../../parent-boot-2</relativePath>
|
<relativePath>../../parent-boot-3</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user