Ejemplo n.º 1
0
        static void RemoveClientFromAdvisor()
        {
            string allowedIPs   = "";
            var    ssoRequester = new SSORequester(GetClientCertificate(), GetServerCertificate());
            Guid?  sessionID    = ssoRequester.GetSessionID(userID, vendorName, allowedIPs);
            var    sessionGuid  = sessionID.Value;

            ChannelFactory <IWidgets> channelFactory = new ChannelFactory <IWidgets>("BasicHttpBinding_IWidgets");
            IWidgets widgets = channelFactory.CreateChannel();

            var channelFactory2 = new ChannelFactory <IVendorManagement>("MaxClockSkewBinding");

            channelFactory2.Credentials.ClientCertificate.Certificate = GetClientCertificate();
            IVendorManagement vendorMgmt = channelFactory2.CreateChannel();

            Console.WriteLine("Client User ID:");
            int clientID = int.Parse(Console.ReadLine());

            Console.WriteLine("Advisor User ID:");
            int advisorID = int.Parse(Console.ReadLine());

            RemoveClientFromAdvisor(clientID, advisorID,
                                    vendorMgmt, widgets, sessionGuid);

            channelFactory2.Close();
            channelFactory.Close();
        }
Ejemplo n.º 2
0
        static void Main()
        {
            string allowedIPs   = ""; //" + HttpContext.Current.UserHostAddress; // If you want access our service directly from browser.
            var    ssoRequester = new SSORequester(GetClientCertificate(), GetServerCertificate());
            Guid?  sessionID    = ssoRequester.GetSessionID(userID, vendorName, allowedIPs);
            Guid   documentGuid = default(Guid);

            if (sessionID.HasValue)
            {
                Console.WriteLine("SAML request completed");
                Console.WriteLine("SessionID = {0}.", sessionID);
                Console.WriteLine();

                ChannelFactory <IWidgets> channelFactory = new ChannelFactory <IWidgets>("BasicHttpBinding_IWidgets");
                IWidgets widgets = channelFactory.CreateChannel();
                PrintTemplatesAndDescriptions(widgets, sessionID.Value);
                documentGuid = UploadFile(widgets, sessionID.Value, testFilePath);
                Console.WriteLine("Uploaded file guid: {0}", documentGuid);
                SetTestMetadata(widgets, sessionID.Value, documentGuid);
                TestSecurityGroups(widgets, sessionID.Value, documentGuid);
                channelFactory.Close();

                TestUserManagement(sessionID.Value, documentGuid);
            }
            else
            {
                Console.WriteLine("SAML request not completed.");
            }

            Console.WriteLine("Press any key to exit...");
            Console.ReadKey();
        }
Ejemplo n.º 3
0
        static void CreateClient()
        {
            string allowedIPs   = "";
            var    ssoRequester = new SSORequester(GetClientCertificate(), GetServerCertificate());
            Guid?  sessionID    = ssoRequester.GetSessionID(userID, vendorName, allowedIPs);
            var    sessionGuid  = sessionID.Value;

            ChannelFactory <IWidgets> channelFactory = new ChannelFactory <IWidgets>("BasicHttpBinding_IWidgets");
            IWidgets widgets = channelFactory.CreateChannel();

            var channelFactory2 = new ChannelFactory <IVendorManagement>("MaxClockSkewBinding");

            channelFactory2.Credentials.ClientCertificate.Certificate = GetClientCertificate();
            IVendorManagement vendorMgmt = channelFactory2.CreateChannel();

            Console.WriteLine("Please enter UserID from your system to verify that this person doesn't exist in our database.");
            string externalUserID = Console.ReadLine();

            Console.WriteLine("First Name:");
            string firstName = Console.ReadLine();

            Console.WriteLine("Last Name:");
            string lastName = Console.ReadLine();

            Console.WriteLine("Email:");
            string email = Console.ReadLine();

            Console.WriteLine("Phone:");
            string phone = Console.ReadLine();

            Console.WriteLine("SecurityGroup Name:");
            string securityGroupName = Console.ReadLine();

            Console.WriteLine("SecurityGroup Description:");
            string securityGroupDescription = Console.ReadLine();

            int clientID, securityGroupID;

            CreateClient(vendorMgmt, widgets, sessionGuid,
                         externalUserID, firstName, lastName, email, phone,
                         securityGroupName, securityGroupDescription,
                         out clientID, out securityGroupID);

            Console.WriteLine("ClientID: {0}", clientID);
            Console.WriteLine("SecurityGroupID: {0}", securityGroupID);

            channelFactory2.Close();
            channelFactory.Close();
        }
Ejemplo n.º 4
0
        static void DeleteUser()
        {
            string allowedIPs   = "";
            var    ssoRequester = new SSORequester(GetClientCertificate(), GetServerCertificate());
            Guid?  sessionID    = ssoRequester.GetSessionID(userID, vendorName, allowedIPs);
            var    sessionGuid  = sessionID.Value;

            ChannelFactory <IWidgets> channelFactory = new ChannelFactory <IWidgets>("BasicHttpBinding_IWidgets");
            IWidgets widgets = channelFactory.CreateChannel();

            var channelFactory2 = new ChannelFactory <IVendorManagement>("MaxClockSkewBinding");

            channelFactory2.Credentials.ClientCertificate.Certificate = GetClientCertificate();
            IVendorManagement vendorMgmt = channelFactory2.CreateChannel();

            Console.WriteLine("Please enter UserID from your system to delete the user.");
            string externalUserID = Console.ReadLine();

            DeleteUser(vendorMgmt, externalUserID);
            Console.WriteLine("User is deleted sucessfully.");

            channelFactory2.Close();
            channelFactory.Close();
        }