Beispiel #1
0
        /// <summary>
        /// Creates a new connection using a provisioning ticket.
        /// </summary>
        /// <param name="provisioningTicket">The provisioning ticket containing the options for the new connection.</param>
        /// <returns>An instance of CreateConnectionResult containing the results of the operation.</returns>
        public CreateConnectionResult CreateConnection(ProvisioningTicket provisioningTicket)
        {
            var connectionTicket = new Connection(
                provisioningTicket.strategy,
                provisioningTicket.options["tenant_domain"]);

            var extraProperties = provisioningTicket.options.Keys.Except(
                new string[] { "tenant_domain" });

            extraProperties.ToList().ForEach(k =>
            {
                connectionTicket.Options.Add(k, provisioningTicket.options[k]);
            });

            try
            {
                var connection = this.CreateConnection(connectionTicket);
                return(new CreateConnectionResult
                {
                    worked = true,
                    provisioning_ticket_url = connection.ProvisioningTicketUrl
                });
            }
            catch (Exception ex)
            {
                return(new CreateConnectionResult
                {
                    worked = false,
                    error = ex.Message
                });
            }
        }
Beispiel #2
0
        /// <summary>
        /// Creates a new connection using a provisioning ticket.
        /// </summary>
        /// <param name="provisioningTicket">The provisioning ticket containing the options for the new connection.</param>
        /// <returns>An instance of CreateConnectionResult containing the results of the operation.</returns>
        public CreateConnectionResult CreateConnection(ProvisioningTicket provisioningTicket)
        {
            var connectionTicket = new Connection(
                provisioningTicket.strategy,
                provisioningTicket.options["tenant_domain"]);

            if (provisioningTicket.options.ContainsKey("adfs_server") &&
                !string.IsNullOrEmpty(provisioningTicket.options["adfs_server"]))
            {
                connectionTicket.Options.AdfsServer = provisioningTicket.options["adfs_server"];
            }

            if (provisioningTicket.options.ContainsKey("server_url") &&
                !string.IsNullOrEmpty(provisioningTicket.options["server_url"]))
            {
                connectionTicket.Options.ServerUrl = provisioningTicket.options["server_url"];
            }

            try
            {
                var connection = this.CreateConnection(connectionTicket);
                return(new CreateConnectionResult
                {
                    worked = true,
                    provisioning_ticket_url = connection.ProvisioningTicketUrl
                });
            }
            catch (Exception ex)
            {
                return(new CreateConnectionResult
                {
                    worked = false,
                    error = ex.Message
                });
            }
        }