/// <summary> /// Creates a new instance of the evaluaion context. /// </summary> /// <param name="engine">The engine instance.</param> /// <param name="policyDocument">The policy document instance.</param> /// <param name="contextDocument">The context document instance.</param> public EvaluationContext(EvaluationEngine engine, PolicyDocument policyDocument, ContextDocument contextDocument) : this() { var attributes = new AttributeReadWriteCollection(); foreach (AttributeElementReadWrite attribute in contextDocument.Request.Resources[0].Attributes) { attributes.Add(new AttributeElementReadWrite(attribute)); } ResourceContentElement resourceContent = null; if (contextDocument.Request.Resources[0].ResourceContent != null) { resourceContent = new ResourceContentElement( contextDocument.Request.Resources[0].ResourceContent.XmlDocument, contextDocument.Request.Resources[0].ResourceContent.SchemaVersion); } _engine = engine; _policyDocument = policyDocument; _contextDocument = contextDocument; CurrentResource = new ResourceElementReadWrite( resourceContent, contextDocument.Request.Resources[0].ResourceScopeValue, attributes, contextDocument.Request.Resources[0].SchemaVersion); }
/// <summary> /// Creates a AttributeCollection, with the items contained in a AttributeReadWriteCollection /// </summary> /// <param name="items"></param> public AttributeCollection(AttributeReadWriteCollection items) { if (items == null) throw new ArgumentNullException("items"); foreach (AttributeElementReadWrite item in items) { this.List.Add(new AttributeElement(item.AttributeId, item.DataType, item.Issuer, item.IssueInstant, item.Value, item.SchemaVersion)); } }
/// <summary> /// Creates a AttributeCollection, with the items contained in a AttributeReadWriteCollection /// </summary> /// <param name="items"></param> public AttributeCollection(AttributeReadWriteCollection items) { if (items == null) { throw new ArgumentNullException("items"); } foreach (AttributeElementReadWrite item in items) { this.List.Add(new AttributeElement(item.AttributeId, item.DataType, item.Issuer, item.IssueInstant, item.Value, item.SchemaVersion)); } }
/// <summary> /// Creates an Environment using the specified arguments. /// </summary> /// <param name="attributes">The attribute list.</param> /// <param name="schemaVersion">The version of the schema that was used to validate.</param> public EnvironmentElementReadWrite(AttributeReadWriteCollection attributes, XacmlVersion schemaVersion) : base(attributes, schemaVersion) { }
/// <summary> /// Creates a Subject using the specified arguments. /// </summary> /// <param name="subjectCategory">The subject category.</param> /// <param name="attributes">The attribute list.</param> /// <param name="schemaVersion">The version of the schema that was used to validate.</param> public SubjectElementReadWrite(string subjectCategory, AttributeReadWriteCollection attributes, XacmlVersion schemaVersion) : base(attributes, schemaVersion) { _subjectCategory = subjectCategory; }
/// <summary> /// Creates a new target item using the specified attribute list. /// </summary> /// <param name="attributes">The attribute list.</param> /// <param name="schemaVersion">The version of the schema that was used to validate.</param> protected TargetItemBase(AttributeReadWriteCollection attributes, XacmlVersion schemaVersion) : this(schemaVersion) { _attributes = attributes; }
/// <summary> /// Creates a Resource using the specified arguments. /// </summary> /// <param name="resourceScope">The resource scope for this target item.</param> /// <param name="resourceContent">The resource content in the context document.</param> /// <param name="attributes">The attribute list.</param> /// <param name="schemaVersion">The version of the schema that was used to validate.</param> public ResourceElementReadWrite(ResourceContentElementReadWrite resourceContent, ResourceScope resourceScope, AttributeReadWriteCollection attributes, XacmlVersion schemaVersion) : base(attributes, schemaVersion) { _resourceContent = resourceContent; _resourceScope = resourceScope; }