public static RemotingConnection <T> Factory(string company, string application, APPENV environment) { var cSpc = cnUtil.CONNCFGSECTION[company, application, environment]; IDictionary propBag = new Hashtable(); propBag["port"] = cSpc.Port; propBag["name"] = string.Format("{0}:{1}", cSpc.ServerName, cSpc.Port); propBag["connectionTimeout"] = cSpc.RemotingTimeout.ToString(); if (cSpc.RemotingSecurityMode == RemSecMode.Identify) { propBag["secure"] = true; propBag["tokenImpersonationLevel"] = TokenImpersonationLevel.Identification; propBag["useDefaultCredentials"] = true; } RemotingProtocol remProt; if (lib.EnumTryParse(cSpc.Protocol, out remProt)) { remProt = RemotingProtocol.Http; } var url = cnUtil.BuildConnectionUrl(company, application, environment); return(new RemotingConnection <T>(remProt, url, propBag)); }
public static string DecryptTripleDES(string srcValue, string sCompany, string sApplication, APPENV Environment, HashAlg?ha = null) { switch (Environment) { case (APPENV.NA): return(DecryptTripleDES(srcValue, TKEY, TIV)); default: var sMode = lib.GetAppMode(Environment); var sc = new StringBuilder( sCompany + "/" + sApplication); var secKey = sc.ToString(); var AppS = (IDictionary)CfgMgr.GetSection(secKey); string sKEY = (string)AppS[sMode + "_KEY"], sIV = (string)AppS[sMode + "_IV"]; return((sKEY == null || sIV == null) ? DecryptTripleDES(srcValue, TKEY, TIV) : DecryptTripleDES(srcValue, SizeKey(sKEY, 24, ha), SizeKey(sIV, 8, ha))); } }
public static string Encrypt(string srcValue, string sCompany, string sApplication, APPENV Environment, HashAlg?ha = null) { switch (Environment) { case (APPENV.NA): return(Encrypt(srcValue, SKEY, SIV)); default: var sMode = lib.GetAppMode(Environment); var sc = new StringBuilder( sCompany + "/" + sApplication); var secKey = sc.ToString(); var AppS = (IDictionary)CfgMgr.GetSection(secKey); string sKEY = (string)AppS[sMode + "_KEY"], sIV = (string)AppS[sMode + "_IV"]; return(string.IsNullOrWhiteSpace(srcValue) ? null : (sKEY == null || sIV == null)? Encrypt(srcValue, SKEY, SIV): Encrypt(srcValue, SizeKey(sKEY, 8, ha), SizeKey(sIV, 8, ha))); } }
public ConnSpec this[string CompanyName, string AppName, APPENV env] { get { if (!ConnCompanys.Contains(CompanyName)) { throw new CoPDataConfigurationException( "Cannot locate ConnSpec Configuration " + $"section for Company: {CompanyName}"); } if (!ConnCompanys[CompanyName].ConnApps.Contains(AppName)) { throw new CoPDataConfigurationException( "Cannot locate ConnSpec Configuration section " + $"for Company.Application: {CompanyName}.{AppName}"); } if (!ConnCompanys[CompanyName].ConnApps.Contains(AppName)) { throw new CoPDataConfigurationException( "Cannot locate ConnSpec Configuration section " + $"for Company.Application.Environment: {CompanyName}.{AppName}.{env}"); } return(ConnCompanys[CompanyName][AppName, env]); } }
/// <summary> /// Factory overload to construct WcfWrapper /// </summary> /// <param name="companyName">Company Name to index into Connections Config</param> /// <param name="serviceName">Service Name to index into Connections Config</param> /// <param name="environment">Environment to index into Connections Config</param> /// <returns>Manufactured WcfProxyWrapper</returns> public static WcfProxyWrapper <I> Factory(string companyName, string serviceName, APPENV environment, InstanceContext instCtx = null) { return(Factory(companyName, serviceName, environment, cnUtil.GetUserId(companyName, serviceName, environment), cnUtil.GetPassword(companyName, serviceName, environment), instCtx)); }
/// <summary> /// Factory overload to construct WcfWrapper /// </summary> /// <param name="companyName">Company Name to index into Connections Config</param> /// <param name="serviceName">Service Name to index into Connections Config</param> /// <param name="environment">Environment to index into Connections Config</param> /// <param name="userId">WCF logon user id</param> /// <param name="password">WCF password</param> /// <returns>Manufactured WcfProxyWrapper</returns> public static WcfProxyWrapper <I> Factory( string companyName, string serviceName, APPENV environment, string userId, string password, InstanceContext instCtx = null) { var bndng = cnUtil.GetServiceBinding(companyName, serviceName, environment); var url = cnUtil.BuildWcfUrl(companyName, serviceName, environment); var maxGrphItms = cnUtil.GetMaxItemsInObjectGraph(companyName, serviceName, environment); var svrSideUpn = cnUtil.GetServerSideUPN(companyName, serviceName, environment); return(Factory(bndng, url, userId, password, instCtx, maxGrphItms, svrSideUpn)); }
public ConnSpec this[APPENV appEnv] { get { foreach (var con in ConnSpecs.Where( con => con.Environments.Contains(appEnv))) { return(con); } throw new CoPDataConfigurationException(string.Format( "Cannot locate ConnSpec Configuration section " + "for Environment: {0}", appEnv)); } }