public static EvaluationOperation Load(XmlReader reader)
        {
            EvaluationOperation evalOperation = new EvaluationOperation();

            evalOperation.ReadXml(reader);

            return(evalOperation);
        }
예제 #2
0
        public override void ReadXml(XmlReader reader)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }

            reader.MoveToRequiredStartElement(AuthorizationConstants.Elements.Rule);
            string termId = reader.GetOptionalAttribute(AuthorizationConstants.Attributes.TermId);

            if (!string.IsNullOrEmpty(termId))
            {
                this.TermId = new Uri(termId);
            }

            this.Issuer = reader.GetOptionalAttribute(AuthorizationConstants.Attributes.Issuer);

            string evaluates = reader.GetOptionalAttribute(AuthorizationConstants.Attributes.Evaluates);

            if (!string.IsNullOrEmpty(evaluates))
            {
                this.Evaluates = XmlConvert.ToBoolean(evaluates);
            }

            while (reader.Read())
            {
                if (reader.IsRequiredStartElement(AuthorizationConstants.Elements.Operation))
                {
                    this.Operation = EvaluationOperation.Load(reader);
                }

                if (reader.IsRequiredStartElement(AuthorizationConstants.Elements.Match))
                {
                    this.MatchExpression = Match.Load(reader);
                }

                if (reader.IsRequiredEndElement(AuthorizationConstants.Elements.Rule))
                {
                    return;
                    //break;
                }
            }

            reader.Read();
        }
예제 #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Rule"/> class.
 /// </summary>
 /// <param name="matchType">An expression to match claims for the operation.</param>
 /// <param name="operation">The operation that performs an evaluation.</param>
 /// <param name="evaluates">The truthful evaluation for the rule.</param>
 public Rule(Match matchType, EvaluationOperation operation, bool evaluates)
 {
     this.MatchExpression = matchType;
     this.Operation       = operation;
     this.Evaluates       = evaluates;
 }
예제 #4
0
 /// <summary>
 ///  Initializes a new instance of the <see cref="Rule"/> class.
 /// </summary>
 /// <param name="matchType">An expression to match claims for the operation.</param>
 /// <param name="operation">The operation that performs an evaluation.</param>
 public Rule(Match matchType, EvaluationOperation operation)
     : this(matchType, operation, true)
 {
 }
예제 #5
0
파일: Rule.cs 프로젝트: lulzzz/piraeus-2
 /// <summary>
 ///     Initializes a new instance of the <see cref="Rule" /> class.
 /// </summary>
 /// <param name="matchType">An expression to match claims for the operation.</param>
 /// <param name="operation">The operation that performs an evaluation.</param>
 /// <param name="evaluates">The truthful evaluation for the rule.</param>
 public Rule(Match matchType, EvaluationOperation operation, bool evaluates)
 {
     MatchExpression = matchType;
     Operation       = operation;
     Evaluates       = evaluates;
 }