Skip to content

Commit

Permalink
fått ordnet sikkerheten
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrea-Devold-Fjeld committed Jul 22, 2024
2 parents 2ee48da + 0f0a16e commit 07d3967
Show file tree
Hide file tree
Showing 20 changed files with 48 additions and 28 deletions.
2 changes: 2 additions & 0 deletions apps/kodeverk-service/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ spec:
- application: testnav-oversikt-frontend
- application: testnav-pdl-forvalter
- application: testnav-pdl-forvalter-dev
- application: testnav-levende-arbeidsforhold-ansettelse
cluster: dev-gcp
outbound:
external:
- host: kodeverk-api.nav.no
Expand Down
6 changes: 6 additions & 0 deletions apps/levende-arbeidsforhold-ansettelse/TODO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

### TODO liste
1. Admin siden og deploye front-end
2. Lag slik at man kan kjøre jobben så ofte som behøves
3. Rydde og gjøre koden mer leselig
4. Hvis vi får tid kanskje skrive om slik at vi bruker flux (async) istedenfor mono.
8 changes: 5 additions & 3 deletions apps/levende-arbeidsforhold-ansettelse/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ spec:
outbound:
external:
- host: testnav-aareg-proxy.dev-fss-pub.nais.io
rules:
- application: testnav-levende-arbeidsforhold-ansettelse
cluster: dev-gcp
- host: testnav-pdl-proxy.dev-fss-pub.nais.io
- host: testnav-organisasjon-faste-data-service.intern.dev.nav.no
- host: testnav-kodeverk-service.intern.dev.nav.no
azure:
application:
allowAllUsers: true
Expand Down Expand Up @@ -48,6 +48,8 @@ spec:
memory: 1024Mi
limits:
memory: 2048Mi
envFrom:
- secret: google-sql-testnav-levende-arbeidsforhold-ansettelse
ingresses:
- "https://testnav-levende-arbeidsforhold-ansettelse.intern.dev.nav.no"
gcp:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ public AaregConsumer(
ObjectMapper objectMapper) {

this.serverProperties = consumers.getTestnavAaregProxy();
log.info("serverProperties: {}", serverProperties) ;
this.tokenExchange = tokenExchange;

ExchangeStrategies jacksonStrategy = ExchangeStrategies
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ public KodeverkServiceConsumer(
Consumers consumers,
TokenExchange tokenExchange) {
serverProperties = consumers.getTestnavKodeverkService();
log.info("ServerProperties: {}", serverProperties);
ExchangeStrategies exchangeStrategies = ExchangeStrategies.builder()
.codecs(configurer -> configurer.defaultCodecs().maxInMemorySize(16 * 1024 * 1024))
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ public OrganisasjonFasteDataConsumer(
Consumers consumers,
TokenExchange tokenExchange) {
serverProperties = consumers.getTestnavOrganisasjonFasteDataService();
log.info("ServerProperties: {}", serverProperties);
this.webClient = WebClient
.builder()
.baseUrl(serverProperties.getUrl())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ public ResponseEntity<JobbParameterEntity> lagParameter(@RequestParam JobbParame
jobbService.lagreParameter(jobbParameterEntity);
return ResponseEntity.ok(jobbParameterEntity);
}

@GetMapping("/verdi/{parameterNavn}")
public List<VerdierEntity> hentVerdier(@PathVariable("parameterNavn") String parameternavn) {
return jobbService.hentAlleMedNavn(parameternavn);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public class JobbParameterEntity implements Serializable {
private String verdi;

@OneToMany(mappedBy = "jobbParameterEntity")
private Collection<VerdierEntity> verdier = new ArrayList<>();
private final Collection<VerdierEntity> verdier = new ArrayList<>();
// Getters and Setters
public String toString(){
return "navn: " + navn + " tekst: " + tekst + " verdi: " +verdi;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ public class VerdierEntity implements Serializable {
@ManyToOne(fetch = FetchType.LAZY)
private JobbParameterEntity jobbParameterEntity;
@Id
@Column(name = "ID")
@GeneratedValue
@Column(name = "ID")
private int id;

@JoinColumn(name = "NAVN")
private String navn;

Expand All @@ -32,5 +33,3 @@ public String toString(){
return navn+", "+verdi ;
}
}


Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,18 @@ public void ansettelseService() {
return;
}

//Map<String, String> parametere = hentParametere();
//List<OrganisasjonDTO> organisasjoner = hentOrganisasjoner(Integer.parseInt(parametere.get("antallOrganisasjoner")));
Map<String, String> parametere = hentParametere();
List<OrganisasjonDTO> organisasjoner = hentOrganisasjoner(Integer.parseInt(parametere.get("antallOrganisasjoner")));

List<OrganisasjonDTO> organisasjoner = hentOrganisasjoner(dbParametere.get("antallOrg"));
//List<OrganisasjonDTO> organisasjoner = hentOrganisasjoner(dbParametere.get("antallOrg"));
if (organisasjoner.isEmpty()) {
return;
}
int antallPersPerOrg = 0;

try {
//antallPersPerOrg = getAntallAnsettelserHverOrg(Integer.parseInt(parametere.get("antallPersoner")), Integer.parseInt(parametere.get("antallOrganisasjoner")));
antallPersPerOrg = getAntallAnsettelserHverOrg(dbParametere.get("antallPers"), dbParametere.get("antallOrg"));
antallPersPerOrg = getAntallAnsettelserHverOrg(Integer.parseInt(parametere.get("antallPersoner")), Integer.parseInt(parametere.get("antallOrganisasjoner")));
//antallPersPerOrg = getAntallAnsettelserHverOrg(dbParametere.get("antallPers"), dbParametere.get("antallOrg"));
} catch (NumberFormatException e) {
log.error("Feil format på verdi");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public void testDb() {
log.info("test");
jobbService.hentAlleParametere();
jobbService.updateVerdi(JobbParameterEntity.builder().navn("antallOrganisasjoner").verdi("50").build());
jobbService.hentAlleParametere();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,15 @@ export enum ArbeidKodeverk {
Skipstyper = 'Skipstyper',
Fartsomraader = 'Fartsområder',
Valutaer = 'Valutaer',
}
}

gcp:
sqlInstances:
- type: POSTGRES_14
name: testnav-levende-arbeidsforhold-ansettelse
databases:
- name: ansettelse-jobber
autoBackupHour: 3 #Lager backup av hele SQL instancen hver dag kl 03:00
tier: db-f1-micro
diskAutoresize: true #Kanskje ikke nødvendig?
#collation: DESC
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,3 @@ spring:
properties:
hibernate:
dialect: org.hibernate.dialect.H2Dialect

testnav:
config:
hosts:
- localhost
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ spring:
datasource:
url: jdbc:postgresql://${NAIS_DATABASE_TESTNAV_LEVENDE_ARBEIDSFORHOLD_ANSETTELSE_LEVENDE_ARBEIDSFORHOLD_DB_HOST}:${NAIS_DATABASE_TESTNAV_LEVENDE_ARBEIDSFORHOLD_ANSETTELSE_LEVENDE_ARBEIDSFORHOLD_DB_PORT}/${NAIS_DATABASE_TESTNAV_LEVENDE_ARBEIDSFORHOLD_ANSETTELSE_LEVENDE_ARBEIDSFORHOLD_DB_DATABASE}?user=${NAIS_DATABASE_TESTNAV_LEVENDE_ARBEIDSFORHOLD_ANSETTELSE_LEVENDE_ARBEIDSFORHOLD_DB_USERNAME}&password=${NAIS_DATABASE_TESTNAV_LEVENDE_ARBEIDSFORHOLD_ANSETTELSE_LEVENDE_ARBEIDSFORHOLD_DB_PASSWORD}
driverClassName: org.postgresql.Driver
hikari:
maximum-pool-size: 3
minimum-idle: 0
jpa:
database: POSTGRESQL
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ spring:
application:
name: testnav-levende-arbeidsforhold-ansettelse
version: application.version.todo #TODO Finn ut hvordan denne kan settes fra Gradle
description: App for å hente PDL personer.
description: App for å ansette personer i en organisasjon
security:
oauth2:
resourceserver:
Expand All @@ -21,6 +21,7 @@ springdoc:
swagger-ui:
disable-swagger-default-url: true
url: /v3/api-docs

management:
endpoints:
enabled-by-default: true
Expand Down Expand Up @@ -70,3 +71,4 @@ consumers:
name: testnav-kodeverk-service
cluster: dev-gcp
namespace: dolly

Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ CREATE TABLE jobb_parameter (
);

create table verdier (
verdi_navn varchar(255) PRIMARY KEY ,
verdi_verdi varchar(255) PRIMARY KEY ,
ID INT AUTO_INCREMENT PRIMARY KEY ,
verdi_navn varchar(255) ,
verdi_verdi varchar(255) ,
foreign key (verdi_navn) references jobb_parameter(NAVN)
)
/*
Expand Down
2 changes: 2 additions & 0 deletions apps/organisasjon-faste-data-service/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ spec:
- application: testnav-synt-vedtakshistorikk-service
- application: testnorge-statisk-data-forvalter
cluster: dev-fss
- application: testnav-levende-arbeidsforhold-ansettelse
cluster: dev-gcp
outbound:
rules:
- application: organisasjon-bestilling-service
Expand Down
2 changes: 2 additions & 0 deletions proxies/aareg-proxy/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ spec:
cluster: dev-gcp
- application: testnorge-statisk-data-forvalter
cluster: dev-fss
- application: testnav-levende-arbeidsforhold-ansettelse
cluster: dev-gcp
liveness:
path: /internal/isAlive
initialDelay: 4
Expand Down
2 changes: 2 additions & 0 deletions proxies/ereg-proxy/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ spec:
cluster: dev-gcp
- application: testnav-organisasjon-service
cluster: dev-gcp
- application: testnav-levende-arbeidsforhold-ansettelse
cluster: dev-gcp
liveness:
path: /internal/isAlive
initialDelay: 4
Expand Down
2 changes: 2 additions & 0 deletions proxies/pdl-proxy/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ spec:
cluster: dev-gcp
- application: testnav-tenor-search-service
cluster: dev-gcp
- application: testnav-levende-arbeidsforhold-ansettelse
cluster: dev-gcp
outbound:
rules:
- application: pdl-testdata
Expand Down

0 comments on commit 07d3967

Please sign in to comment.