Exemple #1
0
        public IndexedHashtable connect(AbstractCredentials credentials, AbstractPermission permission, DataSource validationDataSource)
        {
            permission.IsPrimary = true;
            QueryTemplate qt = new ConnectQuery(this);

            if (validationDataSource == null)
            {
                validationDataSource = new DataSource();
            }
            qt.QueryMethod("AbstractConnection", "authorizedConnect", new object[] { credentials, permission, validationDataSource });
            IndexedHashtable t = buildResults();

            // KLUGE:  This is here to make the number of connections come out right.
            // Note that the first element in the table will be a connection, but
            // the rest either User or Exception.
            if (HasBaseConnection && myResults.Count < myCxns.Count)
            {
                IndexedHashtable t2 = new IndexedHashtable(myCxns.Count);
                t2.Add(BaseConnection.DataSource.SiteId.Id, BaseConnection);
                for (int i = 0; i < t.Count; i++)
                {
                    t2.Add(t.GetKey(i), t.GetValue(i));
                }
                t = t2;
            }
            return(t);
        }
Exemple #2
0
        public static AbstractConnection authorizedConnect(string theUser, bool isBse)
        {
            string              securityPhrase = (isBse ? "" : "NON-BSE");
            MockApp             theApp         = getTheApp(theUser, securityPhrase);
            DataSource          src            = getSrc(theApp.SiteTable, theApp.LoginSitecode);
            AbstractDaoFactory  f           = AbstractDaoFactory.getDaoFactory(AbstractDaoFactory.getConstant(src.Protocol));
            AbstractConnection  cxn         = f.getConnection(src);
            AbstractCredentials credentials = getVisitCredentials(theApp);
            AbstractPermission  permission  = new MenuOption(theApp.User.PermissionString);

            theApp.User = (User)cxn.authorizedConnect(credentials, permission, null);
            return(cxn);
        }
        public QueryThreadPool(int connectionPoolSize, int cxnRefreshTime, 
            AbstractAccount account, AbstractCredentials creds, SiteTable siteTable, IList<Site> cxnSites)
        {
            MaxActiveConnections = connectionPoolSize;
            _cxnRefreshTime = cxnRefreshTime;
            _account = account;
            _credentials = creds;
            _siteTable = siteTable;
            _poolSites = cxnSites;

            _queue = new QueryThreadPoolQueue();
            _queue.Changed += new EventHandler(QueueChanged);

            //start();
            //startAsync();
        }
Exemple #4
0
        public QueryThreadPool(int connectionPoolSize, int cxnRefreshTime,
                               AbstractAccount account, AbstractCredentials creds, SiteTable siteTable, IList <Site> cxnSites)
        {
            MaxActiveConnections = connectionPoolSize;
            _cxnRefreshTime      = cxnRefreshTime;
            _account             = account;
            _credentials         = creds;
            _siteTable           = siteTable;
            _poolSites           = cxnSites;


            _queue          = new QueryThreadPoolQueue();
            _queue.Changed += new EventHandler(QueueChanged);

            //start();
            //startAsync();
        }
 public override object authorizedConnect(AbstractCredentials credentials, AbstractPermission permission, DataSource validationDataSource)
 {
     throw new NotImplementedException();
 }
 public abstract User authenticateAndAuthorize(AbstractCredentials credentials, AbstractPermission permission, DataSource validationDataSource = null);
 public abstract User authorize(AbstractCredentials credentials, AbstractPermission permission);
 public abstract string authenticate(AbstractCredentials credentials, DataSource validationDataSource = null);
Exemple #9
0
        // This is the core visit method the others are using. The permission must have been set before
        // getting here.
        internal User doTheVisit(string sitecode, AbstractCredentials credentials, AbstractPermission permission)
        {
            Site site = mySession.SiteTable.getSite(sitecode);
            DataSource src = site.getDataSourceByModality("HIS");
            if (src == null)
            {
                throw new Exception("No HIS data source at site " + sitecode);
            }

            AbstractDaoFactory factory = AbstractDaoFactory.getDaoFactory(AbstractDaoFactory.getConstant(src.Protocol));
            myCxn = factory.getConnection(src);
            myCxn.Account.AuthenticationMethod = mySession.DefaultVisitMethod;

            if (!MdwsUtils.isValidCredentials(myCxn.Account.AuthenticationMethod, credentials, permission))
            {
                throw new Exception("Invalid credentials");
            }

            object result = null;
            if (myCxn.Account.AuthenticationMethod == VistaConstants.BSE_CREDENTIALS_V2WEB)
            {
                result = myCxn.authorizedConnect(credentials, permission,
                    new DataSource() { ConnectionString = mySession.MdwsConfiguration.BseValidatorConnectionString });
            }
            else
            {
                result = myCxn.authorizedConnect(credentials, permission, null);
            }
            if (result.GetType().Name.EndsWith("Exception"))
            {
                throw (Exception)result;
            }
            else
            {
                return (User)result;
            }
        }
