Skip to content

Commit

Permalink
Oppdatert deprecated securityconfig for alle applikasjoner
Browse files Browse the repository at this point in the history
  • Loading branch information
stigus committed Oct 17, 2023
1 parent 640cb8a commit 05e3710
Show file tree
Hide file tree
Showing 133 changed files with 351 additions and 496 deletions.
2 changes: 1 addition & 1 deletion apps/adresse-service/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ dependencies {
implementation 'org.hibernate.validator:hibernate-validator'
implementation 'org.aspectj:aspectjweaver:1.9.7'

implementation 'net.logstash.logback:logstash-logback-encoder:7.3'
implementation 'net.logstash.logback:logstash-logback-encoder:7.4'
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.2.0'
implementation 'io.swagger.core.v3:swagger-annotations-jakarta:2.2.16'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,9 @@ public class SecurityConfig {
@Bean
public SecurityFilterChain filterChain(HttpSecurity httpSecurity) throws Exception {

httpSecurity.sessionManagement()
.sessionCreationPolicy(SessionCreationPolicy.STATELESS)
.and().csrf().disable()
.authorizeHttpRequests()
.requestMatchers(
httpSecurity.sessionManagement(sessionConfig -> sessionConfig.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
.csrf(csrfSpec -> csrfSpec.disable())
.authorizeHttpRequests(authorizeConfig -> authorizeConfig.requestMatchers(
"/internal/**",
"/webjars/**",
"/swagger-resources/**",
Expand All @@ -31,11 +29,9 @@ public SecurityFilterChain filterChain(HttpSecurity httpSecurity) throws Excepti
"/swagger",
"/error",
"/swagger-ui.html"
).permitAll()
.requestMatchers("/api/**").fullyAuthenticated()
.and()
.oauth2ResourceServer()
.jwt();
).permitAll().requestMatchers("/api/**").fullyAuthenticated())
.oauth2ResourceServer(oauth2RSConfig -> oauth2RSConfig.jwt(jwtConfigurer -> {
}));

return httpSecurity.build();
}
Expand Down
2 changes: 1 addition & 1 deletion apps/amelding-service/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ dependencies {

implementation 'org.springdoc:springdoc-openapi-starter-webflux-ui:2.2.0'
implementation 'io.swagger.core.v3:swagger-annotations-jakarta:2.2.16'
implementation 'net.logstash.logback:logstash-logback-encoder:7.3'
implementation 'net.logstash.logback:logstash-logback-encoder:7.4'

testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.cloud:spring-cloud-contract-wiremock'
Expand Down
2 changes: 1 addition & 1 deletion apps/app-tilgang-analyse-service/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ dependencies {
implementation 'org.flywaydb:flyway-core'
implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml'

implementation 'net.logstash.logback:logstash-logback-encoder:7.3'
implementation 'net.logstash.logback:logstash-logback-encoder:7.4'
implementation 'org.springdoc:springdoc-openapi-starter-webflux-ui:2.2.0'
implementation 'io.swagger.core.v3:swagger-annotations-jakarta:2.2.16'

Expand Down
2 changes: 1 addition & 1 deletion apps/arbeidsforhold-export-api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ dependencies {

implementation 'org.hibernate.validator:hibernate-validator'

implementation 'net.logstash.logback:logstash-logback-encoder:7.3'
implementation 'net.logstash.logback:logstash-logback-encoder:7.4'
runtimeOnly 'com.oracle.database.jdbc:ojdbc8'

testImplementation 'org.springframework.boot:spring-boot-starter-test'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,9 @@ public class SecurityConfig {
@Bean
public SecurityFilterChain filterChain(HttpSecurity httpSecurity) throws Exception {

httpSecurity.sessionManagement()
.sessionCreationPolicy(SessionCreationPolicy.STATELESS)
.and().csrf().disable()
.authorizeHttpRequests()
.requestMatchers(
httpSecurity.sessionManagement(sessionConfig -> sessionConfig.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
.csrf(csrfSpec -> csrfSpec.disable())
.authorizeHttpRequests(authorizeConfig -> authorizeConfig.requestMatchers(
"/internal/**",
"/webjars/**",
"/swagger-resources/**",
Expand All @@ -29,11 +27,9 @@ public SecurityFilterChain filterChain(HttpSecurity httpSecurity) throws Excepti
"/swagger",
"/error",
"/swagger-ui.html"
).permitAll()
.requestMatchers("/api/**").fullyAuthenticated()
.and()
.oauth2ResourceServer()
.jwt();
).permitAll().requestMatchers("/api/**").fullyAuthenticated())
.oauth2ResourceServer(oauth2RSConfig -> oauth2RSConfig.jwt(jwtConfigurer -> {
}));

return httpSecurity.build();
}
Expand Down
2 changes: 1 addition & 1 deletion apps/arbeidsforhold-service/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ dependencies {
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.2.0'
implementation 'io.swagger.core.v3:swagger-annotations-jakarta:2.2.16'

implementation 'net.logstash.logback:logstash-logback-encoder:7.3'
implementation 'net.logstash.logback:logstash-logback-encoder:7.4'

implementation 'org.hibernate.validator:hibernate-validator'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,9 @@ public class SecurityConfig {
@Bean
public SecurityFilterChain filterChain(HttpSecurity httpSecurity) throws Exception {

httpSecurity.sessionManagement()
.sessionCreationPolicy(SessionCreationPolicy.STATELESS)
.and().csrf().disable()
.authorizeHttpRequests()
.requestMatchers(
httpSecurity.sessionManagement(sessionConfig -> sessionConfig.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
.csrf(csrfSpec -> csrfSpec.disable())
.authorizeHttpRequests(authorizeConfig -> authorizeConfig.requestMatchers(
"/internal/**",
"/webjars/**",
"/swagger-resources/**",
Expand All @@ -32,11 +30,9 @@ public SecurityFilterChain filterChain(HttpSecurity httpSecurity) throws Excepti
"/swagger",
"/error",
"/swagger-ui.html"
).permitAll()
.requestMatchers("/api/**").fullyAuthenticated()
.and()
.oauth2ResourceServer()
.jwt();
).permitAll().requestMatchers("/api/**").fullyAuthenticated())
.oauth2ResourceServer(oauth2RSConfig -> oauth2RSConfig.jwt(jwtConfigurer -> {
}));

return httpSecurity.build();
}
Expand Down
2 changes: 1 addition & 1 deletion apps/batch-bestilling-service/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ dependencies {
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.2.0'
implementation 'io.swagger.core.v3:swagger-annotations-jakarta:2.2.16'

implementation 'net.logstash.logback:logstash-logback-encoder:7.3'
implementation 'net.logstash.logback:logstash-logback-encoder:7.4'
implementation 'org.hibernate.validator:hibernate-validator'

testImplementation 'org.springframework.boot:spring-boot-starter-test'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,9 @@ public class SecurityConfig {
@Bean
public SecurityFilterChain filterChain(HttpSecurity httpSecurity) throws Exception {

httpSecurity.sessionManagement()
.sessionCreationPolicy(SessionCreationPolicy.STATELESS)
.and().csrf().disable()
.authorizeHttpRequests()
.requestMatchers(
httpSecurity.sessionManagement(sessionConfig -> sessionConfig.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
.csrf(csrfSpec -> csrfSpec.disable())
.authorizeHttpRequests(authorizeConfig -> authorizeConfig.requestMatchers(
"/internal/**",
"/webjars/**",
"/swagger-resources/**",
Expand All @@ -29,11 +27,9 @@ public SecurityFilterChain filterChain(HttpSecurity httpSecurity) throws Excepti
"/swagger",
"/error",
"/swagger-ui.html"
).permitAll()
.requestMatchers("/api/**").fullyAuthenticated()
.and()
.oauth2ResourceServer()
.jwt();
).permitAll().requestMatchers("/api/**").fullyAuthenticated())
.oauth2ResourceServer(oauth2RSConfig -> oauth2RSConfig.jwt(jwtConfigurer -> {
}));

return httpSecurity.build();
}
Expand Down
2 changes: 1 addition & 1 deletion apps/brreg-stub/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ dependencies {

implementation 'org.apache.cxf:cxf-rt-frontend-jaxws:3.5.5'
implementation 'wsdl4j:wsdl4j:1.6.3'
implementation 'net.logstash.logback:logstash-logback-encoder:7.3'
implementation 'net.logstash.logback:logstash-logback-encoder:7.4'
implementation 'org.hibernate.validator:hibernate-validator'
implementation 'javax.validation:validation-api:2.0.1.Final'
implementation 'org.springdoc:springdoc-openapi-ui:1.6.15'
Expand Down
2 changes: 1 addition & 1 deletion apps/bruker-service/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ dependencies {
implementation 'io.micrometer:micrometer-registry-prometheus'
implementation 'org.springdoc:springdoc-openapi-starter-webflux-ui:2.2.0'
implementation 'io.swagger.core.v3:swagger-annotations-jakarta:2.2.16'
implementation 'net.logstash.logback:logstash-logback-encoder:7.3'
implementation 'net.logstash.logback:logstash-logback-encoder:7.4'
implementation 'org.hibernate.validator:hibernate-validator'

implementation 'io.r2dbc:r2dbc-h2'
Expand Down
14 changes: 8 additions & 6 deletions apps/budpro-service/build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
plugins {
id 'java'
id 'org.springframework.boot' version '3.1.2'
id 'io.spring.dependency-management' version '1.1.2'
id 'org.springframework.boot' version '3.1.4'
id 'io.spring.dependency-management' version '1.1.3'
id "jacoco"
id "org.sonarqube" version "4.0.0.2929"
}

java {
sourceCompatibility = '17'
}

bootJar {
archiveFileName = "app.jar"
mainClass = 'no.nav.dolly.budpro.BudproServiceApplication'
Expand All @@ -21,6 +17,12 @@ configurations {
}
}

java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}

repositories {
mavenCentral()
mavenLocal()
Expand Down
2 changes: 1 addition & 1 deletion apps/dolly-backend/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ dependencies {
implementation 'org.springframework.cloud:spring-cloud-starter-vault-config'
implementation 'org.springframework.cloud:spring-cloud-vault-config-databases'

implementation 'net.logstash.logback:logstash-logback-encoder:7.3'
implementation 'net.logstash.logback:logstash-logback-encoder:7.4'
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.2.0'
implementation 'io.swagger.core.v3:swagger-annotations-jakarta:2.2.16'

Expand Down
2 changes: 1 addition & 1 deletion apps/dolly-frontend/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ dependencies {
implementation 'org.springframework.cloud:spring-cloud-starter-vault-config'
implementation 'org.springframework.cloud:spring-cloud-starter-gateway'

implementation 'net.logstash.logback:logstash-logback-encoder:7.3'
implementation 'net.logstash.logback:logstash-logback-encoder:7.4'
implementation 'org.hibernate.validator:hibernate-validator'

testImplementation 'org.springframework.boot:spring-boot-starter-test'
Expand Down
2 changes: 1 addition & 1 deletion apps/dollystatus/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ repositories {

dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'net.logstash.logback:logstash-logback-encoder:7.3'
implementation 'net.logstash.logback:logstash-logback-encoder:7.4'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}
java {
Expand Down
2 changes: 1 addition & 1 deletion apps/endringsmelding-frontend/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ dependencies {
implementation 'org.springframework.boot:spring-boot-starter-actuator'

implementation 'io.micrometer:micrometer-registry-prometheus'
implementation 'net.logstash.logback:logstash-logback-encoder:7.3'
implementation 'net.logstash.logback:logstash-logback-encoder:7.4'
implementation 'org.hibernate.validator:hibernate-validator'

testImplementation 'org.springframework.boot:spring-boot-starter-test'
Expand Down
2 changes: 1 addition & 1 deletion apps/endringsmelding-service/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ dependencies {
implementation 'org.hibernate.validator:hibernate-validator'
implementation 'org.springdoc:springdoc-openapi-starter-webflux-ui:2.2.0'
implementation 'io.swagger.core.v3:swagger-annotations-jakarta:2.2.16'
implementation 'net.logstash.logback:logstash-logback-encoder:7.3'
implementation 'net.logstash.logback:logstash-logback-encoder:7.4'

testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.cloud:spring-cloud-contract-wiremock'
Expand Down
2 changes: 1 addition & 1 deletion apps/ereg-batch-status-service/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ dependencies {
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.2.0'
implementation 'io.swagger.core.v3:swagger-annotations-jakarta:2.2.16'

implementation 'net.logstash.logback:logstash-logback-encoder:7.3'
implementation 'net.logstash.logback:logstash-logback-encoder:7.4'
implementation 'org.hibernate.validator:hibernate-validator'

testImplementation 'org.springframework.boot:spring-boot-starter-test'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,9 @@ public class SecurityConfig {
@Bean
public SecurityFilterChain filterChain(HttpSecurity httpSecurity) throws Exception {

httpSecurity.sessionManagement()
.sessionCreationPolicy(SessionCreationPolicy.STATELESS)
.and().csrf().disable()
.authorizeHttpRequests()
.requestMatchers(
httpSecurity.sessionManagement(sessionConfig -> sessionConfig.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
.csrf(csrfSpec -> csrfSpec.disable())
.authorizeHttpRequests(authorizeConfig -> authorizeConfig.requestMatchers(
"/internal/**",
"/webjars/**",
"/swagger-resources/**",
Expand All @@ -29,11 +27,9 @@ public SecurityFilterChain filterChain(HttpSecurity httpSecurity) throws Excepti
"/swagger",
"/error",
"/swagger-ui.html"
).permitAll()
.requestMatchers("/api/**").fullyAuthenticated()
.and()
.oauth2ResourceServer()
.jwt();
).permitAll().requestMatchers("/api/**").fullyAuthenticated())
.oauth2ResourceServer(oauth2RSConfig -> oauth2RSConfig.jwt(jwtConfigurer -> {
}));

return httpSecurity.build();
}
Expand Down
2 changes: 1 addition & 1 deletion apps/faste-data-frontend/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ dependencies {
implementation 'org.springframework.boot:spring-boot-starter-actuator'

implementation 'io.micrometer:micrometer-registry-prometheus'
implementation 'net.logstash.logback:logstash-logback-encoder:7.3'
implementation 'net.logstash.logback:logstash-logback-encoder:7.4'
implementation 'org.hibernate.validator:hibernate-validator'

testImplementation 'org.springframework.boot:spring-boot-starter-test'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ dependencies {
implementation 'org.springframework.cloud:spring-cloud-starter-vault-config'

implementation 'io.micrometer:micrometer-registry-prometheus'
implementation 'net.logstash.logback:logstash-logback-encoder:7.3'
implementation 'net.logstash.logback:logstash-logback-encoder:7.4'
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.2.0'
implementation 'io.swagger.core.v3:swagger-annotations-jakarta:2.2.16'
implementation 'org.hibernate.validator:hibernate-validator'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,9 @@ public class SecurityConfig {
@Bean
public SecurityFilterChain filterChain(HttpSecurity httpSecurity) throws Exception {

httpSecurity.sessionManagement()
.sessionCreationPolicy(SessionCreationPolicy.STATELESS)
.and().csrf().disable()
.authorizeHttpRequests()
.requestMatchers(
httpSecurity.sessionManagement(sessionConfig -> sessionConfig.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
.csrf(csrfSpec -> csrfSpec.disable())
.authorizeHttpRequests(authorizeConfig -> authorizeConfig.requestMatchers(
"/internal/**",
"/webjars/**",
"/swagger-resources/**",
Expand All @@ -30,11 +28,9 @@ public SecurityFilterChain filterChain(HttpSecurity httpSecurity) throws Excepti
"/swagger",
"/error",
"/swagger-ui.html"
).permitAll()
.requestMatchers("/api/**").fullyAuthenticated()
.and()
.oauth2ResourceServer()
.jwt();
).permitAll().requestMatchers("/api/**").fullyAuthenticated())
.oauth2ResourceServer(oauth2RSConfig -> oauth2RSConfig.jwt(jwtConfigurer -> {
}));

return httpSecurity.build();
}
Expand Down
2 changes: 1 addition & 1 deletion apps/generer-navn-service/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ dependencies {
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.2.0'
implementation 'io.swagger.core.v3:swagger-annotations-jakarta:2.2.16'

implementation 'net.logstash.logback:logstash-logback-encoder:7.3'
implementation 'net.logstash.logback:logstash-logback-encoder:7.4'
implementation 'org.hibernate.validator:hibernate-validator'

testImplementation 'org.springframework.boot:spring-boot-starter-test'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,9 @@ public class SecurityConfig {
@Bean
public SecurityFilterChain filterChain(HttpSecurity httpSecurity) throws Exception {

httpSecurity.sessionManagement()
.sessionCreationPolicy(SessionCreationPolicy.STATELESS)
.and().csrf().disable()
.authorizeHttpRequests()
.requestMatchers(
httpSecurity.sessionManagement(sessionConfig -> sessionConfig.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
.csrf(csrfSpec -> csrfSpec.disable())
.authorizeHttpRequests(authorizeConfig -> authorizeConfig.requestMatchers(
"/internal/**",
"/webjars/**",
"/swagger-resources/**",
Expand All @@ -29,11 +27,9 @@ public SecurityFilterChain filterChain(HttpSecurity httpSecurity) throws Excepti
"/swagger",
"/error",
"/swagger-ui.html"
).permitAll()
.requestMatchers("/api/**").fullyAuthenticated()
.and()
.oauth2ResourceServer()
.jwt();
).permitAll().requestMatchers("/api/**").fullyAuthenticated())
.oauth2ResourceServer(oauth2RSConfig -> oauth2RSConfig.jwt(jwtConfigurer -> {
}));

return httpSecurity.build();
}
Expand Down
Loading

0 comments on commit 05e3710

Please sign in to comment.