コード例 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                // Ensure the SAML configuration is loaded.
                SAMLController.Initialize();

                // Display the partner service provider descriptions.
                partnerSelectionDiv.Visible = SAMLController.Configuration.PartnerServiceProviderConfigurations.Count > 0;

                partnerNameDropDownList.Items.Add(new ListItem("--- Any ---", ""));

                foreach (PartnerServiceProviderConfiguration partnerServiceProviderConfiguration in SAMLController.Configuration.PartnerServiceProviderConfigurations)
                {
                    string description = partnerServiceProviderConfiguration.Description;

                    if (string.IsNullOrEmpty(description))
                    {
                        description = partnerServiceProviderConfiguration.Name;
                    }

                    partnerNameDropDownList.Items.Add(new ListItem(description, partnerServiceProviderConfiguration.Name));
                }
            }

            catch (Exception)
            {
                errorMessageLabel.Text = "The SAML configuration couldn't be loaded.";
            }
        }
コード例 #2
0
        static void Main(string[] args)
        {
            try
            {
                ParseArguments(args);

                SAMLController.Initialize();

                XmlElement xmlElement = GetSAMLMessage();
                SAMLIdentifiers.MessageType messageType = SAML.GetSAMLMessageType(xmlElement);
                Console.WriteLine("The SAML message type is: {0}", messageType);

                switch (messageType)
                {
                case SAMLIdentifiers.MessageType.AuthnRequest:
                    ReceiveAuthnRequest(xmlElement);
                    break;

                case SAMLIdentifiers.MessageType.SAMLResponse:
                    ReceiveSAMLResponse(xmlElement);
                    break;

                case SAMLIdentifiers.MessageType.LogoutRequest:
                    ReceiveLogoutMessage(xmlElement, messageType);
                    break;

                case SAMLIdentifiers.MessageType.LogoutResponse:
                    ReceiveLogoutMessage(xmlElement, messageType);
                    break;
                }
            }

            catch (Exception exception)
            {
                Console.Error.WriteLine(exception.ToString());

                if (exception is ArgumentException)
                {
                    ShowUsage();
                }
            }
        }
コード例 #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     // Ensure the SAML configuration is loaded.
     SAMLController.Initialize();
 }