Пример #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="XacmlContextResult"/> class.
        /// </summary>
        /// <param name="decision">The authorization decision.</param>
        /// <param name="status">The status.</param>
        public XacmlContextResult(XacmlContextDecision decision, XacmlContextStatus status) {
            Contract.Requires<ArgumentNullException>(status != null);

            this.decision = decision;
            this.status = status;
        }
Пример #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="XacmlContextResult"/> class.
 /// </summary>
 /// <param name="decision">The authorization decision.</param>
 /// <remarks>
 /// Used only from XACML 2.0/3.0
 /// </remarks>
 public XacmlContextResult(XacmlContextDecision decision) {
     this.decision = decision;
 }
        protected virtual void WriteContextDecision(XmlWriter writer, XacmlContextDecision xacmlContextDecision) {
            Contract.Requires<ArgumentNullException>(writer != null);

            string value;
            switch (xacmlContextDecision) {
                case XacmlContextDecision.Deny:
                    value = "Deny";
                    break;

                case XacmlContextDecision.Indeterminate:
                    value = "Indeterminate";
                    break;

                case XacmlContextDecision.NotApplicable:
                    value = "NotApplicable";
                    break;

                case XacmlContextDecision.Permit:
                    value = "Permit";
                    break;

                default:
                    throw Diagnostic.DiagnosticTools.ExceptionUtil.ThrowHelperError(new XacmlSerializationException("Wrong Decision value"));
            }

            writer.WriteElementString(XacmlConstants.Prefixes.Context, XacmlConstants.ElementNames.Decision, this.version.NamespaceContext, value);
        }