示例#1
0
        public void WhenIValidateTheValidArmorToken()
        {
            var step4 = new ClaimsArmorTokenValidationStep(new EmptyEncryptedArmorTokenValidationStep(), new UserIdClaimValidatorFactory("*****@*****.**"), new TimeStampClaimValidatorFactory(300000));
            var step3 = new SerialisedArmorTokenValidationStep(new ArmorTokenDeserialisor(), step4);
            var step2 = new EncryptedArmorTokenValidationStep(step3, new RijndaelDecryptionMechanismFactory(encryptionKey));
            var step1 = new HashedArmorTokenValidationStep(step2, new HashedArmorTokenParser(HashingMode.HMACSHA512), new HMACSHA512ArmorTokenHasherFactory(hashingKey));

            armorTokenValidator = new ArmorTokenValidator(Convert.FromBase64String(hashedArmorToken), step1);
            armorTokenValidator.Execute();
        }
示例#2
0
        public void ThenTheResultShouldYieldAValidStandardSecureArmorToken()
        {
            var step4 = new ClaimsArmorTokenValidationStep(new EmptyEncryptedArmorTokenValidationStep(), new UserIdClaimValidatorFactory("*****@*****.**"), new TimeStampClaimValidatorFactory(300000));
            var step3 = new SerialisedArmorTokenValidationStep(new ArmorTokenDeserialisor(), step4);
            var step2 = new EncryptedArmorTokenValidationStep(step3, new RijndaelDecryptionMechanismFactory(encryptionKey));
            var step1 = new HashedArmorTokenValidationStep(step2, new HashedArmorTokenParser(HashingMode.HMACSHA512), new HMACSHA512ArmorTokenHasherFactory(hashingKey));

            var armorTokenValidator = new ArmorTokenValidator(Convert.FromBase64String(secureArmorToken), step1);

            armorTokenValidator.Execute();

            Assert.IsTrue(armorTokenValidator.ArmorTokenValidationStepResult.IsValid);
        }