예제 #1
0
        private List <IAppIdentifier> GetApps()
        {
            LocationInfo = Location.FromUri(AppUri);
            LocationInfo.IsVersionCheckActive = false;
            if (IsServerConnection == false)
            {
                LocationInfo.AsDirectConnectionToPersonalEdition();
            }
            else if (IsServerConnection == true && UseSsl == false)
            {
                if (Credentials?.Type == QlikCredentialType.CERTIFICATE)
                {
                    var userCert    = Credentials as CertificateAuth;
                    var clientCert  = GetClientCertificate(userCert?.CertificatePath, userCert?.Password);
                    var certCollect = new X509Certificate2Collection(clientCert);
                    LocationInfo.AsDirectConnection(userCert?.UserDirectory, userCert?.UserId, false, false, certCollect);
                }
                else if (Credentials?.Type == QlikCredentialType.WINDOWSAUTH)
                {
                    var winAuth = Credentials as WindowsAuth;
                    LocationInfo.AsNtlmUserViaProxy(true, new NetworkCredential(winAuth?.Login, winAuth?.Password), false);
                }
                else if (Credentials?.Type == QlikCredentialType.SESSION)
                {
                    var sessionAuth = Credentials as SessionAuth;
                    LocationInfo.AsExistingSessionViaProxy(sessionAuth?.SessionId, sessionAuth?.CookieName, true, false);
                }
            }
            else
            {
                throw new Exception("Unknown Qlik connection type.");
            }

            hub = LocationInfo.Hub();
            return(hub.GetAppList().ToList());
        }