Inheritance: AbstractCredentials
Example #1
0
        // This constructor is needed for API level tests.
        public MockConnection(string siteId, string protocol, bool updateRpc = false)
            : base(null)
        {
            this.DataSource = new DataSource();
            this.DataSource.SiteId = new SiteId(siteId, "Mock");
            this.DataSource.Protocol = protocol;

            //DP 3/24/2011
            //I commented out the line below, the pid should not be set to
            //"0" as the default, as all of the other subclasses of
            //AbstractCollection do not set it.  This was causing conflicts
            //b/w the MockConnection.XML file and the DaoX tests.

            //I will fix the affected tests (14 now fail as the exception
            //message has changed).

            //this.Pid = "0";

            setXmlSource(siteId, updateRpc);

            this.Account = new VistaAccount(this);
            this.updateRpc = updateRpc;

            AbstractCredentials credentials = new VistaCredentials();
            credentials.AccountName = "AccessCode";
            credentials.AccountPassword = "******";
            AbstractPermission permission = new MenuOption(VistaConstants.MDWS_CONTEXT);
            permission.IsPrimary = true;
            this.Account.Permissions.Add(permission.Name, permission);
            //permission = new MenuOption(VistaConstants.DDR_CONTEXT);
            //this.Account.Permissions.Add(permission.Name, permission);
            sysFileHandler = new VistaSystemFileHandler(this);
        }
Example #2
0
 public static AbstractCredentials getVisitCredentials(MockApp theApp)
 {
     // Everything but the security phrase.
     AbstractCredentials result = new VistaCredentials();
     result.AuthenticationSource = new DataSource();
     result.AuthenticationSource.SiteId = new SiteId(theApp.User.LogonSiteId.Id, theApp.User.LogonSiteId.Name);
     result.LocalUid = theApp.User.Uid;
     result.FederatedUid = theApp.User.SSN.toString();
     result.SubjectName = theApp.User.Name.getLastNameFirst();
     result.SubjectPhone = theApp.User.Phone;
     return result;
 }
Example #3
0
        //[MethodImpl(MethodImplOptions.Synchronized)]
        public static AbstractCredentials getAdministrativeCredentials(Site site)
        {
            AbstractCredentials credentials = new VistaCredentials();

            credentials.LocalUid             = VistaAccount.getAdminLocalUid(site.Id);
            credentials.FederatedUid         = "123456789";
            credentials.SubjectName          = "DEPARTMENT OF DEFENSE,USER";
            credentials.SubjectPhone         = "";
            credentials.AuthenticationSource = site.getDataSourceByModality("HIS");
            credentials.AuthenticationToken  = site.Id + '_' + credentials.LocalUid;
            return(credentials);
        }
        public static AbstractCredentials getVisitCredentials(MockApp theApp)
        {
            // Everything but the security phrase.
            AbstractCredentials result = new VistaCredentials();

            result.AuthenticationSource        = new DataSource();
            result.AuthenticationSource.SiteId = new SiteId(theApp.User.LogonSiteId.Id, theApp.User.LogonSiteId.Name);
            result.LocalUid     = theApp.User.Uid;
            result.FederatedUid = theApp.User.SSN.toString();
            result.SubjectName  = theApp.User.Name.getLastNameFirst();
            result.SubjectPhone = theApp.User.Phone;
            return(result);
        }
Example #5
0
        // This constructor is needed for API level tests.
        public MockConnection(string siteId, string protocol, bool updateRpc = false)
            : base(null)
        {
            this.DataSource = new DataSource();
            this.DataSource.SiteId = new SiteId(siteId, "Mock");
            this.DataSource.Protocol = protocol;

            _sqliteCxn = new XSqliteConnection(this.DataSource);

            this.Account = new MockAccount(this);
            //this.Account.IsAuthenticated = true;
            this.updateRpc = updateRpc;

            AbstractCredentials credentials = new VistaCredentials();
            credentials.AccountName = "AccessCode";
            credentials.AccountPassword = "******";
            AbstractPermission permission = new MenuOption(VistaConstants.MDWS_CONTEXT);
            permission.IsPrimary = true;
            this.Account.Permissions.Add(permission.Name, permission);
        }
