[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;
|
||||
|
||||
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.configuration.EnableWebSecurity;
|
||||
import org.springframework.security.web.SecurityFilterChain;
|
||||
|
@ -10,16 +11,14 @@ public class CFUAAOAuth2ResourceServerSecurityConfiguration {
|
|||
|
||||
@Bean
|
||||
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
|
||||
http.authorizeRequests()
|
||||
.antMatchers("/read/**")
|
||||
http.authorizeHttpRequests(auth -> auth
|
||||
.requestMatchers("/read/**")
|
||||
.hasAuthority("SCOPE_resource.read")
|
||||
.antMatchers("/write/**")
|
||||
.requestMatchers("/write/**")
|
||||
.hasAuthority("SCOPE_resource.write")
|
||||
.anyRequest()
|
||||
.authenticated()
|
||||
.and()
|
||||
.oauth2ResourceServer()
|
||||
.jwt();
|
||||
.authenticated())
|
||||
.oauth2ResourceServer((oauth2) -> oauth2.jwt(Customizer.withDefaults()));
|
||||
return http.build();
|
||||
}
|
||||
|
||||
|
|
|
@ -9,9 +9,9 @@
|
|||
|
||||
<parent>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<artifactId>parent-boot-2</artifactId>
|
||||
<artifactId>parent-boot-3</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<relativePath>../../parent-boot-2</relativePath>
|
||||
<relativePath>../../parent-boot-3</relativePath>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
|
|
Loading…
Reference in New Issue