public SealCard GetIdCard() { if (!IsIdCardValid(_idCard)) { var rsc = SealCard.Create(MakeAssertionForSts(_userCertificate)); _idCard = SealUtilities.SignIn(rsc, _issuer, _stsUrl); } return(_idCard); }
public void TestIDcard_Does_not_change_whiteSpace() { var localSealCard = SealCard.Create(AssertionMaker.MakeAssertionForSTS(Global.MocesCprGyldig)); var sosiCardSTS = SealUtilities.SignIn(localSealCard, "http://www.ribeamt.dk/EPJ", Settings.Default.SecurityTokenService); CallNts(sosiCardSTS); Assert.IsTrue(SealUtilities.CheckAssertionSignature(localSealCard.Xassertion)); Assert.IsTrue(SealUtilities.CheckAssertionSignature(sosiCardSTS.Xassertion)); }
public void TestSTSogFMKAssertionAsType() { //Seal kort oprettes //FMK kaldes //Assertion overføres typestærkt var rsc = SealCard.Create(AssertionMaker.MakeAssertionForSTS(Global.MocesCprGyldig)); var sc = SealUtilities.SignIn(rsc, "http://www.ribeamt.dk/EPJ", Settings.Default.SecurityTokenService); var client = new proxy.MedicineCardPortTypeClient("localFMK"); client.GetMedicineCard_20120101(MakeSecurity(sc.GetAssertion <proxy.Assertion>()), MakeHeader()); }
public void IsTrustedStsCertificateTest() { //Create factory SOSIFactory factory = CreateSOSIFactoryWithTestFederation(Global.MocesCprGyldig); //Create IdCard UserIdCard idCard = CreateIdCardForSTS(factory); //Sign IdCard idCard.Sign <Assertion>(factory.SignatureProvider); UserIdCard idc = (UserIdCard)SealUtilities.SignIn(idCard, "NETS DANID A/S", Settings.Default.SecurityTokenService); //Assert that STS certificate goes through Assert.DoesNotThrow(delegate { idc.ValidateSignatureAndTrust(factory.Federation); }); }
public void SosiFederationTest() { //Create factory SOSIFactory factory = CreateSOSIFactoryWithSosiFederation(Global.MocesCprGyldig); //Create IdCard UserIdCard idCard = CreateIdCardForSTS(factory); //Sign IdCard idCard.Sign <Assertion>(factory.SignatureProvider); UserIdCard idc = (UserIdCard)SealUtilities.SignIn(idCard, "NETS DANID A/S", Settings.Default.SecurityTokenService); //Assert that STS certificate fails due to mismatch in prefix/cvr Assert.Throws <ModelException>(delegate { idc.ValidateSignatureAndTrust(factory.Federation); }); }
public void TestSTSogFMKAssertionAsXml() { //Seal kort oprettes //FMK kaldes //Assertion overføres via SealCard som XML var rsc = SealCard.Create(AssertionMaker.MakeAssertionForSTS(Global.MocesCprGyldig)); var sc = SealUtilities.SignIn(rsc, "http://www.ribeamt.dk/EPJ", Settings.Default.SecurityTokenService); var client = new proxy.MedicineCardPortTypeClient("localFMK"); using (var scope = new OperationContextScope(client.InnerChannel)) { OperationContext.Current.OutgoingMessageHeaders.Add(new SealCardMessageHeader(sc)); client.GetMedicineCard_20120101(null, MakeHeader()); } }
public void TestSTSogFMKAssertionAsType_new() { //Seal kort oprettes //FMK kaldes //Assertion overføres typestærkt var factory = CreateSOSIFactory(Global.MocesCprGyldig); var uid = CreateIdCardForSTS(factory); uid.Sign <Assertion>(factory.SignatureProvider); var idc = SealUtilities.SignIn(uid, "http://www.ribeamt.dk/EPJ", Settings.Default.SecurityTokenService); var client = new proxy.MedicineCardPortTypeClient("localFMK"); client.GetMedicineCard_20120101(MakeSecurity(idc.GetAssertion <proxy.Assertion>()), MakeHeader()); }
public void TestSTSogFMKAssertionAsXml_new() { //Seal kort oprettes //FMK kaldes //Assertion overføres via SealCard som XML var factory = CreateSOSIFactory(Global.MocesCprGyldig); var uid = CreateIdCardForSTS(factory); uid.Sign <Assertion>(factory.SignatureProvider); var idc = SealUtilities.SignIn(uid, "http://www.ribeamt.dk/EPJ", Settings.Default.SecurityTokenService); var client = new proxy.MedicineCardPortTypeClient("localFMK"); using (var scope = new OperationContextScope(client.InnerChannel)) { OperationContext.Current.OutgoingMessageHeaders.Add(new IdCardMessageHeader(idc)); client.GetMedicineCard_20120101(null, MakeHeader()); } }