Skip to content

Commit

Permalink
bump spring boot parent version to 3.1.5 for samples
Browse files Browse the repository at this point in the history
Signed-off-by: liga-oz <[email protected]>
  • Loading branch information
liga-oz committed Nov 8, 2023
1 parent 836ac47 commit 6082b64
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 30 deletions.
2 changes: 1 addition & 1 deletion samples/spring-security-basic-auth/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.0.4</version>
<version>3.1.5</version>
<relativePath/>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,18 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
authEntryPoint.setRealmName("spring-security-basic-auth");

// @formatter:off
http.authorizeHttpRequests()
.requestMatchers("/fetchToken").hasAuthority("Display")
.requestMatchers("/health").permitAll()
.anyRequest().denyAll()
.and()
.sessionManagement()
.sessionCreationPolicy(SessionCreationPolicy.STATELESS)
.and()
.exceptionHandling()
.authenticationEntryPoint(authEntryPoint)
.and()
.oauth2ResourceServer()
.bearerTokenResolver(tokenBrokerResolver)
.jwt()
.jwtAuthenticationConverter(authConverter);
http
.httpBasic(basic -> basic.authenticationEntryPoint(authEntryPoint))
.authorizeHttpRequests(authz ->
authz
.requestMatchers("/fetchToken").hasAuthority("Display")
.requestMatchers("/health").permitAll()
.anyRequest().denyAll())
.sessionManagement(session -> session
.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
.oauth2ResourceServer(oauth2 -> oauth2
.bearerTokenResolver(tokenBrokerResolver)
.jwt(jwt -> jwt.jwtAuthenticationConverter(authConverter)));
// @formatter:on

return http.build();
Expand Down
2 changes: 1 addition & 1 deletion samples/spring-security-hybrid-usage/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.0.4</version>
<version>3.1.5</version>
<relativePath/>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,17 @@ public class SecurityConfiguration {
@Bean
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off
http.sessionManagement()
.sessionCreationPolicy(SessionCreationPolicy.STATELESS)
.and()
http
.sessionManagement(session -> session
.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
.authorizeHttpRequests(authz ->
authz.requestMatchers("/sayHello").hasAuthority("Read")
.requestMatchers("/comp/sayHello").hasAuthority("Read")
.requestMatchers("/*").authenticated()
.anyRequest().denyAll())
.oauth2ResourceServer()
.jwt()
.jwtAuthenticationConverter(new MyCustomHybridTokenAuthenticationConverter()); // Adjust the converter to represent your use case
.oauth2ResourceServer(oauth2 -> oauth2
.jwt(jwt -> jwt
.jwtAuthenticationConverter(new MyCustomHybridTokenAuthenticationConverter()))); // Adjust the converter to represent your use case
// Use MyCustomHybridTokenAuthenticationConverter when IAS and XSUAA is used
// Use MyCustomIasTokenAuthenticationConverter when only IAS is used
// @formatter:on
Expand Down
2 changes: 1 addition & 1 deletion samples/spring-security-xsuaa-usage/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.0.4</version>
<version>3.1.5</version>
<relativePath/>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@ public class SecurityConfiguration {
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off
http
.sessionManagement()
.sessionCreationPolicy(SessionCreationPolicy.STATELESS) // session is created by approuter
.and()
.sessionManagement(session -> session
.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
.authorizeHttpRequests(authz ->
authz.requestMatchers("/v1/sayHello").hasAuthority("Read")
.requestMatchers("/v1/*").authenticated()
Expand All @@ -43,9 +42,9 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
.requestMatchers("/health").permitAll()
.anyRequest().denyAll()
)
.oauth2ResourceServer()
.jwt()
.jwtAuthenticationConverter(getJwtAuthenticationConverter());
.oauth2ResourceServer(oauth2 -> oauth2
.jwt(jwt -> jwt
.jwtAuthenticationConverter(getJwtAuthenticationConverter())));
// @formatter:on

return http.build();
Expand Down

0 comments on commit 6082b64

Please sign in to comment.