Example #6
0
        public static AbstractCredentials setVisitCredentials(
            string duz,
            string ssn,
            string username,
            string userphone,
            DataSource authenticatingSource,
            string pwd)
        {
            AbstractCredentials credentials = new gov.va.medora.mdo.dao.vista.VistaCredentials();

            credentials.LocalUid             = duz;
            credentials.FederatedUid         = ssn;
            credentials.SubjectName          = username;
            credentials.SubjectPhone         = userphone;
            credentials.AuthenticationSource = authenticatingSource;
            credentials.AuthenticationToken  = authenticatingSource.SiteId.Id + '_' + duz;
            credentials.SecurityPhrase       = pwd;

            return(credentials);
        }
Example #7
0
 internal AbstractCredentials getAdministrativeCredentials(Site site)
 {
     AbstractCredentials credentials = new VistaCredentials();
     credentials.LocalUid = VistaAccount.getAdminLocalUid(site.Id);
     credentials.FederatedUid = mySession.MdwsConfiguration.AllConfigs[ConfigFileConstants.PRIMARY_CONFIG_SECTION][MdwsConfigConstants.SERVICE_ACCOUNT_FED_UID];
     credentials.SubjectName = mySession.MdwsConfiguration.AllConfigs[ConfigFileConstants.PRIMARY_CONFIG_SECTION][MdwsConfigConstants.SERVICE_ACCOUNT_NAME];
     credentials.SubjectPhone = "";
     credentials.AuthenticationSource = site.getDataSourceByModality("HIS");
     credentials.AuthenticationToken = site.Id + '_' + credentials.LocalUid;
     return credentials;
 }
Example #8
0
        /// <summary>
        /// Visit multiple data sources without a login.
        /// </summary>
        /// <remarks>
        /// Requires no previous login.  Used by daemon apps to visit multiple sources.  Sources may be
        /// VAMCs, VISNs, some combination of VAMCs and VISNs, or the entire VHA.  See the
        /// sourceList parameter.
        /// </remarks>
        /// <param name="pwd">Client app's BSE security phrase</param>
        /// <param name="sourceList">
        /// A comma-delimited list of station numbers and/or VISN IDs, as in 
        /// "402,550" or "V12,V22" or "V1,V2,456".  To visit all VistA systems set the param
        /// to "*".  Duplicate station #'s are ignored.
        /// </param>
        /// <param name="permissionStr">If blank defaults to CPRS context</param>
        /// <returns>TaggedTextArray: each site with user DUZ or an error message</returns>
        public TaggedTextArray visitSites(string pwd, string sourceList, string userSitecode, string userName, string DUZ, string SSN, string permissionStr)
        {
            TaggedTextArray result = new TaggedTextArray();

            if (String.IsNullOrEmpty(pwd))
            {
                result.fault = new FaultTO("Missing pwd");
            }
            else if (String.IsNullOrEmpty(sourceList))
            {
                result.fault = new FaultTO("Missing sitelist");
            }
            else if (String.IsNullOrEmpty(userSitecode))
            {
                result.fault = new FaultTO("Missing userSitecode");
            }
            else if (String.IsNullOrEmpty(userName))
            {
                result.fault = new FaultTO("Missing userName");
            }
            else if (String.IsNullOrEmpty(DUZ))
            {
                result.fault = new FaultTO("Missing DUZ");
            }
            else if (String.IsNullOrEmpty(SSN))
            {
                result.fault = new FaultTO("Missing SSN");
            }
            if (result.fault != null)
            {
                return result;
            }

            if (String.IsNullOrEmpty(permissionStr))
            {
                permissionStr = mySession.DefaultPermissionString;
            }

            try
            {
                // Build the credentials
                Site site = mySession.SiteTable.getSite(userSitecode);
                DataSource src = site.getDataSourceByModality("HIS");

                AbstractCredentials creds = new VistaCredentials();
                creds.AuthenticationSource = src;
                creds.AuthenticationToken = userSitecode + '_' + DUZ;
                creds.FederatedUid = SSN;
                creds.LocalUid = DUZ;
                creds.SecurityPhrase = pwd;
                creds.SubjectName = userName;
                creds.SubjectPhone = "";

                User user = new User();
                user.UserName = userName;
                user.Uid = DUZ;
                user.SSN = new SocSecNum(SSN);

                mySession.PrimaryPermission = new MenuOption(permissionStr);

                // Make next call think there's been a login
                mySession.Credentials = creds;
                mySession.User = user;

                // visitSites
                return visitSites(pwd, sourceList, permissionStr);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e);
            }

            return result;
        }
