コード例 #1
0
		public static OperationResult tokenStartServerAuthentication(string applicationUser, string tokenID, string dataEntropy, string baseNotifyMessage, out string requestedPassword)
		{
			requestedPassword = null;
			long tokenEventID = 0L;
			OperationResult _hResult = OperationResult.Error;
			TokenCryptoData _tkCryptoData = default(TokenCryptoData);
			ITokenRules _TKRules = TokenRulesFactory.LoadAssembly(SAFConfiguration.readParameterExternal("SAFClientBusinessRules"));
			OperationResult result;
			try
			{
				TokenStatus _oldCoreStatus;
				if (!SAFBaseFunctions._checkStatusConsistency(tokenID, applicationUser, out _oldCoreStatus))
				{
					new TokensBusinessEventsDAO().insertTokenEvent(tokenID, 103, 83, applicationUser, out tokenEventID);
					_hResult = (result = OperationResult.WrongStatusForRequestedOperation);
				}
				else
				{
					if (_oldCoreStatus != TokenStatus.Enabled)
					{
						new TokensBusinessEventsDAO().insertTokenEvent(tokenID, 103, 83, applicationUser, out tokenEventID);
						_hResult = (result = OperationResult.WrongStatusForRequestedOperation);
					}
					else
					{
						if (_TKRules != null)
						{
							_tkCryptoData = new TokensDAO().loadTokenCryptoData(tokenID);
							if (OperationResult.Success != (_hResult = _TKRules.BeforeStartServerAuthentication(applicationUser, tokenID, baseNotifyMessage, _tkCryptoData.TokenBaseParams.MovingFactorType, _tkCryptoData.TokenBaseParams.SeedType)))
							{
								new TokensBusinessEventsDAO().insertTokenEvent(tokenID, 103, (int)_hResult, applicationUser, out tokenEventID);
								result = _hResult;
								return result;
							}
						}
						_hResult = new PREProcessorTokens().StartServerAuthentication(tokenID, dataEntropy, out requestedPassword);
						new TokensBusinessEventsDAO().insertTokenEvent(tokenID, 103, (int)_hResult, applicationUser, out tokenEventID);
						if (_hResult == OperationResult.Success)
						{
							if (_TKRules != null)
							{
								_hResult = _TKRules.AfterStartServerAuthentication(applicationUser, tokenID, baseNotifyMessage + "|" + requestedPassword, requestedPassword, _tkCryptoData.TokenBaseParams.MovingFactorType, _tkCryptoData.TokenBaseParams.SeedType);
							}
						}
						if (_hResult != OperationResult.Success)
						{
							new TokensBusinessEventsDAO().insertTokenEvent(tokenID, 103, (int)_hResult, applicationUser, out tokenEventID);
						}
						result = _hResult;
					}
				}
			}
			catch (Exception ex)
			{
				SAFBaseFunctions._logger(SAFLOGGER.LOGGEREventID.EXCEPTION, "SAFBUSINESS", new string[]
				{
					"http://sfexpand.SAFBusiness.DBConnectionString.softfinanca.com/",
					Assembly.GetExecutingAssembly().FullName.ToString(),
					ex.ToString()
				});
				_hResult = (result = OperationResult.Error);
			}
			finally
			{
				APPEVENTSDeff arg_1FA_0 = APPEVENTSDeff.OPERATIONS_EXECUTED;
				int arg_1FA_1 = 103;
				string arg_1FA_2 = "SAFBUSINESS";
				string[] array = new string[2];
				array[0] = TokenEventOperation.cTOKEN_START_SERVER_AUTHENTICATION.ToString();
				string[] arg_1F7_0 = array;
				int arg_1F7_1 = 1;
				int num = (int)_hResult;
				arg_1F7_0[arg_1F7_1] = num.ToString();
				SAFInternalEvents.Export(arg_1FA_0, arg_1FA_1, arg_1FA_2, array);
			}
			return result;
		}
