예제 #1
0
 public SealCard GetIdCard()
 {
     if (!IsIdCardValid(_idCard))
     {
         var rsc = SealCard.Create(MakeAssertionForSts(_userCertificate));
         _idCard = SealUtilities.SignIn(rsc, _issuer, _stsUrl);
     }
     return(_idCard);
 }
예제 #2
0
        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));
        }
예제 #3
0
        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());
        }
예제 #4
0
        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); });
        }
예제 #5
0
        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); });
        }
예제 #6
0
        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());
            }
        }
예제 #7
0
        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());
        }
예제 #8
0
        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());
            }
        }