Exemple #10
0
        //public override object authorizedConnect(AbstractCredentials credentials, AbstractPermission permission)
        //{
        //    IsConnected = true;
        //    return null;
        //}

        public override object authorizedConnect(AbstractCredentials credentials, AbstractPermission permission, DataSource validationDataSource)
        {
            IsConnected = true;
            return(null);
        }
Exemple #11
0
 public abstract User authorize(AbstractCredentials credentials, AbstractPermission permission);
Exemple #12
0
 public abstract User authenticateAndAuthorize(AbstractCredentials credentials, AbstractPermission permission, DataSource validationDataSource = null);
Exemple #13
0
 public abstract string authenticate(AbstractCredentials credentials, DataSource validationDataSource = null);
Exemple #14
0
 public static bool isValidCredentials(string authenticationMethod, AbstractCredentials credentials, AbstractPermission permission)
 {
     if (credentials == null)
     {
         return false;
     }
     if (authenticationMethod == MdwsConstants.LOGIN_CREDENTIALS)
     {
         if (String.IsNullOrEmpty(credentials.AccountName) ||
             String.IsNullOrEmpty(credentials.AccountPassword))
         {
             return false;
         }
     }
     else if (authenticationMethod == MdwsConstants.NON_BSE_CREDENTIALS)
     {
         if (String.IsNullOrEmpty(credentials.LocalUid) ||
             String.IsNullOrEmpty(credentials.FederatedUid) ||
             String.IsNullOrEmpty(credentials.SubjectName) ||
             credentials.AuthenticationSource == null ||
             credentials.AuthenticationSource.SiteId == null ||
             String.IsNullOrEmpty(credentials.AuthenticationSource.SiteId.Id) ||
             String.IsNullOrEmpty(credentials.AuthenticationSource.SiteId.Name) ||
             String.IsNullOrEmpty(credentials.AuthenticationToken))
         {
             return false;
         }
     }
     else if (authenticationMethod == MdwsConstants.BSE_CREDENTIALS_V2WEB)
     {
         if (String.IsNullOrEmpty(credentials.LocalUid) ||
             String.IsNullOrEmpty(credentials.FederatedUid) ||
             String.IsNullOrEmpty(credentials.SubjectName) ||
             credentials.AuthenticationSource == null ||
             credentials.AuthenticationSource.SiteId == null ||
             String.IsNullOrEmpty(credentials.AuthenticationSource.SiteId.Id) ||
             String.IsNullOrEmpty(credentials.AuthenticationSource.SiteId.Name) ||
             String.IsNullOrEmpty(credentials.AuthenticationToken) ||
             String.IsNullOrEmpty(credentials.SecurityPhrase))
         {
             return false;
         }
     }
     else
     {
         throw new ArgumentException("Invalid credential type");
     }
     if (permission == null || String.IsNullOrEmpty(permission.Name))
     {
         return false;
     }
     return true;
 }
Exemple #15
0
 //public abstract object authorizedConnect(AbstractCredentials credentials, AbstractPermission permission);
 public abstract object authorizedConnect(AbstractCredentials credentials, AbstractPermission permission, DataSource validationDataSource);
Exemple #16
0
        public IndexedHashtable connect(AbstractCredentials credentials, AbstractPermission permission, DataSource validationDataSource)
        {
            permission.IsPrimary = true;
            QueryTemplate qt = new ConnectQuery(this);
            if (validationDataSource == null)
            {
                validationDataSource = new DataSource();
            }
            qt.QueryMethod("AbstractConnection", "authorizedConnect", new object[] { credentials, permission, validationDataSource });
            IndexedHashtable t = buildResults();

            // KLUGE:  This is here to make the number of connections come out right.
            // Note that the first element in the table will be a connection, but
            // the rest either User or Exception.
            if (HasBaseConnection && myResults.Count < myCxns.Count)
            {
                IndexedHashtable t2 = new IndexedHashtable(myCxns.Count);
                t2.Add(BaseConnection.DataSource.SiteId.Id, BaseConnection);
                for (int i = 0; i < t.Count; i++)
                {
                    t2.Add(t.GetKey(i), t.GetValue(i));
                }
                t = t2;
            }
            return t;
        }
Exemple #17
0
 public override object authorizedConnect(AbstractCredentials credentials, AbstractPermission permission, DataSource validationDataSource)
 {
     IsConnected = true;
     return null;
 }
 //public abstract object authorizedConnect(AbstractCredentials credentials, AbstractPermission permission);
 public abstract object authorizedConnect(AbstractCredentials credentials, AbstractPermission permission, DataSource validationDataSource);