コード例 #1
0
ファイル: SferaService.cs プロジェクト: gipasoft/Sfera
			public override void Validate(string username, string password)
			{
				if (null == username || null == password)
					throw new ArgumentNullException();

				var rep = new AziendaRepository(new UserInfo { Azienda = 1 });
				IWindsorContainer container;
				var utenteAutenticato = rep.VerifyUser(null, username, password, null, out container);

				if (utenteAutenticato == null)
				{
					_log.ErrorFormat("Errore di autenticazione - utente: {0} - pwd: {1}", username, password);
					throw new FaultException("Errore di autenticazione - Utente sconosciuto o password sbagliata");
				}
			    Security.Login.Instance.SetLoginInfo(new Security.LoginInfo(utenteAutenticato.Username,
			        utenteAutenticato.Password,
			        utenteAutenticato.Nome,
			        utenteAutenticato.Cognome,
                    string.Empty,
			        utenteAutenticato.IdAzienda.GetValueOrDefault(),
			        null,
			        null,
			        utenteAutenticato.Id,
			        string.Empty,
			        0,
			        false,
			        "it-IT",
			        false,
			        false,
                    null, 
                    null));
			}
コード例 #2
0
ファイル: SferaService.cs プロジェクト: gipasoft/Sfera
		public UtenteDTO VerificaUtente(string codiceAzienda, string username, string password, ComputerDTO computerInfo)
		{
            var windsorRep = new WindsorConfigRepository();
			try
			{
                var repo = new AziendaRepository();
				IWindsorContainer container;
                var utenteVerifica = repo.VerifyUser(codiceAzienda, username, password, computerInfo, out container);
				UtenteDTO utente = null;

				if (utenteVerifica != null)
				{
					utente = repo.GetUtenteById(utenteVerifica.Id, container);
					utente.IdAzienda = utenteVerifica.IdAzienda.GetValueOrDefault();
                    _log.InfoFormat("L'utente: {0} si è collegato.", utente.Username);
                    windsorRep.Commit();
                }
				else
				{
                    _log.InfoFormat("L'utente: {0} ha tentato il collegamento con la password: {1}", username, password);
				}

				return utente;
			}
			catch (Exception ex)
			{
				_log.ErrorFormat("Errore nel riconoscimento dell'utente - {0}", ex, Utility.GetMethodDescription());
				throw;
			}
		}