-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implementation of IHE SeR and CH:ADR profiles; closes #424
- Loading branch information
Showing
49 changed files
with
2,177 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
85 changes: 85 additions & 0 deletions
85
...impl/src/main/groovy/org/openehealth/ipf/commons/ihe/xacml20/Xacml20MessageCreator.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
/* | ||
* Copyright 2023 the original author or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.openehealth.ipf.commons.ihe.xacml20 | ||
|
||
import org.apache.commons.lang3.Validate | ||
import org.openehealth.ipf.commons.ihe.xacml20.model.PpqConstants | ||
import org.openehealth.ipf.commons.ihe.xacml20.stub.hl7v3.ObjectFactory | ||
import org.openehealth.ipf.commons.ihe.xacml20.stub.saml20.assertion.AssertionType | ||
import org.openehealth.ipf.commons.ihe.xacml20.stub.saml20.assertion.NameIDType | ||
import org.openehealth.ipf.commons.ihe.xacml20.stub.saml20.protocol.ResponseType | ||
import org.openehealth.ipf.commons.ihe.xacml20.stub.saml20.protocol.StatusCodeType | ||
import org.openehealth.ipf.commons.ihe.xacml20.stub.saml20.protocol.StatusType | ||
|
||
import javax.xml.datatype.DatatypeFactory | ||
|
||
/** | ||
* @author Dmytro Rud | ||
* @since 4.8.0 | ||
*/ | ||
class Xacml20MessageCreator { | ||
|
||
protected static final ObjectFactory HL7V3_OBJECT_FACTORY = new ObjectFactory() | ||
protected static final org.herasaf.xacml.core.context.impl.ObjectFactory XACML_CONTEXT_OBJECT_FACTORY = new org.herasaf.xacml.core.context.impl.ObjectFactory() | ||
protected static final org.herasaf.xacml.core.policy.impl.ObjectFactory XACML_POLICY_OBJECT_FACTORY = new org.herasaf.xacml.core.policy.impl.ObjectFactory() | ||
protected static final DatatypeFactory XML_OBJECT_FACTORY = DatatypeFactory.newInstance() | ||
|
||
private final String homeCommunityId | ||
|
||
Xacml20MessageCreator(String homeCommunityId) { | ||
this.homeCommunityId = Validate.notEmpty(homeCommunityId as String, 'Home community ID shall be provided') | ||
} | ||
|
||
NameIDType createIssuer() { | ||
return new NameIDType( | ||
nameQualifier: PpqConstants.NAME_QUALIFIER_EHEALTH_SUISSSE_COMMUNITY_INDEX, | ||
value: homeCommunityId, | ||
) | ||
} | ||
|
||
AssertionType createAssertion() { | ||
return new AssertionType( | ||
ID: '_' + UUID.randomUUID(), | ||
issueInstant: XML_OBJECT_FACTORY.newXMLGregorianCalendar(new GregorianCalendar()), | ||
version: '2.0', | ||
issuer: createIssuer(), | ||
) | ||
} | ||
|
||
protected static ResponseType createResponse(Xacml20Status status, String statusMessage, AssertionType assertion) { | ||
return new ResponseType( | ||
ID: '_' + UUID.randomUUID(), | ||
issueInstant: XML_OBJECT_FACTORY.newXMLGregorianCalendar(new GregorianCalendar()), | ||
version: '2.0', | ||
status: new StatusType( | ||
statusCode: new StatusCodeType(value: status.code), | ||
statusMessage: statusMessage, | ||
), | ||
assertionOrEncryptedAssertion: [assertion], | ||
) | ||
} | ||
|
||
ResponseType createNegativeQueryResponse(Xacml20Status status, String statusMessage) { | ||
return createResponse(status, statusMessage, createAssertion()) | ||
} | ||
|
||
ResponseType createNegativeQueryResponse(Exception exception) { | ||
return (exception instanceof Xacml20Exception) | ||
? createNegativeQueryResponse(exception.status, exception.message) | ||
: createNegativeQueryResponse(Xacml20Status.RESPONDER_ERROR, exception.message) | ||
} | ||
|
||
} |
70 changes: 70 additions & 0 deletions
70
commons/ihe/xacml20/impl/src/main/java/org/openehealth/ipf/commons/ihe/xacml20/CH_ADR.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/* | ||
* Copyright 2023 the original author or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.openehealth.ipf.commons.ihe.xacml20; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import org.openehealth.ipf.commons.ihe.core.IntegrationProfile; | ||
import org.openehealth.ipf.commons.ihe.core.InteractionId; | ||
import org.openehealth.ipf.commons.ihe.ws.WsInteractionId; | ||
import org.openehealth.ipf.commons.ihe.ws.WsTransactionConfiguration; | ||
import org.openehealth.ipf.commons.ihe.xacml20.chadr.ChAdrAuditDataset; | ||
import org.openehealth.ipf.commons.ihe.xacml20.chadr.ChAdrAuditStrategy; | ||
import org.openehealth.ipf.commons.ihe.xacml20.chadr.ChAdrPortType; | ||
|
||
import javax.xml.namespace.QName; | ||
import java.util.Arrays; | ||
import java.util.List; | ||
|
||
/** | ||
* Definitions for the Swiss national profile "Authorization Decision Request" (CH:ADR). | ||
* | ||
* @author Dmytro Rud | ||
* @since 4.8.0 | ||
*/ | ||
public class CH_ADR implements IntegrationProfile { | ||
|
||
@AllArgsConstructor | ||
public enum Interactions implements WsInteractionId<WsTransactionConfiguration<ChAdrAuditDataset>> { | ||
CH_ADR(CH_ADR_WS_CONFIG); | ||
|
||
@Getter | ||
private final WsTransactionConfiguration<ChAdrAuditDataset> wsTransactionConfiguration; | ||
} | ||
|
||
@Override | ||
public List<InteractionId> getInteractionIds() { | ||
return Arrays.asList(Interactions.values()); | ||
} | ||
|
||
private final static WsTransactionConfiguration<ChAdrAuditDataset> CH_ADR_WS_CONFIG = new WsTransactionConfiguration<>( | ||
"ch-adr", | ||
"Authorization Decisions Query", | ||
true, | ||
new ChAdrAuditStrategy(false), | ||
new ChAdrAuditStrategy(true), | ||
new QName("urn:ihe:iti:2014:ser", "AuthorizationDecisionsManager_Service"), | ||
ChAdrPortType.class, | ||
new QName("urn:ihe:iti:2014:ser", "AuthorizationDecisionsManager_Port_Soap12"), | ||
false, | ||
"wsdl/ch-adr.wsdl", | ||
true, | ||
false, | ||
false, | ||
false); | ||
|
||
|
||
} |
69 changes: 69 additions & 0 deletions
69
commons/ihe/xacml20/impl/src/main/java/org/openehealth/ipf/commons/ihe/xacml20/SER.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/* | ||
* Copyright 2023 the original author or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.openehealth.ipf.commons.ihe.xacml20; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import org.openehealth.ipf.commons.ihe.core.IntegrationProfile; | ||
import org.openehealth.ipf.commons.ihe.core.InteractionId; | ||
import org.openehealth.ipf.commons.ihe.ws.WsInteractionId; | ||
import org.openehealth.ipf.commons.ihe.ws.WsTransactionConfiguration; | ||
import org.openehealth.ipf.commons.ihe.xacml20.iti79.Iti79AuditDataset; | ||
import org.openehealth.ipf.commons.ihe.xacml20.iti79.Iti79AuditStrategy; | ||
import org.openehealth.ipf.commons.ihe.xacml20.iti79.Iti79PortType; | ||
|
||
import javax.xml.namespace.QName; | ||
import java.util.Arrays; | ||
import java.util.List; | ||
|
||
/** | ||
* Definitions for the IHE integration profile "Secure Retrieve" (SeR). | ||
* | ||
* @author Dmytro Rud | ||
* @since 4.8.0 | ||
*/ | ||
public class SER implements IntegrationProfile { | ||
|
||
@AllArgsConstructor | ||
public enum Interactions implements WsInteractionId<WsTransactionConfiguration<Iti79AuditDataset>> { | ||
ITI_79(ITI_79_WS_CONFIG); | ||
|
||
@Getter | ||
private final WsTransactionConfiguration<Iti79AuditDataset> wsTransactionConfiguration; | ||
} | ||
|
||
@Override | ||
public List<InteractionId> getInteractionIds() { | ||
return Arrays.asList(Interactions.values()); | ||
} | ||
|
||
private final static WsTransactionConfiguration<Iti79AuditDataset> ITI_79_WS_CONFIG = new WsTransactionConfiguration<>( | ||
"ser-iti79", | ||
"Authorization Decisions Query", | ||
true, | ||
new Iti79AuditStrategy(false), | ||
new Iti79AuditStrategy(true), | ||
new QName("urn:ihe:iti:2014:ser", "AuthorizationDecisionsManager_Service"), | ||
Iti79PortType.class, | ||
new QName("urn:ihe:iti:2014:ser", "AuthorizationDecisionsManager_Port_Soap12"), | ||
false, | ||
"wsdl/iti79.wsdl", | ||
true, | ||
false, | ||
true, | ||
false); | ||
|
||
} |
Oops, something went wrong.