コード例 #2
0
		public static OperationResult tokenCreate(string applicationUser, string applicationUseruserPhone, string applicationEmail, string tokenVendorID, string expirationDate, string supplierSerialNumber, string creationLotID, string pin, string baseNotifyMessage, out TokenInfo tokenInfo)
		{
			long tokenEventID = 0L;
			OperationResult _hResult = OperationResult.Error;
			ITokenRules _TKRules = TokenRulesFactory.LoadAssembly(SAFConfiguration.readParameterExternal("SAFClientBusinessRules"));
			DateTime _dtExpiration;
			if (!DateTime.TryParse(expirationDate, out _dtExpiration))
			{
				_dtExpiration = DateTime.MaxValue;
			}
			OperationResult result;
			try
			{
				if (_TKRules != null)
				{
					if (OperationResult.Success != (_hResult = _TKRules.BeforeCreate(applicationUser, applicationUseruserPhone, applicationEmail, tokenVendorID, expirationDate, supplierSerialNumber, creationLotID, pin, baseNotifyMessage)))
					{
						new TokensBusinessEventsDAO().insertTokenEvent("0", 100, (int)_hResult, applicationUser, out tokenEventID);
						tokenInfo = new TokenInfo();
						result = _hResult;
						return result;
					}
				}
				TokenInfoCore _tkInfoCore;
				if (OperationResult.Success == (_hResult = new PREProcessorTokens().Create(tokenVendorID, _dtExpiration, supplierSerialNumber, creationLotID, pin, out _tkInfoCore)))
				{
					if (OperationResult.Success != (_hResult = new TokenBusinessDAO().insertTokenUser(_tkInfoCore, applicationUser, applicationUseruserPhone, applicationEmail, out tokenInfo, out tokenEventID)))
					{
						SAFBaseFunctions._logger(SAFLOGGER.LOGGEREventID.ERROR, "SAFBUSINESS", new string[]
						{
							"http://sfexpand.SAFBusiness.DBConnectionString.softfinanca.com/",
							Assembly.GetExecutingAssembly().FullName.ToString(),
							"unable to create token on [business] DB"
						});
						if (OperationResult.Success != (_hResult = new PREProcessorTokens().UndoCreate(_tkInfoCore.InternalID.ToString())))
						{
							SAFBaseFunctions._logger(SAFLOGGER.LOGGEREventID.WARNING, "SAFBUSINESS", new string[]
							{
								"http://sfexpand.SAFBusiness.DBConnectionString.softfinanca.com/",
								"unable to undoCreate token on [core] DB"
							});
						}
					}
					else
					{
						if (_TKRules != null)
						{
							result = _TKRules.AfterCreate(applicationUser, applicationUseruserPhone, applicationEmail, tokenVendorID, expirationDate, supplierSerialNumber, creationLotID, pin, baseNotifyMessage + "|" + tokenEventID.ToString(), _tkInfoCore.InternalID, tokenEventID, _tkInfoCore.InternalStatus);
							return result;
						}
						_hResult = OperationResult.Success;
						result = _hResult;
						return result;
					}
				}
				else
				{
					SAFBaseFunctions._logger(SAFLOGGER.LOGGEREventID.ERROR, "SAFBUSINESS", new string[]
					{
						"http://sfexpand.SAFBusiness.DBConnectionString.softfinanca.com/",
						Assembly.GetExecutingAssembly().FullName.ToString(),
						"unable to create token on [core] DB"
					});
				}
				new TokensBusinessEventsDAO().insertTokenEvent("0", 100, (int)_hResult, applicationUser, out tokenEventID);
				tokenInfo = new TokenInfo();
				_hResult = (result = OperationResult.Error);
			}
			catch (Exception ex)
			{
				SAFBaseFunctions._logger(SAFLOGGER.LOGGEREventID.EXCEPTION, "SAFBUSINESS", new string[]
				{
					"http://sfexpand.SAFBusiness.DBConnectionString.softfinanca.com/",
					Assembly.GetExecutingAssembly().FullName.ToString(),
					"unable to create token!",
					ex.ToString()
				});
				tokenInfo = new TokenInfo();
				_hResult = (result = OperationResult.Error);
			}
			finally
			{
				APPEVENTSDeff arg_294_0 = APPEVENTSDeff.OPERATIONS_EXECUTED;
				int arg_294_1 = 100;
				string arg_294_2 = "SAFBUSINESS";
				string[] array = new string[2];
				array[0] = TokenEventOperation.cTOKEN_CREATED.ToString();
				string[] arg_291_0 = array;
				int arg_291_1 = 1;
				int num = (int)_hResult;
				arg_291_0[arg_291_1] = num.ToString();
				SAFInternalEvents.Export(arg_294_0, arg_294_1, arg_294_2, array);
			}
			return result;
		}
