public void DeserializeUnsignedUserIdCardTest()
        {
            //Create Factory
            SOSIFactory factory = CreateSOSIFactory(Global.MocesCprGyldig);

            //Create IdCard
            UserIdCard idCard = CreateMocesUserIdCard(factory);

            Assertion assertion = idCard.GetAssertion <Assertion>();

            UserIdCard deserializedCard = (UserIdCard)factory.DeserializeIdCard(assertion);

            //Assert they are equal
            Assert.True(idCard.CreatedDate == deserializedCard.CreatedDate);
            Assert.True(idCard.ExpiryDate == deserializedCard.ExpiryDate);
            Assert.True(idCard.IsValidInTime == deserializedCard.IsValidInTime);
            Assert.True(idCard.UserInfo.Equals(deserializedCard.UserInfo));
            Assert.True(idCard.AuthenticationLevel.Equals(deserializedCard.AuthenticationLevel));
            Assert.True(idCard.CertHash == deserializedCard.CertHash);
            Assert.True(idCard.AlternativeIdentifier == deserializedCard.AlternativeIdentifier);
            Assert.True(idCard.IdCardId == deserializedCard.IdCardId);
            Assert.True(idCard.Issuer == deserializedCard.Issuer);
            Assert.True(idCard.Username == deserializedCard.Username);
            Assert.True(idCard.Password == deserializedCard.Password);
            Assert.True(idCard.SystemInfo.ItSystemName == deserializedCard.SystemInfo.ItSystemName);
            Assert.True(idCard.SystemInfo.CareProvider.Equals(deserializedCard.SystemInfo.CareProvider));
            Assert.True(idCard.Version == deserializedCard.Version);
            Assert.Throws <ModelBuildException>(delegate { var cert = deserializedCard.SignedByCertificate; });
        }
Beispiel #2
0
        public void IdCardUserNamePassTest()
        {
            //Create factory
            SOSIFactory factory = CreateSOSIFactory(Global.MocesCprGyldig);

            //Create IdCard with username/password
            UserIdCard idCard = CreateUserIdCard(factory, "user", "test123");

            //Get Assertion
            Assertion ass = idCard.GetAssertion <Assertion>();

            Assert.True(ass.Subject.SubjectConfirmation.SubjectConfirmationData.Item.GetType() == typeof(UsernameToken));

            //Assert assertion was created succesfully
            Assert.NotNull(ass);
            Assert.NotNull(idCard.Xassertion);
        }
Beispiel #3
0
        public void IdCardMocesSignTest()
        {
            //Create factory
            SOSIFactory factory = CreateSOSIFactory(Global.MocesCprGyldig);

            //Create IdCard
            UserIdCard idCard = CreateMocesUserIdCard(factory);

            //Sign IdCard
            Assertion ass  = idCard.Sign <Assertion>(factory.SignatureProvider);
            Assertion ass2 = idCard.GetAssertion <Assertion>();

            //Assert assertion was created succesfully
            Assert.NotNull(ass);
            Assert.NotNull(idCard.Xassertion);

            //Make sure the assertion returned from Sign and Get are the same.
            Assert.True(ass.Signature.SignatureValue.ToString() == ass2.Signature.SignatureValue.ToString());
        }