private BaseAuthenticationStrategy GetAuthenticationStrategy()
        {
            ServerType serverType;

            if (radioBtnAGM.Checked)
            {
                serverType = ServerType.AGM;
            }
            else if (radioBtnALM12_5.Checked)
            {
                serverType = ServerType.ALM12_5;
            }
            else if (radioBtnALM12_0.Checked)
            {
                serverType = ServerType.ALM12_0;
            }
            else if (radioBtnBackOffice.Checked)
            {
                serverType = ServerType.BO;
            }
            else if (radioBtnJenkins.Checked)
            {
                serverType = ServerType.Jenkins;
            }
            else
            {
                serverType = ServerType.NGA;
            }

            BaseAuthenticationStrategy baseAuthentication = authenticationStrategies[serverType];

            return(baseAuthentication);
        }
        private void UpdateGetTokenUrl()
        {
            txtSCRFCookie.Text = "";
            txtSCRFHeader.Text = "";
            txtSCRFValue.Text  = "";

            String temp = txtServerUrl.Text.Trim(new char[] { '/', ' ' });
            BaseAuthenticationStrategy authenticationStrategy = GetAuthenticationStrategy();

            txtLoginUrl.Text   = temp + authenticationStrategy.GetAuthenticationSuffixUrl();
            txtSCRFCookie.Text = authenticationStrategy.GetSCRFCookieName();
            txtSCRFHeader.Text = authenticationStrategy.GetSCRFHeaderName();
        }
        private void Login()
        {
            String timeNow = DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString() + " : ";

            try
            {
                BaseAuthenticationStrategy baseAuthentication   = GetAuthenticationStrategy();
                AuthenticationResult       authenticationResult = baseAuthentication.Authenticate(txtBaseURL.Text, txtLoginName.Text, txtPassword.Text);

                if (authenticationResult.LwssoToken != null)
                {
                    txtToken.Text      = timeNow + "Token received successfully to " + txtLoginName.Text;
                    txtToken.ForeColor = Color.Green;
                    txtSCRFValue.Text  = authenticationResult.CsrfToken;

                    txtSCRFCookie.Text = GetAuthenticationStrategy().GetSCRFCookieName();
                    txtSCRFHeader.Text = GetAuthenticationStrategy().GetSCRFHeaderName();

                    m_sharedData.InitSecurityContext(txtLoginName.Text, authenticationResult.LwssoToken, authenticationResult.Cookies);
                    m_sharedData.InitBaseUrl(txtBaseURL.Text, txtBaseURL.Text);
                    m_sharedData.SetCSRFContext(txtSCRFCookie.Text, txtSCRFHeader.Text, txtSCRFValue.Text);
                }
                else
                {
                    txtToken.Text      = timeNow + "Received null instead of token";
                    txtToken.ForeColor = Color.Red;
                    m_sharedData.ClearSecurityContext();
                }
            }
            catch (Exception ex)
            {
                txtToken.Text      = timeNow + "Failed to get token : " + ex.Message;
                txtToken.ForeColor = Color.Red;
                m_sharedData.ClearSecurityContext();;
            }
        }