示例#1
0
        public Login(Server.Enterprise.AuthenticationResponse forAuthenticationResponse, String forEnvironmentName)
        {
            authenticationResponse = forAuthenticationResponse;

            environmentName = forEnvironmentName;

            return;
        }
示例#2
0
        public Session(Server.Enterprise.AuthenticationResponse authenticationResponse)
        {
            token = authenticationResponse.Token;

            securityAuthorityId = authenticationResponse.SecurityAuthorityId;

            securityAuthorityName = authenticationResponse.SecurityAuthorityName;

            securityAuthorityType = authenticationResponse.SecurityAuthorityType;

            environmentId = authenticationResponse.EnvironmentId;

            environmentName = authenticationResponse.EnvironmentName;

            confidentialityStatement = authenticationResponse.ConfidentialityStatement;

            userAccountId = authenticationResponse.UserAccountId;

            userAccountName = authenticationResponse.UserAccountName;

            userDisplayName = authenticationResponse.UserDisplayName;


            foreach (Int64 currentWorkQueueId in authenticationResponse.WorkQueuePermissions.Keys)
            {
                Int32 permission = (Int32)authenticationResponse.WorkQueuePermissions[currentWorkQueueId];

                workQueuePermissions.Add(currentWorkQueueId, (Server.Application.WorkQueueTeamPermission)permission);
            }


            foreach (String currentGroupMembership in authenticationResponse.GroupMembership)
            {
                groupMembership.Add(currentGroupMembership);
            }

            foreach (String currentRoleMembership in authenticationResponse.RoleMembership)
            {
                roleMembership.Add(currentRoleMembership);
            }

            foreach (String currentPermission in authenticationResponse.EnterprisePermissionSet)
            {
                enterprisePermissionSet.Add(currentPermission, currentPermission);
            }

            foreach (String currentPermission in authenticationResponse.EnvironmentPermissionSet)
            {
                environmentPermissionSet.Add(currentPermission, currentPermission);
            }

            return;
        }
        private void MercuryApplication_AuthenticateCompleted(Object sender, Server.Enterprise.AuthenticateWindowsCompletedEventArgs e)
        {
            ConnectProgressBar.Visibility = System.Windows.Visibility.Collapsed;

            ConnectProgressText.Visibility = System.Windows.Visibility.Collapsed;


            if (e.Error != null)
            {
                AuthenticationResponse.Text = e.Error.Message;

                return;
            }

            Server.Enterprise.AuthenticationResponse response = e.Result;

            if ((response.AuthenticationError == Server.Enterprise.AuthenticationError.NoError) && (!String.IsNullOrWhiteSpace(response.Token)))
            {
                WindowCommand_Close();

                return;
            }

            else
            {
                if (response.AuthenticationError == Server.Enterprise.AuthenticationError.MustSelectEnvironment)
                {
                    AuthenticationResponse.Text = String.Empty;

                    EnvironmentSelection.Items.Clear();

                    String[] availableEnvironments = response.Environments.Split(';');

                    foreach (String currentEnvironment in availableEnvironments)
                    {
                        Telerik.Windows.Controls.RadComboBoxItem item = new Telerik.Windows.Controls.RadComboBoxItem();

                        item.Content = currentEnvironment;

                        EnvironmentSelection.Items.Add(item);
                    }

                    if (EnvironmentSelection.Items.Count == 0)
                    {
                        AuthenticationResponse.Text = "Unable to access any environments with this account. You will not be able to use Mercury.";
                    }

                    else if (EnvironmentSelection.Items.Count == 1)
                    {
                        EnvironmentSelection.SelectedIndex = 0;

                        Connect_Click(null, null);
                    }

                    else
                    {
                        AuthenticationResponse.Text = "Multiple environments available. Please, select an environment.";

                        EnvironmentSelection.SelectedIndex = 0;
                    }
                }

                else
                {
                    AuthenticationResponse.Text = response.AuthenticationError.ToString() + " ";

                    if (response.HasException)
                    {
                        AuthenticationResponse.Text += response.Exception.Message;
                    }
                }
            }

            return;
        }