/// <remarks/> public void GetAuthorizationTokenAsync(TokenRequest TokenRequest) { this.GetAuthorizationTokenAsync(TokenRequest, null); }
/// <remarks/> public void GetAuthorizationTokenAsync(TokenRequest TokenRequest, object userState) { if ((this.GetAuthorizationTokenOperationCompleted == null)) { this.GetAuthorizationTokenOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetAuthorizationTokenOperationCompleted); } this.InvokeAsync("GetAuthorizationToken", new object[] { TokenRequest}, this.GetAuthorizationTokenOperationCompleted, userState); }
private void Authenticate() { //Initialize Authentication Token Request Authentication.TokenRequest requestToken = new Authentication.TokenRequest(); requestToken.UserName = System.Configuration.ConfigurationManager.AppSettings["UserName"]; requestToken.Password = System.Configuration.ConfigurationManager.AppSettings["Password"]; //SET TOKEN NEVER EXPIRES FOR NOW -- DEFAULT WAS SET TO 3 MINUTES (see Installation Guide) requestToken.TokenNeverExpires = true; //Instantiate a new authentication service and url Authentication.Authentication serviceAuthentication = new Authentication.Authentication(); string urlAuthentication = System.Configuration.ConfigurationManager.AppSettings["TokenURL"]; serviceAuthentication.Url = urlAuthentication; //Create TokenResponse and pass in the request through the Authentication service Authentication.TokenResponse responseToken = serviceAuthentication.GetAuthorizationToken(requestToken); //Check TokenRequest Response - If "OK" then continue, else give message !:-) if (responseToken.TrxResult == "OK") { tokenId = responseToken.TokenId; } else { Label1.Text = "ERROR: Failed 'Authentication' to System. Please logout and try again."; Label1.Visible = true; } }