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
			public static void TestResponseElement( ResponseElement res )
			{
				MemoryStream ms = new MemoryStream();
				XmlTextWriter tw = new XmlTextWriter( ms, System.Text.Encoding.ASCII );
				res.WriteDocument( tw );
				tw.Flush();
				ms.Position = 0;
				ContextDocument cd = new ContextDocument( new XmlTextReader( ms ), XacmlVersion.Version11 );
			}
Ejemplo n.º 3
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 );
		}