isValidCredentials() public static method

public static isValidCredentials ( string authenticationMethod, AbstractCredentials credentials, AbstractPermission permission ) : bool
authenticationMethod string
credentials gov.va.medora.mdo.dao.AbstractCredentials
permission gov.va.medora.mdo.dao.AbstractPermission
return bool
Ejemplo n.º 1
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);
            }
        }