Skip to content

Commit

Permalink
Arbeid pågår
Browse files Browse the repository at this point in the history
  • Loading branch information
krharum committed May 7, 2024
1 parent 190891a commit 09f45ef
Show file tree
Hide file tree
Showing 23 changed files with 880 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package no.nav.skattekortservice.config;

import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import no.nav.testnav.libs.securitycore.domain.ServerProperties;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

import static lombok.AccessLevel.PACKAGE;
@Configuration
@ConfigurationProperties(prefix = "consumers")
@NoArgsConstructor(access = PACKAGE)
@Getter
@Setter(PACKAGE)
public class Consumers {

private ServerProperties sokosSkattekort;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package no.nav.skattekortservice.consumer;

import no.nav.skattekortservice.config.Consumers;
import no.nav.testnav.libs.reactivesecurity.exchange.TokenService;
import no.nav.testnav.libs.securitycore.domain.ServerProperties;
import org.springframework.stereotype.Service;
import org.springframework.web.reactive.function.client.WebClient;

@Service
public class SokosSkattekortConsumer {

private WebClient webClient;
private TokenService tokenService;
private ServerProperties serverProperties;

public SokosSkattekortConsumer(TokenService tokenService, Consumers consumers) {

this.serverProperties = consumers.getSokosSkattekort();
this.webClient = WebClient.builder()
.baseUrl(serverProperties.getUrl())
.build();
this.tokenService = tokenService;
}


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package no.nav.skattekortservice.consumer.command;

import lombok.RequiredArgsConstructor;
import no.nav.skattekortservice.dto.SokosRequest;
import no.nav.skattekortservice.dto.SokosResponse;
import org.springframework.web.reactive.function.client.WebClient;
import reactor.core.publisher.Mono;

import java.util.concurrent.Callable;

@RequiredArgsConstructor
public class SokoPostCommand implements Callable<Mono<SokosResponse>> {

private final WebClient webClient;
private final SokosRequest request;
private final String token;

@Override
public Mono<SokosResponse> call() {

return webClient
.post()
.uri()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package no.nav.skattekortservice.dto;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.val;

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class SokosRequest {

private String fnr;
private Integer inntektsar;
private String skattekort;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package no.nav.skattekortservice.dto;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class SokosResponse {

private String fnr;
private Integer inntektsar;
private String status;
}
6 changes: 6 additions & 0 deletions apps/skattekort-service/src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,9 @@ server:
error:
include-message: always

consumers:
sokos-skattekort:
url: https://sokos-skattekort-dolly-{miljoe}.intern.dev.nav.no
cluster: dev-gcp
name: sokos-skattekort-dolly
namespace: okonomi
8 changes: 8 additions & 0 deletions proxies/skattekort-proxy/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM ghcr.io/navikt/baseimages/temurin:21
LABEL maintainer="Team Dolly"

ENV JAVA_OPTS="-Dspring.profiles.active=prod"

ADD /build/libs/app.jar /app/app.jar

EXPOSE 8080
72 changes: 72 additions & 0 deletions proxies/skattekort-proxy/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
plugins {
id 'java'
id "org.sonarqube" version "4.4.1.3373"
id 'org.springframework.boot' version "3.2.1"
id 'io.spring.dependency-management' version "1.1.4"
id "jacoco"
}

test {
useJUnitPlatform()
}

sonarqube {
properties {
property "sonar.dynamicAnalysis", "reuseReports"
property "sonar.host.url", "https://sonarcloud.io"
property "sonar.java.coveragePlugin", "jacoco"
property "sonar.language", "java"
property "sonar.token", System.getenv("SONAR_TOKEN")
property "sonar.organization", "navikt"
property "sonar.project.monorepo.enabled", true
property "sonar.projectKey", "testnav-saf-proxy"
property "sonar.projectName", "testnav-saf-proxy"
property "sonar.sourceEncoding", "UTF-8"
}
}
bootJar {
archiveFileName = "app.jar"
}

dependencyManagement {
applyMavenExclusions = false
imports {
mavenBom 'org.springframework.cloud:spring-cloud-dependencies:2023.0.0'
}
}

repositories {
mavenCentral()
mavenLocal()
}

dependencies {

implementation 'no.nav.testnav.libs:security-core'
implementation 'no.nav.testnav.libs:reactive-core'
implementation 'no.nav.testnav.libs:reactive-proxy'
implementation 'no.nav.testnav.libs:reactive-security'
implementation 'no.nav.testnav.libs:data-transfer-objects'

implementation 'org.springframework.boot:spring-boot-starter-oauth2-resource-server'
implementation 'org.springframework.boot:spring-boot-starter-webflux'

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.4'
implementation 'org.hibernate.validator:hibernate-validator'

testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.cloud:spring-cloud-contract-wiremock'

annotationProcessor 'org.projectlombok:lombok'
implementation 'org.projectlombok:lombok'
testAnnotationProcessor 'org.projectlombok:lombok'
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}
69 changes: 69 additions & 0 deletions proxies/skattekort-proxy/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
---
apiVersion: nais.io/v1
kind: AzureAdApplication
metadata:
name: testnav-saf-proxy-trygdeetaten
namespace: dolly
labels:
team: dolly
spec:
secretName: azure-trygdeetaten-testnav-saf-proxy-trygdeetaten
secretKeyPrefix: "AZURE_TRYGDEETATEN"
tenant: trygdeetaten.no
---
apiVersion: "nais.io/v1alpha1"
kind: "Application"
metadata:
name: testnav-saf-proxy
namespace: dolly
labels:
team: dolly
spec:
image: "{{image}}"
port: 8080
webproxy: true
tokenx:
enabled: true
azure:
application:
allowAllUsers: true
enabled: true
tenant: nav.no
accessPolicy:
inbound:
rules:
- application: team-dolly-lokal-app
cluster: dev-gcp
- application: testnav-oversikt-frontend
cluster: dev-gcp
- application: dolly-frontend-dev
cluster: dev-gcp
- application: dolly-frontend
cluster: dev-gcp
- application: dolly-idporten
cluster: dev-gcp
- application: testnav-joark-dokument-service
cluster: dev-gcp
liveness:
path: /internal/isAlive
initialDelay: 4
periodSeconds: 5
failureThreshold: 500
readiness:
path: /internal/isReady
initialDelay: 4
periodSeconds: 5
failureThreshold: 500
replicas:
min: 1
max: 1
resources:
requests:
cpu: 200m
memory: 1025Mi
limits:
memory: 2048Mi
envFrom:
- secret: azure-trygdeetaten-testnav-saf-proxy-trygdeetaten
ingresses:
- "https://testnav-saf-proxy.dev-fss-pub.nais.io"
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 09f45ef

Please sign in to comment.