Ejemplo n.º 1
0
        /// <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, pol.PolicyDocument policyDocument, ctx.ContextDocument contextDocument)
            : this()
        {
            ctx.AttributeReadWriteCollection attributes = new ctx.AttributeReadWriteCollection();
            foreach (ctx.AttributeElementReadWrite attribute in contextDocument.Request.Resources[0].Attributes)
            {
                attributes.Add(new ctx.AttributeElementReadWrite(attribute));
            }

            ctx.ResourceContentElement resourceContent = null;
            if (contextDocument.Request.Resources[0].ResourceContent != null)
            {
                resourceContent = new ctx.ResourceContentElement(
                    contextDocument.Request.Resources[0].ResourceContent.XmlDocument,
                    contextDocument.Request.Resources[0].ResourceContent.SchemaVersion);
            }

            _engine          = engine;
            _policyDocument  = policyDocument;
            _contextDocument = contextDocument;
            _currentResource = new ctx.ResourceElementReadWrite(
                resourceContent,
                contextDocument.Request.Resources[0].ResourceScopeValue,
                attributes,
                contextDocument.Request.Resources[0].SchemaVersion);
        }
Ejemplo n.º 2
0
		/// <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) );
			}
		}
Ejemplo n.º 3
0
 /// <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));
     }
 }
Ejemplo n.º 4
0
		/// <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;
		}
Ejemplo n.º 5
0
		/// <summary>
		/// Creates a Action 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 ActionElementReadWrite( AttributeReadWriteCollection attributes, XacmlVersion schemaVersion ) 
			: base( attributes, schemaVersion )
		{
		}
Ejemplo n.º 6
0
		/// <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, pol.PolicyDocument policyDocument, ctx.ContextDocument contextDocument )
			: this()
		{
			ctx.AttributeReadWriteCollection attributes = new ctx.AttributeReadWriteCollection();
			foreach( ctx.AttributeElementReadWrite attribute in contextDocument.Request.Resources[0].Attributes )
			{
				attributes.Add( new ctx.AttributeElementReadWrite( attribute ) );
			}

			ctx.ResourceContentElement resourceContent = null;
			if( contextDocument.Request.Resources[0].ResourceContent != null )
			{
				resourceContent = new ctx.ResourceContentElement( 
						contextDocument.Request.Resources[0].ResourceContent.XmlDocument, 
						contextDocument.Request.Resources[0].ResourceContent.SchemaVersion );
			}

			_engine = engine;
			_policyDocument = policyDocument;
			_contextDocument = contextDocument;
			_currentResource = new ctx.ResourceElementReadWrite( 
				resourceContent,
				contextDocument.Request.Resources[0].ResourceScopeValue, 
				attributes, 
				contextDocument.Request.Resources[0].SchemaVersion );
		}
Ejemplo n.º 7
0
 /// <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;
 }
Ejemplo n.º 8
0
		/// <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;
		}
Ejemplo n.º 9
0
 /// <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)
 {
 }
Ejemplo n.º 10
0
		/// <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;
		}
Ejemplo n.º 11
0
 /// <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;
 }