-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cleanup/docker-compose-integration-tests (#3614)
Mindre refaktorering for å fjerne forskjellige warnings.
- Loading branch information
Showing
29 changed files
with
268 additions
and
271 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
FROM ghcr.io/navikt/baseimages/temurin:21 | ||
LABEL maintainer="Team Dolly" | ||
|
||
ADD /build/libs/app.jar /app/app.jar | ||
COPY /build/libs/app.jar /app/app.jar | ||
|
||
EXPOSE 8080 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
...k/src/main/java/no/nav/testnav/mocks/maskinporten/MaskinportenMockApplicationStarter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package no.nav.testnav.mocks.maskinporten; | ||
|
||
import lombok.SneakyThrows; | ||
import lombok.experimental.UtilityClass; | ||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
import org.springframework.context.annotation.Import; | ||
import org.springframework.core.io.ClassPathResource; | ||
import org.springframework.web.reactive.config.EnableWebFlux; | ||
|
||
import no.nav.testnav.libs.reactivecore.config.CoreConfig; | ||
|
||
import java.io.BufferedReader; | ||
import java.io.InputStreamReader; | ||
import java.nio.charset.StandardCharsets; | ||
import java.util.stream.Collectors; | ||
|
||
@Import({ | ||
CoreConfig.class, | ||
}) | ||
@EnableWebFlux | ||
@SpringBootApplication | ||
public class MaskinportenMockApplicationStarter { | ||
public static void main(String[] args) { | ||
SpringApplication.run(MaskinportenMockApplicationStarter.class, args); | ||
} | ||
|
||
@UtilityClass | ||
public static class Utils { | ||
|
||
@SneakyThrows | ||
public static String loadJson(String path) { | ||
try (final InputStreamReader stream = new InputStreamReader(new ClassPathResource(path).getInputStream(), StandardCharsets.UTF_8)) { | ||
return new BufferedReader(stream) | ||
.lines() | ||
.collect(Collectors.joining("\n")); | ||
} | ||
} | ||
|
||
} | ||
|
||
} |
6 changes: 2 additions & 4 deletions
6
.../tokendingsmock/config/OpenApiConfig.java → ...ks/maskinporten/config/OpenApiConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
...orten-mock/src/main/java/no/nav/testnav/mocks/maskinporten/controller/MockController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package no.nav.testnav.mocks.maskinporten.controller; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import no.nav.testnav.mocks.maskinporten.domain.AccessToken; | ||
import no.nav.testnav.mocks.maskinporten.domain.Arguments; | ||
import no.nav.testnav.mocks.maskinporten.service.JwtService; | ||
import org.springframework.http.MediaType; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
import reactor.core.publisher.Mono; | ||
|
||
@Slf4j | ||
@RestController | ||
@RequiredArgsConstructor | ||
@RequestMapping("/mock") | ||
public class MockController { | ||
|
||
private final JwtService service; | ||
|
||
@PostMapping( | ||
value = "/token", | ||
consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE, | ||
produces = MediaType.APPLICATION_JSON_VALUE | ||
) | ||
public Mono<AccessToken> getToken(Arguments arguments) { | ||
return Mono.just(service.createAccessToken(arguments.getAudience())); | ||
} | ||
|
||
} |
47 changes: 47 additions & 0 deletions
47
...ava/no/nav/testnav/mocks/maskinporten/controller/OauthAuthorizationServiceController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package no.nav.testnav.mocks.maskinporten.controller; | ||
|
||
|
||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import no.nav.testnav.mocks.maskinporten.domain.AccessToken; | ||
import no.nav.testnav.mocks.maskinporten.domain.Arguments; | ||
import no.nav.testnav.mocks.maskinporten.service.JwtService; | ||
import org.springframework.http.MediaType; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
import reactor.core.publisher.Mono; | ||
|
||
import static no.nav.testnav.mocks.maskinporten.MaskinportenMockApplicationStarter.Utils.loadJson; | ||
|
||
@Slf4j | ||
@RestController | ||
@RequiredArgsConstructor | ||
public class OauthAuthorizationServiceController { | ||
|
||
private static final String JWKS; | ||
private static final String WELL_KNOWN; | ||
|
||
static { | ||
JWKS = loadJson("static/jwks.json"); | ||
WELL_KNOWN = loadJson("static/well-known.json"); | ||
} | ||
|
||
private final JwtService jwtService; | ||
|
||
@GetMapping(value = "/jwks", produces = MediaType.APPLICATION_JSON_VALUE) | ||
public Mono<String> getJWKS() { | ||
return Mono.just(JWKS); | ||
} | ||
|
||
@GetMapping(value = "/.well-known/oauth-authorization-server", produces = MediaType.APPLICATION_JSON_VALUE) | ||
public Mono<String> getWellKnown() { | ||
return Mono.just(WELL_KNOWN); | ||
} | ||
|
||
@PostMapping(value = "/token", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) | ||
public Mono<AccessToken> createToken(Arguments arguments) { | ||
return Mono.just(jwtService.createAccessToken(arguments.getAudience())); | ||
} | ||
|
||
} |
2 changes: 1 addition & 1 deletion
2
...ks/tokendingsmock/domain/AccessToken.java → ...ocks/maskinporten/domain/AccessToken.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ocks/tokendingsmock/domain/Arguments.java → .../mocks/maskinporten/domain/Arguments.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 0 additions & 19 deletions
19
...src/main/java/no/nav/testnav/mocks/tokendingsmock/MaskinportenMockApplicationStarter.java
This file was deleted.
Oops, something went wrong.
27 changes: 0 additions & 27 deletions
27
...ten-mock/src/main/java/no/nav/testnav/mocks/tokendingsmock/controller/MockController.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.