コード例 #1
0
 public bool IsValid(string login, string passwordHash)
 {
     var user = new VtecTeamDBManager().GetUser(login);
     var result = user != null && user.PasswordHash == passwordHash;
     if (result)
         User = user;
     return result;
 }
コード例 #2
0
        public bool IsValid(string login, string passwordHash)
        {
            var user   = new VtecTeamDBManager().GetUser(login);
            var result = user != null && user.PasswordHash == passwordHash;

            if (result)
            {
                User = user;
            }
            return(result);
        }
コード例 #3
0
 public string Build(string login, string passwordHash)
 {
     if (!new UserCredentialValidator().IsValid(login, passwordHash))
     {
         throw new AuthenticationException();
     }
     var token = Guid.NewGuid().ToString();
     var dbManager = new VtecTeamDBManager();
     var user = dbManager.GetUser(login);
     if (user == null)
     {
         throw new AuthenticationException();
     }
     if (!dbManager.SaveToken(new Token {TokenString = token, User = user, CreateDate = DateTime.Now}))
         throw new AuthenticationException("Проблемы с БД");
     return token;
 }
コード例 #4
0
        public string Build(string login, string passwordHash)
        {
            if (!new UserCredentialValidator().IsValid(login, passwordHash))
            {
                throw new AuthenticationException();
            }
            var token     = Guid.NewGuid().ToString();
            var dbManager = new VtecTeamDBManager();
            var user      = dbManager.GetUser(login);

            if (user == null)
            {
                throw new AuthenticationException();
            }
            if (!dbManager.SaveToken(new Token {
                TokenString = token, User = user, CreateDate = DateTime.Now
            }))
            {
                throw new AuthenticationException("Проблемы с БД");
            }
            return(token);
        }
コード例 #5
0
 public bool IsValid(string tokenText)
 {
     var token = new VtecTeamDBManager().GetToken(tokenText); 
     return token != null && !IsExpired(token);
 }
コード例 #6
0
        public bool IsValid(string tokenText)
        {
            var token = new VtecTeamDBManager().GetToken(tokenText);

            return(token != null && !IsExpired(token));
        }