Skip to content

Commit

Permalink
Spring boot upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
DamnClin committed Jul 23, 2023
1 parent 18d2d07 commit 40660aa
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 38 deletions.
2 changes: 1 addition & 1 deletion src/main/resources/generator/dependencies/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<assertj.version>3.24.2</assertj.version>
<mockito.version>5.4.0</mockito.version>
<logstash-logback-encoder.version>7.4</logstash-logback-encoder.version>
<spring-boot.version>3.1.1</spring-boot.version>
<spring-boot.version>3.1.2</spring-boot.version>
<spring-cloud.version>2022.0.0</spring-cloud.version>
<spring-cloud-netflix-eureka-client.version>4.0.2</spring-cloud-netflix-eureka-client.version>
<springdoc-openapi-starter-webmvc.version>2.1.0</springdoc-openapi-starter-webmvc.version>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package {{packageName}}.authentication.infrastructure.primary;

import static org.springframework.security.web.util.matcher.AntPathRequestMatcher.*;

import {{packageName}}.authentication.domain.Role;
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.security.Keys;
Expand Down Expand Up @@ -48,14 +50,14 @@ class SecurityConfiguration {
return web ->
web
.ignoring()
.requestMatchers(HttpMethod.OPTIONS, "/**")
.requestMatchers("/app/**")
.requestMatchers("/i18n/**")
.requestMatchers("/content/**")
.requestMatchers("/swagger-ui/**")
.requestMatchers("/swagger-ui.html")
.requestMatchers("/v3/api-docs/**")
.requestMatchers("/test/**");
.requestMatchers(antMatcher(HttpMethod.OPTIONS, "/**"))
.requestMatchers(antMatcher("/app/**"))
.requestMatchers(antMatcher("/i18n/**"))
.requestMatchers(antMatcher("/content/**"))
.requestMatchers(antMatcher("/swagger-ui/**"))
.requestMatchers(antMatcher("/swagger-ui.html"))
.requestMatchers(antMatcher("/v3/api-docs/**"))
.requestMatchers(antMatcher("/test/**"));
}

@Bean
Expand All @@ -75,18 +77,18 @@ class SecurityConfiguration {
.httpBasic(AbstractHttpConfigurer::disable)
.sessionManagement(session -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
.authorizeHttpRequests(authz -> authz
.requestMatchers("/api/authenticate").permitAll()
.requestMatchers("/api/register").permitAll()
.requestMatchers("/api/activate").permitAll()
.requestMatchers("/api/account/reset-password/init").permitAll()
.requestMatchers("/api/account/reset-password/finish").permitAll()
.requestMatchers("/api/admin/**").hasAuthority(Role.ADMIN.key())
.requestMatchers("/api/**").authenticated()
.requestMatchers("/management/health").permitAll()
.requestMatchers("/management/health/**").permitAll()
.requestMatchers("/management/info").permitAll()
.requestMatchers("/management/prometheus").permitAll()
.requestMatchers("/management/**").hasAuthority(Role.ADMIN.key())
.requestMatchers(antMatcher("/api/authenticate")).permitAll()
.requestMatchers(antMatcher("/api/register")).permitAll()
.requestMatchers(antMatcher("/api/activate")).permitAll()
.requestMatchers(antMatcher("/api/account/reset-password/init")).permitAll()
.requestMatchers(antMatcher("/api/account/reset-password/finish")).permitAll()
.requestMatchers(antMatcher("/api/admin/**")).hasAuthority(Role.ADMIN.key())
.requestMatchers(antMatcher("/api/**")).authenticated()
.requestMatchers(antMatcher("/management/health")).permitAll()
.requestMatchers(antMatcher("/management/health/**")).permitAll()
.requestMatchers(antMatcher("/management/info")).permitAll()
.requestMatchers(antMatcher("/management/prometheus")).permitAll()
.requestMatchers(antMatcher("/management/**")).hasAuthority(Role.ADMIN.key())
.anyRequest().authenticated()
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package {{packageName}}.authentication.infrastructure.primary;

import static org.springframework.security.web.util.matcher.AntPathRequestMatcher.*;

import java.time.Duration;
import java.util.HashSet;
import java.util.Set;
Expand Down Expand Up @@ -64,14 +66,14 @@ public class SecurityConfiguration {
return web ->
web
.ignoring()
.requestMatchers(HttpMethod.OPTIONS, "/**")
.requestMatchers("/app/**")
.requestMatchers("/i18n/**")
.requestMatchers("/content/**")
.requestMatchers("/swagger-ui/**")
.requestMatchers("/swagger-ui.html")
.requestMatchers("/v3/api-docs/**")
.requestMatchers("/test/**");
.requestMatchers(antMatcher(HttpMethod.OPTIONS, "/**"))
.requestMatchers(antMatcher("/app/**"))
.requestMatchers(antMatcher("/i18n/**"))
.requestMatchers(antMatcher("/content/**"))
.requestMatchers(antMatcher("/swagger-ui/**"))
.requestMatchers(antMatcher("/swagger-ui.html"))
.requestMatchers(antMatcher("/v3/api-docs/**"))
.requestMatchers(antMatcher("/test/**"));
}

@Bean
Expand All @@ -88,15 +90,15 @@ public class SecurityConfiguration {
permissions.policy("camera=(), fullscreen=(self), geolocation=(), gyroscope=(), magnetometer=(), microphone=(), midi=(), payment=(), sync-xhr=()"))
)
.authorizeHttpRequests(authz -> authz
.requestMatchers("/api/authenticate").permitAll()
.requestMatchers("/api/auth-info").permitAll()
.requestMatchers("/api/admin/**").hasAuthority(Role.ADMIN.key())
.requestMatchers("/api/**").authenticated()
.requestMatchers("/management/health").permitAll()
.requestMatchers("/management/health/**").permitAll()
.requestMatchers("/management/info").permitAll()
.requestMatchers("/management/prometheus").permitAll()
.requestMatchers("/management/**").hasAuthority(Role.ADMIN.key())
.requestMatchers(antMatcher("/api/authenticate")).permitAll()
.requestMatchers(antMatcher("/api/auth-info")).permitAll()
.requestMatchers(antMatcher("/api/admin/**")).hasAuthority(Role.ADMIN.key())
.requestMatchers(antMatcher("/api/**")).authenticated()
.requestMatchers(antMatcher("/management/health")).permitAll()
.requestMatchers(antMatcher("/management/health/**")).permitAll()
.requestMatchers(antMatcher("/management/info")).permitAll()
.requestMatchers(antMatcher("/management/prometheus")).permitAll()
.requestMatchers(antMatcher("/management/**")).hasAuthority(Role.ADMIN.key())
.anyRequest().authenticated()
)
.oauth2Login(withDefaults())
Expand Down

0 comments on commit 40660aa

Please sign in to comment.