Page History
...
| Code Block | ||
|---|---|---|
| ||
public static async Task LoginToGateway(IdCard idCard, X509Certificate2 userCert)
{
var sosiGwAssertion = idCard.GetAssertion<AssertionType>();
var security = new GW.Security
{
Timestamp = new GW.Timestamp { Created = DateTimeEx.UtcNowRound - TimeSpan.FromMinutes(5) },
Assertion = sosiGwAssertion
};
const string endpointAddress = "http://test1.ekstern-test.nspop.dk:8080/sosigw/service/sosigw";
using var gwClient = new SosiGWFacadeClient(SosiGWSoapBinding, endpointAddress);
var dig = (await gwClient.requestIdCardDigestForSigningAsync(security, "whatever")).requestIdCardDigestForSigningResponse;
var digestHash = SHA1.HashData(dig.DigestValue);
var signature = userCert.GetRSAPrivateKey().SignHash(digestHash, HashAlgorithmName.SHA1, RSASignaturePadding.Pkcs1);
var cardRequestBody = new signIdCardRequestBody
{
SignatureValue = signature,
KeyInfo = new GW.KeyInfo
{
Item = new GW.X509Data { Item = userCert.Export(X509ContentType.Cert) }
}
};
// The STS signed card is saved in the sosiGw cache and is used for future calls through the proxy
var res = (await gwClient.signIdCardAsync(security, cardRequestBody)).signIdCardResponse;
if (res != signIdCardResponse.ok) { throw new Exception("Gateway logon error"); }
// Convert the GW Assertion to a dgwsType Assertion
var sosiGwAssertionDocument = SerializerUtil.Serialize(sosiGwAssertion).Root;
SerializerUtil.Deserialize<Assertion>(sosiGwAssertionDocument, typeof(AssertionType).Name);
} |
Kald gennem SOSI Gateway
...
Dette bruges til almindelige SOAP kald, hvor GW vil berige ID kortet med det den har gemt i dens cache. Det er derfor et krav at ID kortet først er oprettet i GW.
...
| Code Block | ||
|---|---|---|
| ||
var idCardRequest = SOSIFactory.CreateNewUserIdCard(
systemName,
new UserInfo(requestCpr, givenName, surName, email, occupation, role, authorizationcode),
new CareProvider(careProviderIdFormat, careProviderId, careProviderName),
AuthenticationLevel.MocesTrustedUser, userName, password, user.Certificate, alternativeIdentifier);
await LoginToGateway(idCardRequest, certificate);
var client = new Fmk.MedicineCardPortTypeClient(<configuration>);
var response = await client.GetMedicineCard_2015_06_01Async(
Security: new SecurityHeaderType{ }securityHeader,
Header: requestHeader,
WhitelistingHeader: whitelistingHeader,
GetMedicineCardRequest: new GetMedicineCardRequestType
{
PersonIdentifier = new PersonIdentifierType
{
source = "CPR",
Value = requestCpr
}
}); |
Der henvises til dokumentation af SOSI Gateway for yderligere detaljer.
SOSI Gateway SBO
SOSI Gateway kan bruges til SBO (Sikker Browser Opstart).
...