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();; } }