コード例 #3
0
		private static AutenticationStatus _tokenPasswordValidation(string applicationUser, string tokenID, string tokenPassword, string dataEntropy, out string newChallenge)
		{
			newChallenge = null;
			AutenticationStatus result;
			try
			{
				TokenStatus _oldCoreStatus;
				if (!SAFBaseFunctions._checkStatusConsistency(tokenID, applicationUser, out _oldCoreStatus))
				{
					result = AutenticationStatus.ErrorCheckTokenStatus;
				}
				else
				{
					if (_oldCoreStatus != TokenStatus.Enabled)
					{
						result = AutenticationStatus.TokenNotFoundOrCanceled;
					}
					else
					{
						result = new PREProcessorTokens().Autenticate(tokenID, tokenPassword, dataEntropy, out newChallenge);
					}
				}
			}
			catch (Exception ex)
			{
				SAFBaseFunctions._logger(SAFLOGGER.LOGGEREventID.EXCEPTION, "SAFBUSINESS", new string[]
				{
					"http://sfexpand.SAFBusiness.DBConnectionString.softfinanca.com/",
					Assembly.GetExecutingAssembly().FullName.ToString(),
					"userToken ::[" + applicationUser + "]",
					ex.ToString()
				});
				result = AutenticationStatus.AutenticationProcessFail;
			}
			return result;
		}
