コード例 #1
0
        public virtual void Validate(object armorToken)
        {
            Execute();
            if (!ArmorTokenValidationStepResult.IsValid)
            {
                return;
            }

            next.Validate(ArmorTokenValidationStepResult.Output);
            ArmorTokenValidationStepResult = next.ArmorTokenValidationStepResult;
        }
コード例 #2
0
        public void Execute()
        {
            var validate    = new ClaimsArmorTokenValidationStep(new EmptyEncryptedArmorTokenValidationStep(), new UserIdClaimValidatorFactory(userId), new TimeStampClaimValidatorFactory(timeout));
            var deserialise = new SerialisedArmorTokenValidationStep(new ArmorTokenDeserialisor(), validate);
            var decrypt     = new EncryptedArmorTokenValidationStep(deserialise, new RijndaelDecryptionMechanismFactory(encryptionKey));
            var hash        = new HashedArmorTokenValidationStep(decrypt, new HashedArmorTokenParser(HashingMode.HMACSHA512), new HMACSHA512ArmorTokenHasherFactory(hashingKey));

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

            armorTokenValidator.Execute();

            ArmorTokenValidationStepResult = armorTokenValidator.ArmorTokenValidationStepResult;
        }
コード例 #3
0
        public override void Execute()
        {
            hashedArmorTokenParser.Execute();
            var armorTokenHasher = armorTokenHasherFactory.CreateArmorTokenHasher(hashedArmorTokenParser.ParsedArmorToken.ArmorToken);

            armorTokenHasher.Execute();
            var isValid = armorTokenHasher.Hash.Equals(Convert.ToBase64String(hashedArmorTokenParser.ParsedArmorToken.Hash));

            ArmorTokenValidationStepResult = new ArmorTokenValidationStepResult {
                IsValid = isValid,
                Message = isValid ? "Untampered" : "Tampered",
                Output  = hashedArmorTokenParser.ParsedArmorToken.ArmorToken
            };
        }
コード例 #4
0
 public override void Execute()
 {
     try {
         encryptionMechanism.Execute();
         ArmorTokenValidationStepResult = new ArmorTokenValidationStepResult {
             IsValid = true,
             Message = "Untampered",
             Output  = encryptionMechanism.Output
         };
     }
     catch (CryptographicException) {
         ArmorTokenValidationStepResult = new ArmorTokenValidationStepResult {
             IsValid = false,
             Message = "Tampered"
         };
     }
 }
コード例 #5
0
 public void Execute()
 {
     first.Validate(armorToken);
     ArmorTokenValidationStepResult = first.ArmorTokenValidationStepResult;
 }