Skip to content

Commit

Permalink
Merge pull request #805 from navikt/pomming
Browse files Browse the repository at this point in the history
pom cleanup
  • Loading branch information
jan-olaveide authored Nov 30, 2023
2 parents 8d16f1b + 83ac9b6 commit 6a88e56
Show file tree
Hide file tree
Showing 12 changed files with 52 additions and 71 deletions.
27 changes: 11 additions & 16 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -104,27 +104,21 @@
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<compilerArgs>
<arg>-parameters</arg>
</compilerArgs>
</configuration>
</plugin>
<plugin>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
<version>${kotlin.version}</version>
<executions>
<execution>
<id>compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>test-compile</id>
<phase>test-compile</phase>
<goals>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
<configuration>
<javaParameters>true</javaParameters>
<args>
<arg>-Xjsr305=strict</arg>
</args>
Expand All @@ -141,6 +135,7 @@
<version>${kotlin.version}</version>
</dependency>
</dependencies>
<extensions>true</extensions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down
11 changes: 3 additions & 8 deletions token-client-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,9 @@
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<compilerArgs>
<arg>-parameters</arg>
</compilerArgs>
</configuration>
</plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,16 @@ internal class ApplicationTest {
) {
(environment.config as MapApplicationConfig).apply {
val prefix = "no.nav.security.jwt"
put("${prefix}.issuers.size", "1")
put("${prefix}.issuers.0.issuer_name", issuerId)
put("${prefix}.issuers.0.discoveryurl", "${server.wellKnownUrl(issuerId)}")
put("${prefix}.issuers.0.accepted_audience", acceptedAudience)
put("${prefix}.client.registration.clients.size", "1")
put("${prefix}.client.registration.clients.0.client_name", "issuer1")
put("${prefix}.client.registration.clients.0.well_known_url", "${server.wellKnownUrl(issuerId)}")
put("${prefix}.client.registration.clients.0.authentication.client_id", "client1")
put("${prefix}.client.registration.clients.0.authentication.client_auth_method", "private_key_jwt")
put("${prefix}.client.registration.clients.0.authentication.client_jwk", jwk)
put("$prefix.issuers.size", "1")
put("$prefix.issuers.0.issuer_name", issuerId)
put("$prefix.issuers.0.discoveryurl", "${server.wellKnownUrl(issuerId)}")
put("$prefix.issuers.0.accepted_audience", acceptedAudience)
put("$prefix.client.registration.clients.size", "1")
put("$prefix.client.registration.clients.0.client_name", "issuer1")
put("$prefix.client.registration.clients.0.well_known_url", "${server.wellKnownUrl(issuerId)}")
put("$prefix.client.registration.clients.0.authentication.client_id", "client1")
put("$prefix.client.registration.clients.0.authentication.client_auth_method", "private_key_jwt")
put("$prefix.client.registration.clients.0.authentication.client_jwk", jwk)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ internal class OAuth2ClientIntegrationTest {

// TODO: fix test on github actions
@Test
@Disabled("fails on github actions, but runs fine in Idea and mvn locally, maybe something with clock/time")
@Disabled("fails on github actions, but runs fine in Idea and mvn locally, maybe something with clock/time")
fun `token request should return cached response on second request with same request`() {
withMockOAuth2Server {
this.enqueueCallback(
Expand Down
3 changes: 0 additions & 3 deletions token-client-spring/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,6 @@
<plugin>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
<configuration>
<javaParameters>true</javaParameters>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down
4 changes: 4 additions & 0 deletions token-validation-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@
</environmentVariables>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
Expand Down
4 changes: 4 additions & 0 deletions token-validation-filter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
Expand Down
4 changes: 4 additions & 0 deletions token-validation-jaxrs/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
Expand Down
1 change: 0 additions & 1 deletion token-validation-ktor-demo/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
</plugin>

<plugin>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
Expand Down
9 changes: 6 additions & 3 deletions token-validation-ktor-v2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,15 @@
</exclusions>
</dependency>
<dependency>
<groupId>com.github.tomakehurst</groupId>
<groupId>org.wiremock</groupId>
<artifactId>wiremock</artifactId>
<version>2.27.2</version>
<version>3.3.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
</dependency>
<dependency>
<!-- needed by Wiremock -->
<groupId>commons-logging</groupId>
Expand Down Expand Up @@ -117,7 +121,6 @@
</execution>
</executions>
</plugin>

</plugins>
</build>
<profiles>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.http.HttpStatus;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.web.servlet.setup.ConfigurableMockMvcBuilder;
Expand All @@ -21,9 +22,11 @@
import java.util.Collections;
import java.util.List;

import static io.restassured.module.mockmvc.RestAssuredMockMvc.*;
import static io.restassured.module.mockmvc.RestAssuredMockMvc.given;
import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.*;

@SpringBootTest(classes = DemoApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@SpringBootTest(classes = DemoApplication.class, webEnvironment = RANDOM_PORT)
@ActiveProfiles("test")
@EnableMockOAuth2Server
class DemoControllerTest {
Expand All @@ -35,15 +38,15 @@ class DemoControllerTest {

@BeforeEach
void initialiseRestAssuredMockMvcWebApplicationContext() {
Collection<Filter> filterCollection = webApplicationContext.getBeansOfType(Filter.class).values();
Filter[] filters = filterCollection.toArray(new Filter[0]);
MockMvcConfigurer mockMvcConfigurer = new MockMvcConfigurer() {
var filterCollection = webApplicationContext.getBeansOfType(Filter.class).values();
var filters = filterCollection.toArray(new Filter[0]);
var mockMvcConfigurer = new MockMvcConfigurer() {
@Override
public void afterConfigurerAdded(ConfigurableMockMvcBuilder<?> builder) {
builder.addFilters(filters);
}
};
RestAssuredMockMvc.webAppContextSetup(webApplicationContext, mockMvcConfigurer);
webAppContextSetup(webApplicationContext, mockMvcConfigurer);
}

@Test
Expand Down Expand Up @@ -94,4 +97,4 @@ private String token(String issuerId, String subject, String audience){
)
).serialize();
}
}
}
23 changes: 0 additions & 23 deletions token-validation-spring/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -159,29 +159,6 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<parameters>true</parameters>
</configuration>
<executions>
<execution>
<id>compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>testCompile</id>
<phase>test-compile</phase>
<goals>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
Expand Down

0 comments on commit 6a88e56

Please sign in to comment.