コード例 #4
0
		public static OperationResult tokenEnable(string applicationUser, string tokenID, string baseNotifyMessage)
		{
			long tokenEventID = 0L;
			OperationResult _hResult = OperationResult.Error;
			ITokenRules _TKRules = TokenRulesFactory.LoadAssembly(SAFConfiguration.readParameterExternal("SAFClientBusinessRules"));
			OperationResult result;
			try
			{
				TokenStatus _oldCoreStatus;
				if (!SAFBaseFunctions._checkStatusConsistency(tokenID, applicationUser, out _oldCoreStatus))
				{
					new TokensBusinessEventsDAO().insertTokenEvent(tokenID, 1, 83, applicationUser, out tokenEventID);
					_hResult = (result = OperationResult.WrongStatusForRequestedOperation);
				}
				else
				{
					if (_oldCoreStatus == TokenStatus.Canceled)
					{
						new TokensBusinessEventsDAO().insertTokenEvent(tokenID, 1, 83, applicationUser, out tokenEventID);
						_hResult = (result = OperationResult.WrongStatusForRequestedOperation);
					}
					else
					{
						if (_TKRules != null)
						{
							if (OperationResult.Success != (_hResult = _TKRules.BeforeEnable(applicationUser, tokenID, baseNotifyMessage, _oldCoreStatus)))
							{
								new TokensBusinessEventsDAO().insertTokenEvent(tokenID, 1, (int)_hResult, applicationUser, out tokenEventID);
								result = _hResult;
								return result;
							}
						}
						if (OperationResult.Success == (_hResult = new PREProcessorTokens().AllowedUse(tokenID)))
						{
							if (OperationResult.Success == (_hResult = new TokenBusinessDAO().tokenAllowedUse(applicationUser, tokenID, out tokenEventID)))
							{
								if (_TKRules != null)
								{
									result = _TKRules.AfterEnable(applicationUser, tokenID, baseNotifyMessage);
									return result;
								}
								_hResult = (result = OperationResult.Success);
								return result;
							}
							else
							{
								if (_oldCoreStatus == TokenStatus.Enabled)
								{
									new PREProcessorTokens().InhibitedUse(tokenID);
								}
								if (_oldCoreStatus == TokenStatus.Disabled)
								{
									new PREProcessorTokens().AllowedUse(tokenID);
								}
							}
						}
						SAFBaseFunctions._logger(SAFLOGGER.LOGGEREventID.ERROR, "SAFBUSINESS", new string[]
						{
							"http://sfexpand.SAFBusiness.DBConnectionString.softfinanca.com/",
							Assembly.GetExecutingAssembly().FullName.ToString(),
							"unable to enable token::[" + applicationUser + "]"
						});
						new TokensBusinessEventsDAO().insertTokenEvent(tokenID, 1, -1, applicationUser, out tokenEventID);
						_hResult = (result = OperationResult.Error);
					}
				}
			}
			catch (Exception ex)
			{
				SAFBaseFunctions._logger(SAFLOGGER.LOGGEREventID.EXCEPTION, "SAFBUSINESS", new string[]
				{
					"http://sfexpand.SAFBusiness.DBConnectionString.softfinanca.com/",
					Assembly.GetExecutingAssembly().FullName.ToString(),
					"unable to enable token::[" + applicationUser + "]",
					ex.ToString()
				});
				_hResult = (result = OperationResult.Error);
			}
			finally
			{
				APPEVENTSDeff arg_225_0 = APPEVENTSDeff.OPERATIONS_EXECUTED;
				int arg_225_1 = 1;
				string arg_225_2 = "SAFBUSINESS";
				string[] array = new string[2];
				array[0] = TokenEventOperation.cTOKEN_ENABLE.ToString();
				string[] arg_222_0 = array;
				int arg_222_1 = 1;
				int num = (int)_hResult;
				arg_222_0[arg_222_1] = num.ToString();
				SAFInternalEvents.Export(arg_225_0, arg_225_1, arg_225_2, array);
			}
			return result;
		}
コード例 #5
0
		public static OperationResult tokenResetChallenge(string applicationUser, string tokenID, string baseNotifyMessage)
		{
			long tokenEventID = 0L;
			OperationResult result;
			try
			{
				TokenStatus _oldCoreStatus;
				if (!SAFBaseFunctions._checkStatusConsistency(tokenID, applicationUser, out _oldCoreStatus))
				{
					new TokensBusinessEventsDAO().insertTokenEvent(tokenID, 105, 83, applicationUser, out tokenEventID);
					result = OperationResult.WrongStatusForRequestedOperation;
				}
				else
				{
					if (_oldCoreStatus != TokenStatus.Enabled)
					{
						new TokensBusinessEventsDAO().insertTokenEvent(tokenID, 105, 83, applicationUser, out tokenEventID);
						result = OperationResult.WrongStatusForRequestedOperation;
					}
					else
					{
						OperationResult _hResult = new PREProcessorTokens().ResetChallengeRequest(tokenID);
						new TokensBusinessEventsDAO().insertTokenEvent(tokenID, 105, (int)_hResult, applicationUser, out tokenEventID);
						result = _hResult;
					}
				}
			}
			catch (Exception ex)
			{
				SAFBaseFunctions._logger(SAFLOGGER.LOGGEREventID.EXCEPTION, "SAFBUSINESS", new string[]
				{
					"http://sfexpand.SAFBusiness.DBConnectionString.softfinanca.com/",
					Assembly.GetExecutingAssembly().FullName.ToString(),
					ex.ToString()
				});
				result = OperationResult.Error;
			}
			return result;
		}