Anropsexempel
Exempel som visar hur REST- och SOAP-anrop kan se ut, inklusive hur säkerhetsintyg och systeminformation anges.
Exempel Saml2:Assertion
Exempel på Saml2:Assertion som används för behörighetsroller för vård- eller apotekspersonal.
<saml2:Assertion xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion" xmlns:xs="http://www.w3.org/2001/XMLSchema" IssueInstant="..." Version="2.0" ID="...">
<saml2:Issuer>https://idp.example.com/</saml2:Issuer>
<ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:SignedInfo>
<ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
<ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
<ds:Reference URI="#_1ce9793a30d0341be4910c1c46f6bba2">
<ds:Transforms>
<ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
<ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
<ec:InclusiveNamespaces PrefixList="xs" xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#"/>
</ds:Transform>
</ds:Transforms>
<ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
<ds:DigestValue>...</ds:DigestValue>
</ds:Reference>
</ds:SignedInfo>
<ds:SignatureValue>...</ds:SignatureValue>
<ds:KeyInfo>
<ds:KeyValue>
<ds:RSAKeyValue>
<ds:Modulus>...</ds:Modulus>
<ds:Exponent>AQAB</ds:Exponent>
</ds:RSAKeyValue>
</ds:KeyValue>
<ds:X509Data>
<ds:X509Certificate>Base64 krypterat certifikat...</ds:X509Certificate>
</ds:X509Data>
</ds:KeyInfo>
</ds:Signature>
<saml2:Subject>
<saml2:NameID Format="urn:oasis:names:tc:SAML:2.0:nameid-format:transient" NameQualifier="http://www.ehalsomyndigheten.se">...</saml2:NameID>
</saml2:Subject>
<saml2:Conditions NotBefore="2017-04-13T07:32:23.763Z" NotOnOrAfter="2017-04-13T08:22:23.763Z">
<saml2:AudienceRestriction>
<saml2:Audience>https://sp.example.se/</saml2:Audience>
</saml2:AudienceRestriction>
</saml2:Conditions>
<saml2:AuthnStatement AuthnInstant="2017-04-13T07:37:23.764Z">
<saml2:AuthnContext>
<saml2:AuthnContextClassRef>http://id.sambi.se/loa/loa3</saml2:AuthnContextClassRef>
</saml2:AuthnContext>
</saml2:AuthnStatement>
<saml2:AttributeStatement>
<saml2:Attribute FriendlyName="professionalLicence" Name="http://sambi.se/attributes/1/professionalLicence" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri">
<saml2:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string">LK</saml2:AttributeValue>
</saml2:Attribute>
<saml2:Attribute FriendlyName="personalPrescriptionCode" Name="http://sambi.se/attributes/1/personalPrescriptionCode" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri">
<saml2:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string">1234567</saml2:AttributeValue>
</saml2:Attribute>
</saml2:AttributeStatement>
</saml2:Assertion>
Exempel Saml2:Response
Exempel på Saml2:Response som används för behörighetsroll Privatperson.
<saml2p:Response xmlns:saml2p="urn:oasis:names:tc:SAML:2.0:protocol"IssueInstant="..." Version="2.0" ID="..." >
<saml2:Issuer xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion">https://idp.example.org/</saml2:Issuer>
<saml2p:Status>
<saml2p:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Success"/>
</saml2p:Status>
<saml2:Assertion xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion" xmlns:xs="http://www.w3.org/2001/XMLSchema" IssueInstant="..." Version="2.0" ID="..." ;>
<saml2:Issuer>https://idp.example.org/</saml2:Issuer>
<ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:SignedInfo>
<ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
<ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
<ds:Reference URI="#_c9a5d647ef4493b4de5f0fd86f663397">
<ds:Transforms>
<ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
<ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
<ec:InclusiveNamespaces PrefixList="xs" xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#"/>
</ds:Transform>
</ds:Transforms>
<ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
<ds:DigestValue>t+/NK1iUxm1ekSfiqltDgIzmlnk=</ds:DigestValue>
</ds:Reference>
</ds:SignedInfo>
<ds:SignatureValue>...</ds:SignatureValue>
<ds:KeyInfo>
<ds:KeyValue>
<ds:RSAKeyValue>
<ds:Modulus>...</ds:Modulus>
<ds:Exponent>AQAB</ds:Exponent>
</ds:RSAKeyValue>
</ds:KeyValue>
<ds:X509Data>
<ds:X509Certificate>Base64 krypterat certifikat...</ds:X509Certificate>
</ds:X509Data>
</ds:KeyInfo>
</ds:Signature>
<saml2:Subject>
<saml2:NameID Format="urn:oasis:names:tc:SAML:2.0:nameid-format:transient">...</saml2:NameID>
<saml2:SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer">
<saml2:SubjectConfirmationData NotOnOrAfter="2017-08-22T11:00:38.641Z"/>
</saml2:SubjectConfirmation>
</saml2:Subject>
<saml2:Conditions NotBefore="2017-08-22T10:10:38.641Z" NotOnOrAfter="2017-08-22T11:00:38.641Z">
<saml2:AudienceRestriction>
<saml2:Audience>https://sp.example.se/</saml2:Audience>
</saml2:AudienceRestriction>
</saml2:Conditions>
<saml2:AuthnStatement AuthnInstant="2017-08-22T10:15:38.730Z">
<saml2:SubjectLocality/>
<saml2:AuthnContext>
<saml2:AuthnContextClassRef>urn:oasis:names:tc:SAML:2.0:ac:classes:SoftwarePKI</saml2:AuthnContextClassRef>
</saml2:AuthnContext>
</saml2:AuthnStatement>
<saml2:AttributeStatement>
<saml2:Attribute Name="Attribut-1">
<saml2:AttributeValue xsi:type="xs:string" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">XYZ</saml2:AttributeValue>
</saml2:Attribute>
<saml2:Attribute Name="Attribut-2">
<saml2:AttributeValue xsi:type="xs:string" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">XYZ</saml2:AttributeValue>
</saml2:Attribute>
<saml2:Attribute Name="Attribut-n">
<saml2:AttributeValue xsi:type="xs:string" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">XYZ</saml2:AttributeValue>
</saml2:Attribute>
</saml2:AttributeStatement>
</saml2:Assertion>
</saml2p:Response>
Exempel Systeminformation
Exempel på systeminformation (som anges vid SOAP-anrop som en del av SOAP-Header).
<ehm:ehm xmlns:ehm="urn:riv:se.ehalsomyndigheten:core:systeminformation:4"> <ehm:systemnamn>Systemet ABC</ehm:systemnamn> <ehm:systemversion>12.4</ehm:systemversion> <ehm:modulversion>11111</ehm:modulversion> <ehm:systeminformation>Aktörens systeminformation</ehm:systeminformation> </ehm:ehm>
Anropsexempel Web Service för Vård- och apotekspersonal med SAML
Anropsexempel som visar SOAP-meddelande med dels en SOAP-Header innehållande:
- security (
wsse:Security), där SAML-intyg (Saml2-Assertion) ersatts med platshållare för ökad läsbarhet ([saml2_assertion]) och med - systeminformation, ersatt med platshållare förökad läsbarhet (
[systeminformation]).
och dels en SOAP-Body med avsedd tjänst anges (i detta exempel VerifyRollPrivatResponder).
<?xml version="1.0"?>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header>
<wsse:security xmlns:wsse=""http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"></span">
[saml2_assertion]
</wsse:Security>
[systeminformation]
</soapenv:Header>
<soapenv:Body>
<urn:VerifieraLOA3 xmlns:urn="urn:riv:se.apotekensservice:referens:VerifieraLOA3Responder:1">
<urn:extension/>
</urn:VerifieraLOA3>
</soapenv:Body>
</soapenv:Envelope>
Anropsexempel Web Service för Privatperson med SAML
Anropsexempel som visar SOAP-meddelande med dels en SOAP-Header innehållande:
- security (
wsse:Security), där SAML-intyg (Saml2-Resonse) ersatts med platshållare för ökad läsbarhet ([saml2_response]) och med - systeminformation, ersatt med platshållare förökad läsbarhet (
[systeminformation]).
och dels en SOAP-Body med avsedd tjänst anges (i detta exempel VerifyRollPrivatResponder).
<?xml version="1.0"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header>
<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
[saml2_response]
</wsse:Security>
[systeminformation]
</soapenv:Header>
<soapenv:Body>
<urn:VerifieraRollPrivatperson xmlns:urn="urn:riv:se.apotekensservice:referens:VerifieraRollPrivatpersonResponder:1">
<urn:extension/>
</urn:VerifieraRollPrivatperson>
</soapenv:Body>
</soapenv:Envelope>
Anropsexempel Web Service med OAuth-token
Anropsexempel som visar SOAP-anrop som inleds med HTTP-Headers där bland annat säkerhetsintyg anges
- Authorization-parameter, där OAuth-token ersatts med platshållare för ökad läsbarhet (
[access_token]).
och med ett SOAP-meddelande som i sig innehåller en SOAP-Header innehållande
- systeminformation, ersatt med platshållare förökad läsbarhet (
[systeminformation]).
och en SOAP-Body med avsedd tjänst anges (i detta exempel VerifyLOA3Responder).
POST [host]/apisp/VerifieraLOA3Responder/V1 HTTP/1.1 Accept-Encoding: gzip,deflate Content-Type: text/xml;charset=UTF-8 SOAPAction: "urn:riv:se.apotekensservice:referens:VerifieraLOA3Responder:1:VerifieraLOA3" Authorization: Bearer [access_token] Content-Length: 477 Host: 1.2.3.4:12380 Connection: Keep-Alive User-Agent: Apache-HttpClient/4.5.2 (Java/1.8.0_152) <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <soapenv:Header> [systeminformation] </soapenv:Header> <soapenv:Body> <urn:VerifieraLOA3 xmlns:urn="urn:riv:se.apotekensservice:referens:VerifieraLOA3Responder:1"/> </soapenv:Body> </soapenv:Envelope>
Anropsexempel REST med SAML-intyg eller OAuth-token
För REST-anrop anges SAML-intyg (Saml2-Assertion eller Saml2-Response) och OAuth-token på samma sätt. Intyg/token ersatt med plattshållare för ökad läsbarhet ([access_token]).
GET https://[base]/Medication?nplPackId=19590101100023 X-Purpose: VARD X-Access: TILLFALLIGT_SAMTYCKE X-Org-Info: ewogICAgIm9yZ2VuaGV0c09ydCIgOiAiS2FsbWFyIgp9 X-Request-ID: 6D1A63A7-1D67-4FE7-84EF-64CF37E6190A X-User-Agent: eyAibmFtZSIgOiAiU3lzdGVtZXQgQUJDIiwgICJpbmZvIiA6ICJBa3TDtnJlbnMgc3lzdGVtaW5mb3JtYXRpb24iLCAgInZlcnNpb24iIDogIjEyLjQiLCAgIm1vZHVsZVZlcnNpb24iIDogIjExMTExIiB9 X-User-Details: ew0KCSJmb3JuYW1uIjoiU3RpbmEiLA0KCSJlZnRlcm5hbW4iOiJQZXR0ZXJzc29uIg0KfQ== Authorization: Bearer [access_token] User-Agent: HttpClient Accept: application/fhir+json; fhirVersion=4.0 Host: [host] Accept-Encoding: gzip, deflate, br Connection: keep-alive
Versionshistorik
| Version | Datum | Kommentar |
|---|---|---|
| 1.0 | 2021-11-27 | Ny handbok vård- och apotekstjänster |