Skip to content

Commit

Permalink
EPA-145: Update XML template for PU
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasrichner-oviva committed Oct 11, 2024
1 parent 1d711e6 commit 49d9de7
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,28 @@ public class RegistratonFormRenderer {
<?xml version="1.0" encoding="UTF-8"?>
<registrierungtifoederation>
<datendesantragstellers>
<vfsbestaetigung>{{vfsConfirmation}}</vfsbestaetigung>
<teilnehmertyp>Fachdienst</teilnehmertyp>
<organisationsname>{{organisationName}}</organisationsname>
<memberid>{{memberId}}</memberid>
<zwg>ORG-0001:BT-0144</zwg>
<issueruri>{{issuerUri}}</issueruri>
<scopes>
<scopealter>{{scopeAge}}</scopealter>
<scopeanzeigename>{{scopeDisplayName}}</scopeanzeigename>
<scopeemail>{{scopeEmail}}</scopeemail>
<scopegeschlecht>{{scopeGender}}</scopegeschlecht>
<scopegeburtsdatum>{{scopeDateOfBirth}}</scopegeburtsdatum>
<scopevorname>{{scopeFirstName}}</scopevorname>
<scopenachname>{{scopeLastName}}</scopenachname>
<scopeversicherter>{{scopeInsuredPerson}}</scopeversicherter>
</scopes>
{{#publicKeys}}
<publickeys>
<kidjwt>{{kid}}</kidjwt>
<pubkeyjwt>{{pem}}</pubkeyjwt>
<betriebsumgebung>{{environment}}</betriebsumgebung>
</publickeys>
{{/publicKeys}}
<vfsbestaetigung>{{vfsConfirmation}}</vfsbestaetigung>
<teilnehmertyp>Fachdienst</teilnehmertyp>
<organisationsname>{{organisationName}}</organisationsname>
<memberid>{{memberId}}</memberid>
<zwg>ORG-0229:BT-0170</zwg>
<issueruri>{{issuerUri}}</issueruri>
<scopes>
<scopealter>{{scopeAge}}</scopealter>
<scopeanzeigename>{{scopeDisplayName}}</scopeanzeigename>
<scopeemail>{{scopeEmail}}</scopeemail>
<scopegeschlecht>{{scopeGender}}</scopegeschlecht>
<scopegeburtsdatum>{{scopeDateOfBirth}}</scopegeburtsdatum>
<scopevorname>{{scopeFirstName}}</scopevorname>
<scopenachname>{{scopeLastName}}</scopenachname>
<scopeversicherter>{{scopeInsuredPerson}}</scopeversicherter>
</scopes>
{{#publicKeys}}
<publickeys>
<kidjwt>{{kid}}</kidjwt>
<pubkeyjwt>{{pem}}</pubkeyjwt>
</publickeys>
{{/publicKeys}}
</datendesantragstellers>
</registrierungtifoederation>
""";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.oviva.ehealthid.cli;

import static com.oviva.ehealthid.cli.RegistratonFormRenderer.Model.Environment.PU;
import static com.oviva.ehealthid.cli.RegistratonFormRenderer.Model.Environment.TU;
import static org.junit.jupiter.api.Assertions.assertEquals;

Expand All @@ -19,8 +20,54 @@

class RegistratonFormRendererTest {

@Test
void render_PU() throws JOSEException {
var key = getKey();
var xml =
RegistratonFormRenderer.render(
new Model(
"VFS_DiGA_Test",
"FDmyDiGAMemb",
"My DiGA",
"bobby.tables@example.com",
URI.create("https://mydiga.example.com"),
PU,
List.of(Scope.INSURED_PERSON, Scope.EMAIL, Scope.DISPLAY_NAME),
new JWKSet(key)));

assertEquals(
"""
<?xml version="1.0" encoding="UTF-8"?>
<registrierungtifoederation>
<datendesantragstellers>
<vfsbestaetigung>VFS_DiGA_Test</vfsbestaetigung>
<teilnehmertyp>Fachdienst</teilnehmertyp>
<organisationsname>My DiGA</organisationsname>
<memberid>FDmyDiGAMemb</memberid>
<zwg>ORG-0229:BT-0170</zwg>
<issueruri>https://mydiga.example.com</issueruri>
<scopes>
<scopealter>0</scopealter>
<scopeanzeigename>1</scopeanzeigename>
<scopeemail>1</scopeemail>
<scopegeschlecht>0</scopegeschlecht>
<scopegeburtsdatum>0</scopegeburtsdatum>
<scopevorname>0</scopevorname>
<scopenachname>0</scopenachname>
<scopeversicherter>1</scopeversicherter>
</scopes>
<publickeys>
<kidjwt>wXOS7cMWjpUGqySA-BwnbmiQSaaWBpEmy4xf08CHQXQ</kidjwt>
<pubkeyjwt>-----BEGIN PUBLIC KEY-----&#10;MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE2lFRaRRzJx0Tspr8nT526HTY0LCQ&#10;g8WJhXI+LNXvmjbYokHMfZzM9xerR/u+Y/q1VK9NSH2cbXfGAmT24gC4DQ&#61;&#61;&#10;-----END PUBLIC KEY-----&#10;</pubkeyjwt>
</publickeys>
</datendesantragstellers>
</registrierungtifoederation>
""",
xml);
}

@Test
void render() throws JOSEException {
void render_TU() throws JOSEException {
var key = getKey();
var xml =
RegistratonFormRenderer.render(
Expand Down Expand Up @@ -72,7 +119,7 @@ private ECKey getKey() throws JOSEException {
.keyUse(KeyUse.SIGNATURE)
.secureRandom(
new SecureRandom() {
private static final Random badRandom = new Random(0xBAD);
private final Random badRandom = new Random(0xBAD);

@Override
public void nextBytes(byte[] bytes) {
Expand Down

0 comments on commit 49d9de7

Please sign in to comment.