Example #9
0
        /// <summary>
        /// Visit multiple data sources without a login.
        /// </summary>
        /// <remarks>
        /// Requires no previous login.  Used by daemon apps to visit multiple sources.  Sources may be
        /// VAMCs, VISNs, some combination of VAMCs and VISNs, or the entire VHA.  See the
        /// sourceList parameter.
        /// </remarks>
        /// <param name="pwd">Client app's BSE security phrase</param>
        /// <param name="sourceList">
        /// A comma-delimited list of station numbers and/or VISN IDs, as in 
        /// "402,550" or "V12,V22" or "V1,V2,456".  To visit all VistA systems set the param
        /// to "*".  Duplicate station #'s are ignored.
        /// </param>
        /// <param name="permissionStr">If blank defaults to CPRS context</param>
        /// <returns>TaggedTextArray: each site with user DUZ or an error message</returns>
        public TaggedTextArray visitSites(string pwd, string sourceList, string userSitecode, string userName, string DUZ, string permissionStr)
        {
            TaggedTextArray result = new TaggedTextArray();

            if (String.IsNullOrEmpty(pwd))
            {
                result.fault = new FaultTO("Missing pwd");
            }
            else if (String.IsNullOrEmpty(sourceList))
            {
                result.fault = new FaultTO("Missing sitelist");
            }
            else if (String.IsNullOrEmpty(userSitecode))
            {
                result.fault = new FaultTO("Missing userSitecode");
            }
            else if (String.IsNullOrEmpty(userName))
            {
                result.fault = new FaultTO("Missing userName");
            }
            else if (String.IsNullOrEmpty(DUZ))
            {
                result.fault = new FaultTO("Missing DUZ");
            }
            if (result.fault != null)
            {
                return result;
            }

            if (String.IsNullOrEmpty(permissionStr))
            {
                permissionStr = mySession.DefaultPermissionString;
            }

            try
            {
                // Do an admin visit to get user's SSN
                User theUser = getVisitorData(userSitecode, DUZ, pwd);

                // Build the credentials
                Site site = mySession.SiteTable.getSite(userSitecode);
                DataSource src = site.getDataSourceByModality("HIS");

                AbstractCredentials creds = new VistaCredentials();
                creds.AuthenticationSource = src;
                creds.AuthenticationToken = userSitecode + '_' + theUser.Uid;
                creds.FederatedUid = theUser.SSN.toString();
                creds.LocalUid = theUser.Uid;
                creds.SecurityPhrase = pwd;
                creds.SubjectName = theUser.Name.getLastNameFirst();
                creds.SubjectPhone = theUser.Phone;

                mySession.PrimaryPermission = new MenuOption(permissionStr);

                // Make next call think there's been a login
                mySession.Credentials = creds;

                // visitSites
                return visitSites(pwd, sourceList, permissionStr);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e);
            }

            return result;
        }
Example #10
0
        public static AbstractCredentials setVisitCredentials(
            string duz,
            string ssn,
            string username,
            string userphone,
            DataSource authenticatingSource,
            string pwd)
        {
            AbstractCredentials credentials = new gov.va.medora.mdo.dao.vista.VistaCredentials();
            credentials.LocalUid = duz;
            credentials.FederatedUid = ssn;
            credentials.SubjectName = username;
            credentials.SubjectPhone = userphone;
            credentials.AuthenticationSource = authenticatingSource;
            credentials.AuthenticationToken = authenticatingSource.SiteId.Id + '_' + duz;
            credentials.SecurityPhrase = pwd;

            return credentials;
        }
Example #11
0
 void login(AbstractConnection cxn)
 {
     AbstractPermission permission = new MenuOption(VistaConstants.CPRS_CONTEXT);
     permission.IsPrimary = true;
     cxn.Account.AuthenticationMethod = VistaConstants.LOGIN_CREDENTIALS;
     AbstractCredentials creds = new VistaCredentials();
     //creds.AccountName = "1programmer";
     //creds.AccountPassword = "******";
     creds.AccountName = "CLERKWARD01";
     creds.AccountPassword = "******";
     cxn.Account.authenticateAndAuthorize(creds, permission);
 }