Skip to content

Commit

Permalink
Byttet ingressen til kilde representasjonen for å hente fullmakt
Browse files Browse the repository at this point in the history
  • Loading branch information
sneha-d-desai committed Nov 6, 2024
1 parent 61f11e0 commit 5f89662
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
7 changes: 4 additions & 3 deletions nais-dev-gcp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,10 @@ spec:
namespace: org
- application: veilarboppfolging
namespace: poao
- application: repr-api
namespace: repr
external:
- host: pdl-api.dev-fss-pub.nais.io
- host: pdl-fullmakt.dev-fss-pub.nais.io
- host: regoppslag.dev-fss-pub.nais.io
- host: pam-cv-api-gcp.intern.dev.nav.no
env:
Expand All @@ -94,9 +95,9 @@ spec:
- name: PAM_CV_API_URL
value: https://pam-cv-api-gcp.intern.dev.nav.no/pam-cv-api
- name: REPR_API_SCOPE
value: api://dev-fss.pdl.pdl-fullmakt/.default
value: api://dev-gcp.repr.repr-api/.default
- name: REPR_API_URL
value: https://pdl-fullmakt.dev-fss-pub.nais.io
value: http://repr-api.repr
- name: PDL_API_SCOPE
value: api://dev-fss.pdl.pdl-api/.default
- name: PDL_API_URL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import java.util.List;

public interface RepresentasjonClient {
List<ReprFullmaktData.Fullmakt> hentFullmakt(String kryptertIdent) throws IOException;
List<ReprFullmaktData.Fullmakt> hentFullmakt(String personIdent) throws IOException;
}

@Data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ public RepresentasjonClientImpl(String reprUrl, Supplier<String> userTokenProvid
this.userTokenProvider = userTokenProvider;
}

public List<ReprFullmaktData.Fullmakt> hentFullmakt(String kryptertIdent) throws IOException {
public List<ReprFullmaktData.Fullmakt> hentFullmakt(String personIdent) throws IOException {
Request request = new Request.Builder()
.url(joinPaths(reprUrl, "/api/internbruker/fullmaktsgiver"))
.url(joinPaths(reprUrl, "/api/internbruker/fullmakt/fullmaktsgiver"))
.header(ACCEPT, APPLICATION_JSON_VALUE)
.header(AUTHORIZATION, createBearerToken(userTokenProvider.get()))
.post(RestUtils.toJsonRequestBody(new PersonIdentDTO(kryptertIdent)))
.post(RestUtils.toJsonRequestBody(new PersonIdentDTO(personIdent)))
.build();

try (Response response = client.newCall(request).execute()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,8 +324,7 @@ public VergeData hentVerge(PersonFraPdlRequest personFraPdlRequest) {
}

public FullmaktDTO hentFullmakt(PersonRequest personRequest) throws IOException {
String encryptertIdent = Base64.getEncoder().encodeToString(personRequest.getFnr().get().getBytes());
List<ReprFullmaktData.Fullmakt> fullmaktListe = representasjonClient.hentFullmakt(encryptertIdent);
List<ReprFullmaktData.Fullmakt> fullmaktListe = representasjonClient.hentFullmakt(personRequest.getFnr().get());
if (fullmaktListe.isEmpty()) {
throw new ResponseStatusException(HttpStatus.NO_CONTENT, "Person har ikke fullmakt i representasjon");
}
Expand Down

0 comments on commit 5f89662

Please sign in to comment.