/// <summary> /// Qliks the view server operation did finish did finish with json response. /// </summary> /// <param name="operation">The operation.</param> /// <param name="json">The json.</param> public void QlikViewServerOperationDidFinishDidFinishWithJSONResponse(UPQlikViewAuthenticateServerOperation operation, Dictionary <string, object> json) { //string redirectUrlString = json.ObjectForKey("redirectUrl"); //if (redirectUrlString && redirectUrlString.Length() > 0) //{ // NSURL redirectUrl = new NSURL(redirectUrlString); // if (redirectUrl == null) // { // DDLogInfo("Could not create url object for url %@ ... trying to escape it.", redirectUrlString); // redirectUrlString = redirectUrlString.StringByAddingPercentEscapesUsingEncoding(NSUTF8StringEncoding); // redirectUrl = new NSURL(redirectUrlString); // DDLogInfo("Escaped url string is %@", redirectUrlString); // } // if (redirectUrl == null) // { // DDLogError("Could not create url object for string %@.", redirectUrlString); // return; // } // this.SetUrl(redirectUrl); // NSRange tryRange = redirectUrlString.RangeOfString("try="); // if (tryRange.Length > 0) // { // string tryUrl = redirectUrlString.SubstringFromIndex((tryRange.Location + 4)); // if (tryUrl && tryUrl.Length() > 0) // { // redirectedUrl = new NSURL(tryUrl); // } // } // else // { // DDLogError("Could not found try url in %@", redirectUrlString); // return; // } // NSMutableURLRequest request = new NSMutableURLRequest(redirectUrl); // NSURLConnection connection = new NSURLConnection(request, this); // if (!connection) // { // DDLogError("Could not create connection object for qlikview authentication."); // } //} }
/// <summary> /// Updates the metadata with view reference. /// </summary> /// <param name="viewReference">The view reference.</param> public override void UpdateMetadataWithViewReference(ViewReference viewReference) { string documentName = viewReference.ContextValueForKey("DocumentName"); string serverName = viewReference.ContextValueForKey("ServerName"); string userLogin = viewReference.ContextValueForKey("UserLogin"); string scheme = viewReference.ContextValueForKey("ConnectionType"); string loginMethod = viewReference.ContextValueForKey("LoginMethod"); if (loginMethod != null && loginMethod == "AD") { this.Logger.LogInfo("Using Windows authentication for QklikView."); //DDLogInfo("Using Windows authentication for QklikView."); } else { userLogin = $"{userLogin}{ServerSession.CurrentSession.UserName}"; loginMethod = string.Empty; this.Logger.LogInfo($"Using username authentication for QklikView - username: {userLogin}"); //DDLogInfo("Using username authentication for QklikView - username: %@.", userLogin); } ServiceInfo serviceInfo = ServerSession.CurrentSession.ServiceInfoForServiceName("Authenticate"); if (serviceInfo.IsAtLeastVersion("1.2")) { UPQlikViewAuthenticateServerOperation operation; if (scheme != null || loginMethod != null) { operation = new UPQlikViewAuthenticateServerOperation(serverName, userLogin, documentName, scheme, loginMethod, this); } else { operation = new UPQlikViewAuthenticateServerOperation(serverName, userLogin, documentName, this); } ServerSession.CurrentSession.ExecuteRequest(operation); } else { this.Logger.LogError("Server does not support QlikView authentication."); //DDLogError("Server does not support QlikView authentication."); } }
/// <summary> /// Qliks the view authenticate server operation did fail with error. /// </summary> /// <param name="operation">The operation.</param> /// <param name="error">The error.</param> public void QlikViewAuthenticateServerOperationDidFailWithError(UPQlikViewAuthenticateServerOperation operation, Exception error) { //Console.WriteLine("Could not authenticate against QlikView server. Error %@", error); }