Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cleanup/jwtdecoder-autoconfiguration #3717

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
package no.nav.testnav.apps.adresseservice.config;

import no.nav.testnav.libs.servletcore.config.ApplicationCoreConfig;
import no.nav.testnav.libs.servletsecurity.config.SecureOAuth2ServerToServerConfiguration;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;

@Configuration
@Import({ApplicationCoreConfig.class,
SecureOAuth2ServerToServerConfiguration.class})
@Import({ApplicationCoreConfig.class})
public class ApplicationConfig {
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,17 @@

import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.bean.override.mockito.MockitoBean;
import org.springframework.security.oauth2.jwt.JwtDecoder;
import org.springframework.test.context.ActiveProfiles;

import static org.assertj.core.api.AssertionsForClassTypes.assertThat;

@SpringBootTest
@ActiveProfiles("test")
class ApplicationContextTest {

@MockitoBean
public JwtDecoder jwtDecoder;

@Test
@SuppressWarnings("java:S2699")
void load_app_context() {
assertThat(true).isTrue();
}

}
Original file line number Diff line number Diff line change
@@ -1,24 +1,18 @@
package no.nav.testnav.altinn3tilgangservice;

import com.google.cloud.secretmanager.v1.SecretManagerServiceClient;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.bean.override.mockito.MockitoBean;
import org.springframework.security.oauth2.jwt.ReactiveJwtDecoder;
import org.springframework.test.context.ActiveProfiles;

import static org.assertj.core.api.AssertionsForClassTypes.assertThat;

@SpringBootTest
@ActiveProfiles("test")
class ApplicationContextTest {

@MockitoBean
public ReactiveJwtDecoder jwtDecoder;

@MockitoBean
public SecretManagerServiceClient secretManagerClient;

@Test
@SuppressWarnings("java:S2699")
void load_app_context() {
assertThat(true).isTrue();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,10 @@ MASKINPORTEN_CLIENT_ID: dummy
MASKINPORTEN_CLIENT_JWK: dummy
MASKINPORTEN_SCOPES: dummy
MASKINPORTEN_WELL_KNOWN_URL: http://localhost:8080
TOKEN_X_ISSUER: dummy
TOKEN_X_ISSUER: dummy

spring:
cloud:
gcp:
secretmanager:
enabled: false
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,17 @@

import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.bean.override.mockito.MockitoBean;
import org.springframework.security.oauth2.jwt.ReactiveJwtDecoder;
import org.springframework.test.context.ActiveProfiles;

import static org.assertj.core.api.AssertionsForClassTypes.assertThat;

@SpringBootTest
@ActiveProfiles("test")
class ApplicationContextTest {

@MockitoBean
public ReactiveJwtDecoder reactiveJwtDecoder;

@Test
@SuppressWarnings("java:S2699")
void load_app_context() {
assertThat(true).isTrue();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,16 @@

import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.bean.override.mockito.MockitoBean;
import org.springframework.security.oauth2.jwt.JwtDecoder;
import org.springframework.test.context.ActiveProfiles;

import static org.assertj.core.api.AssertionsForClassTypes.assertThat;

@SpringBootTest
@ActiveProfiles("test")
class ApplicationContextTest {

@MockitoBean
public JwtDecoder jwtDecoder;

@Test
@SuppressWarnings("java:S2699")
void load_app_context() {
assertThat(true).isTrue();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,8 @@
import org.springframework.context.annotation.Import;

import no.nav.testnav.libs.servletcore.config.ApplicationCoreConfig;
import no.nav.testnav.libs.servletsecurity.config.SecureOAuth2ServerToServerConfiguration;

@Configuration
@Import({
ApplicationCoreConfig.class,
SecureOAuth2ServerToServerConfiguration.class
})
@Import({ApplicationCoreConfig.class})
public class ApplicationConfig {
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.bean.override.mockito.MockitoBean;
import org.springframework.security.oauth2.jwt.JwtDecoder;
import org.springframework.test.context.ActiveProfiles;

import static org.assertj.core.api.AssertionsForClassTypes.assertThat;
Expand All @@ -13,10 +11,6 @@
@ActiveProfiles("test")
class ApplicationContextTest {

@MockitoBean
@SuppressWarnings("unused")
private JwtDecoder jwtDecoder;

@Test
@DisplayName("Application context should load")
void load_app_context() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
package no.nav.registre.testnorge.batchbestillingservice.config;

import no.nav.testnav.libs.servletcore.config.ApplicationCoreConfig;
import no.nav.testnav.libs.standalone.servletsecurity.config.InsecureJwtServerToServerConfiguration;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;

@Configuration
@Import({
ApplicationCoreConfig.class,
InsecureJwtServerToServerConfiguration.class
})
@Import({ApplicationCoreConfig.class})
public class ApplicationConfig {

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,17 @@

import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.bean.override.mockito.MockitoBean;
import org.springframework.security.oauth2.jwt.JwtDecoder;
import org.springframework.test.context.ActiveProfiles;

import static org.assertj.core.api.AssertionsForClassTypes.assertThat;

@ActiveProfiles("test")
@SpringBootTest
public class ApplicationContextTest {

@MockitoBean
public JwtDecoder jwtDecoder;
class ApplicationContextTest {

@Test
@SuppressWarnings("java:S2699")
void load_app_context() {
assertThat(true).isTrue();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
@Configuration
@EnableJpaAuditing
@EnableJpaRepositories(basePackages = "no.nav.brregstub.database.repository")
@Import(value = {
@Import({
ApplicationCoreConfig.class,
VaultHikariConfiguration.class,
FlywayConfiguration.class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,8 @@
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import org.springframework.test.context.bean.override.mockito.MockitoBean;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.security.oauth2.jwt.JwtDecoder;
import org.springframework.web.reactive.function.BodyInserters;
import org.springframework.web.reactive.function.client.WebClient;

Expand All @@ -29,8 +27,6 @@ class BrukerServiceIntegrationTest {
private static final String PID = "01810048413";
private static final String ORGNUMMER = "811306312";
public static MockWebServer mockBackEnd;
@MockitoBean
JwtDecoder jwtDecoder;

private ObjectMapper objectMapper;
private WebClient webClient;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
package no.nav.dolly.budpro;

import no.nav.testnav.libs.servletsecurity.config.SecureOAuth2ServerToServerConfiguration;
import no.nav.testnav.libs.standalone.servletsecurity.config.InsecureJwtServerToServerConfiguration;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.Profile;
import org.springframework.security.config.Customizer;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
Expand All @@ -16,10 +13,6 @@

@Configuration
@EnableWebSecurity
@Import({
SecureOAuth2ServerToServerConfiguration.class,
InsecureJwtServerToServerConfiguration.class
})
@Profile("!test")
public class SecurityConfig {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
import lombok.Getter;
import no.nav.testnav.libs.reactivecore.config.CoreConfig;
import no.nav.testnav.libs.servletcore.config.ApplicationCoreConfig;
import no.nav.testnav.libs.servletsecurity.config.SecureOAuth2ServerToServerConfiguration;
import no.nav.testnav.libs.standalone.servletsecurity.config.InsecureJwtServerToServerConfiguration;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
Expand All @@ -17,8 +15,6 @@
@EnableRetry
@Import({
ApplicationCoreConfig.class,
SecureOAuth2ServerToServerConfiguration.class,
InsecureJwtServerToServerConfiguration.class,
CoreConfig.class
})
public class ApplicationConfig {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,17 @@

import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.bean.override.mockito.MockitoBean;
import org.springframework.security.oauth2.jwt.JwtDecoder;
import org.springframework.test.context.ActiveProfiles;

import static org.assertj.core.api.AssertionsForClassTypes.assertThat;

@SpringBootTest
@ActiveProfiles("test")
class ApplicationContextTest {

@MockitoBean
public JwtDecoder jwtDecoder;

@Test
@SuppressWarnings("java:S2699")
void load_app_context() {
assertThat(true).isTrue();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,17 @@

import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.bean.override.mockito.MockitoBean;
import org.springframework.security.oauth2.jwt.ReactiveJwtDecoder;
import org.springframework.test.context.ActiveProfiles;

import static org.assertj.core.api.AssertionsForClassTypes.assertThat;

@SpringBootTest
@ActiveProfiles("test")
class ApplicationContextTest {

@MockitoBean
public ReactiveJwtDecoder jwtDecoder;

@Test
@SuppressWarnings("java:S2699")
void load_app_context() {
assertThat(true).isTrue();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,17 @@

import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.bean.override.mockito.MockitoBean;
import org.springframework.security.oauth2.jwt.JwtDecoder;
import org.springframework.test.context.ActiveProfiles;

import static org.assertj.core.api.AssertionsForClassTypes.assertThat;

@SpringBootTest
@ActiveProfiles("test")
class ApplicationContextTest {

@MockitoBean
public JwtDecoder jwtDecoder;

@Test
@SuppressWarnings("java:S2699")
void load_app_context() {
assertThat(true).isTrue();
}

}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package no.nav.registre.testnav.genererarbeidsforholdpopulasjonservice.config;

import no.nav.testnav.libs.servletcore.config.ApplicationCoreConfig;
import no.nav.testnav.libs.standalone.servletsecurity.config.InsecureJwtServerToServerConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
Expand All @@ -10,10 +9,7 @@
import org.springframework.security.task.DelegatingSecurityContextAsyncTaskExecutor;

@Configuration
@Import({
ApplicationCoreConfig.class,
InsecureJwtServerToServerConfiguration.class
})
@Import({ApplicationCoreConfig.class})
public class ApplicationConfig {

@Bean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,18 @@

import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.bean.override.mockito.MockitoBean;
import org.springframework.security.oauth2.jwt.JwtDecoder;
import org.springframework.test.context.ActiveProfiles;

import static org.assertj.core.api.AssertionsForClassTypes.assertThat;


@SpringBootTest
@ActiveProfiles("test")
class ApplicationContextTest {

@MockitoBean
public JwtDecoder jwtDecoder;

@Test
@SuppressWarnings("java:S2699")
void load_app_context() {
assertThat(true).isTrue();
}

}
Loading
Loading