Skip to content

Commit

Permalink
EPA-81: Configurable User-Agent
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasrichner-oviva committed Apr 2, 2024
1 parent c9c2264 commit 771dca8
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ sequenceDiagram
* You should be able to write an example file in the test environment (RU).

## Normative Documents
- [Specifications ePA - 'Aktensystem ePA für alle'](https://gemspec.gematik.de/docs/gemSpec/gemSpec_Aktensystem_ePAfueralle/latest/)
- [DiGA Leitfaden, 3.5 Interoperabilität](https://www.bfarm.de/SharedDocs/Downloads/DE/Medizinprodukte/diga_leitfaden.html)
- [DiGA Anwendungssteckbrief](https://gemspec.gematik.de/docs/gemAnw/gemAnw_DiGA/latest/)
- [gematik/api-telematik](https://github.com/gematik/api-telematik/tree/OPB5)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public class KonnektorServiceBuilder {
private String mandantId = "m";
private String clientSystemId = "c";
private String userId = "admin";
private String userAgent = "DiGA-Lib-Test/0.0.1";

private KonnektorServiceBuilder() {}

Expand Down Expand Up @@ -44,6 +45,12 @@ public KonnektorServiceBuilder userId(String userId) {
return this;
}

/** user agent according to A_22470-05 */
public KonnektorServiceBuilder userAgent(String userAgent) {
this.userAgent = userAgent;
return this;
}

public KonnektorService build() {

if (connection == null) {
Expand All @@ -63,7 +70,7 @@ public KonnektorService build() {
}

var ctx = new KonnektorContext(mandantId, clientSystemId, workplaceId, userId);
var svc = new KonnektorServiceImpl(connection, ctx);
var svc = new KonnektorServiceImpl(userAgent, connection, ctx);
return new ExceptionMappedKonnektorService(svc);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,17 @@ public class KonnektorServiceImpl implements KonnektorService {
private static Logger log = LoggerFactory.getLogger(KonnektorServiceImpl.class);
private static final String REGISTRY_STATUS_SUCCESS =
"urn:oasis:names:tc:ebxml-regrep:ResponseStatusType:Success";
private final String userAgent; // A_22470-05
private final EventServiceClient eventServiceClient;
private final CardServiceClient cardServiceClient;
private final PhrManagementServiceClient phrManagementServiceClient;
private final PhrServiceClient phrServiceClient;

private final SmbInformationServiceClient smbInformationServiceClient;

public KonnektorServiceImpl(KonnektorConnection connection, KonnektorContext konnektorContext) {
public KonnektorServiceImpl(
String userAgent, KonnektorConnection connection, KonnektorContext konnektorContext) {
this.userAgent = userAgent;

eventServiceClient = new EventServiceClient(connection.eventService(), konnektorContext);

Expand All @@ -58,7 +61,8 @@ public KonnektorServiceImpl(KonnektorConnection connection, KonnektorContext kon
phrServiceClient = new PhrServiceClient(connection.phrService(), konnektorContext);

phrManagementServiceClient =
new PhrManagementServiceClient(connection.phrManagementService(), konnektorContext);
new PhrManagementServiceClient(
connection.phrManagementService(), konnektorContext, userAgent);

var certificateServiceClient =
new CertificateServiceClient(connection.certificateService(), konnektorContext);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,22 @@ public class PhrManagementServiceClient {
private final PHRManagementServicePortType phrManagementService;
private final KonnektorContext konnektorContext;

private final String userAgent;

/**
* @param phrManagementService
* @param konnektorContext
* @param userAgent <a
* href="https://gemspec.gematik.de/docs/gemSpec/gemSpec_Aktensystem_ePAfueralle/latest/#2.7">A_22470-04
* - Definition Useragent</a>
*/
public PhrManagementServiceClient(
PHRManagementServicePortType phrManagementService, KonnektorContext konnektorContext) {
PHRManagementServicePortType phrManagementService,
KonnektorContext konnektorContext,
String userAgent) {
this.phrManagementService = phrManagementService;
this.konnektorContext = konnektorContext;
this.userAgent = userAgent;
}

public GetAuthorizationStateResponse getAuthorizationState(String knvr, String homeCommunityId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ class KonnektorServiceAcceptanceTest {
private static final String KVNR = "X110467329";

private static final String FAKE_KVNR = "A123456780";

// A_22470-05
// https://gemspec.gematik.de/docs/gemSpec/gemSpec_Aktensystem_ePAfueralle/latest/#2.7
private static final String USER_AGENT = "TEST/0.0.1";
private static final String TI_KONNEKTOR_URI = "https://10.156.145.103:443";
private static final String PROXY_ADDRESS = "127.0.0.1";
private static final String KEYSTORE_FILE = "keys/vKon_Client_172.026.002.035.p12";
Expand Down Expand Up @@ -192,6 +196,7 @@ private KonnektorService buildService() throws Exception {
.clientSystemId(CLIENT_SYSTEM_ID)
.mandantId(MANDANT_ID)
.userId(USER_ID)
.userAgent(USER_AGENT)
.build();
}

Expand Down

0 comments on commit 771dca8

Please sign in to comment.