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

Endret urlen til veilarbperson for å går mot gcp versjonen #193

Merged
merged 2 commits into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .nais/application/application-config-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,21 @@ spec:
rules:
- application: poao-tilgang
namespace: poao
- application: veilarbperson
namespace: obo
external:
- host: pdl-api.dev-fss-pub.nais.io
- host: norg2.dev-fss-pub.nais.io
- host: oppgave-q1.dev-fss-pub.nais.io
- host: veilarbperson.dev-fss-pub.nais.io
env:
- name: POAO_TILGANG_URL
value: http://poao-tilgang.poao
- name: POAO_TILGANG_SCOPE
value: api://dev-gcp.poao.poao-tilgang/.default
- name: VEILARBPERSON_URL
value: http://veilarbperson.obo
- name: VEILARBPERSON_SCOPE
value: api://dev-gcp.obo.veilarbperson/.default
prometheus:
enabled: true
path: veilarboppgave/internal/prometheus
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,4 @@ public PoaoTilgangClient poaoTilgangClient(EnvironmentProperties properties, Azu
norskIdentToErSkjermetCache
);
}


}
16 changes: 6 additions & 10 deletions src/main/java/no/nav/veilarboppgave/config/ClientConfig.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package no.nav.veilarboppgave.config;

import no.nav.common.auth.context.AuthContextHolder;
import no.nav.common.client.aktoroppslag.AktorOppslagClient;
import no.nav.common.client.aktoroppslag.CachedAktorOppslagClient;
import no.nav.common.client.aktoroppslag.PdlAktorOppslagClient;
import no.nav.common.client.norg2.CachedNorg2Client;
import no.nav.common.client.norg2.Norg2Client;
import no.nav.common.client.norg2.NorgHttp2Client;
import no.nav.common.token_client.client.AzureAdOnBehalfOfTokenClient;
import no.nav.common.token_client.client.MachineToMachineTokenClient;
import no.nav.common.utils.EnvironmentUtils;
import no.nav.veilarboppgave.client.norg2.Norg2ArbeidsfordelingClient;
Expand All @@ -21,7 +23,6 @@
import java.util.function.Supplier;

import static no.nav.veilarboppgave.config.DownstreamApis.downstreamOppgave;
import static no.nav.veilarboppgave.config.DownstreamApis.downstreamVeilarbperson;

@Configuration
public class ClientConfig {
Expand Down Expand Up @@ -72,16 +73,11 @@ public OppgaveClient oppgaveClient(ContextAwareService contextAwareService) {
}

@Bean
public VeilarbpersonClient veilarbpersonClient(ContextAwareService contextAwareService) {
String safCluster = isProduction() ? "prod-fss" : "dev-fss";
Supplier<String> userTokenSupplier = contextAwareService.contextAwareUserTokenSupplier(
downstreamVeilarbperson(safCluster)
public VeilarbpersonClient veilarbpersonClient(EnvironmentProperties properties, AzureAdOnBehalfOfTokenClient tokenClient, AuthContextHolder authContextHolder) {
return new VeilarbpersonClientImpl(
properties.getVeilarbpersonUrl(),
() -> tokenClient.exchangeOnBehalfOfToken(properties.getVeilarbpersonScope(), authContextHolder.requireIdTokenString())
);
String url = EnvironmentUtils.isDevelopment().orElse(false)
? "https://veilarbperson.dev-fss-pub.nais.io/veilarbperson"
: "https://veilarbperson.prod-fss-pub.nais.io/veilarbperson";

return new VeilarbpersonClientImpl(url, userTokenSupplier);
}

private static boolean isProduction() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
import no.nav.veilarboppgave.util.DownstreamApi;

public class DownstreamApis {
public static DownstreamApi downstreamVeilarbperson(String cluster){
return new DownstreamApi(cluster, "pto", "veilarbperson");
}

public static DownstreamApi downstreamOppgave(String cluster){
return new DownstreamApi(cluster, "oppgavehandtering", ("dev-fss".equals(cluster)) ? "oppgave-q1" : "oppgave");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,8 @@ public class EnvironmentProperties {

private String poaoTilgangScope;

private String veilarbpersonUrl;

private String veilarbpersonScope;

}
2 changes: 2 additions & 0 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,7 @@ app.env.naisAadClientId=${AZURE_APP_CLIENT_ID:null}
app.env.naisAadIssuer=${AZURE_OPENID_CONFIG_ISSUER:null}
app.env.poaoTilgangUrl=${POAO_TILGANG_URL:#{null}}
app.env.poaoTilgangScope=${POAO_TILGANG_SCOPE:#{null}}
app.env.veilarbpersonUrl=${VEILARBPERSON_URL:#{null}}
app.env.veilarbpersonScope=${VEILARBPERSON_SCOPE:#{null}}

app.env.dbUrl=${DB_JDBC_URL}