Skip to content

Commit

Permalink
Fixes openemr#7019 operation name export operation (openemr#7020)
Browse files Browse the repository at this point in the history
Fixes the export operation name to be 'export' which is the expected
name coming from the OperationDefinition.code property for the $export
operation for Patient/Group/System export.

Also added a few more debug logs to the json key stuff to help with
debugging.
  • Loading branch information
adunsulag authored Nov 14, 2023
1 parent 4ca1b35 commit 52befd1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/Common/Auth/OpenIDConnect/JWT/JsonWebKeySet.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public function __construct(ClientInterface $httpClient, $jwks_uri = null, $jwks
*/
public function getJSONWebKey($kid, $alg)
{
$this->logger->debug("Attempting to find web key for kid & alg", ['kid' => $kid, 'alg' => $alg]);
$this->logger->debug("JsonWebKeySet::getJSONWebKey() Attempting to find web key for kid & alg", ['kid' => $kid, 'alg' => $alg]);
foreach ($this->jwks as $key) {
if ($key->kty === 'RSA') {
if (!isset($kid) || $key->kid === $kid) {
Expand Down
2 changes: 1 addition & 1 deletion src/Common/Auth/OpenIDConnect/JWT/RsaSha384Signer.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public function verify($expected, $payload, $key): bool

if ($key instanceof JsonWebKeySet) {
$kid = $this->headers['kid'] ?? null;
$this->logger->debug("RsaSha384Signer->verify() attempting to retrieve jwk");
$this->logger->debug("RsaSha384Signer->verify() attempting to retrieve jwk", ['kid' => $kid]);
$jwk = $key->getJSONWebKey($kid, $this->algorithmId());
} else {
$key = $key instanceof Key ? $key->contents() : $key;
Expand Down
12 changes: 7 additions & 5 deletions src/RestControllers/RestControllerHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -278,15 +278,17 @@ public function addOperations($resource, $items, FHIRCapabilityStatementResource
}

if ($operation == '$export') {
// operation definition must use the operation 'name'
// rest.resource.operation.name must come from the OperationDefinition's code attribute which in this case is 'export'
$definitionName = 'export';
$operationName = 'export';
if ($resource != '$export') {
$operationName = strtolower($resource) . '-export';
} else {
$operationName = 'export';
$definitionName = strtolower($resource) . '-export';
}
// define export operation
$fhirOperation = new FHIRCapabilityStatementOperation();
$fhirOperation->setName($operation);
$fhirOperation->setDefinition(new FHIRCanonical('http://hl7.org/fhir/uv/bulkdata/OperationDefinition/' . $operationName));
$fhirOperation->setName($operationName);
$fhirOperation->setDefinition(new FHIRCanonical('http://hl7.org/fhir/uv/bulkdata/OperationDefinition/' . $definitionName));
$capResource->addOperation($fhirOperation);
} else if ($operation === '$bulkdata-status') {
$fhirOperation = new FHIRCapabilityStatementOperation();
Expand Down

0 comments on commit 52befd1

Please sign in to comment.