//----------------------------------------------------------------------- // // Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------- namespace System.IdentityModel.Tokens { using System; /// /// Represents the Action element specified in [Saml2Core, 2.7.4.2]. /// public class Saml2Action { private Uri actionNamespace; private string value; /// /// Constructs an instance of Saml2Action class. /// /// Value represented by this class. /// Namespace in which the action is interpreted. public Saml2Action(string value, Uri actionNamespace) { if (string.IsNullOrEmpty(value)) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("value"); } // == // There is a discrepency between the schema and the text of the // specification as to whether the Namespace attribute is optional // or required. The schema specifies required. // == // Per the SAML 2.0 errata the schema takes precedence over the text, // and the namespace attribute is required. This is errata item E36. // == // SAML 2.0 errata at the time of this implementation: // http://docs.oasis-open.org/security/saml/v2.0/sstc-saml-approved-errata-2.0-cd-02.pdf // == if (null == actionNamespace) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("actionNamespace"); } if (!actionNamespace.IsAbsoluteUri) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("actionNamespace", SR.GetString(SR.ID0013)); } this.actionNamespace = actionNamespace; this.value = value; } /// /// Gets or sets a URI reference representing the namespace in which the name of the /// specified action is to be interpreted. [Saml2Core, 2.7.4.2] /// public Uri Namespace { get { return this.actionNamespace; } set { // See note in constructor about why this is required. if (null == value) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("value"); } if (!value.IsAbsoluteUri) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("value", SR.GetString(SR.ID0013)); } this.actionNamespace = value; } } /// /// Gets or sets the label for an action sought to be performed on the /// specified resource. [Saml2Core, 2.7.4.2] /// public string Value { get { return this.value; } set { if (string.IsNullOrEmpty(value)) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("value"); } this.value = value; } } } }