public User(User m_user)//not implemented
 {
     Valid      = m_user.Valid;
     UserName   = m_user.UserName;
     Password   = m_user.Password;
     Permission = m_user.Permission;
 }
Esempio n. 2
0
        public User Authinticate(string username, string password, authority au)
        {
            IEnumerable <User> temp = GetAllUsers(user => user.UserName == username && user.Password == password && au == user.Permission);

            if (temp.ToList().Count == 0)
            {
                throw new Exception("no such user!");
            }
            else
            {
                return(temp.First());
            }
        }
        public User(string userName, string password, int permission)
        {
            Valid    = true;
            UserName = userName;
            Password = password;
            switch (permission)
            {
            case 0:
                Permission = authority.Passenger;
                break;

            case 1:
                Permission = authority.Driver;
                break;

            case 2:
                Permission = authority.CEO;
                break;
            }
        }
Esempio n. 4
0
 /// <Summary>
 /// Constructor to create the context with the address of the authority and flag to turn address validation off. Using this constructor, address validation can be turned off. Make sure you are aware of the security implication of not validating the address.
 /// </Summary>
 /// <param name="authority">Address of the authority to issue token.</param>
 /// <param name="validateAuthority">Flag to turn address validation ON or OFF.</param>
 /// <param name="tokenCache">Token cache used to lookup cached tokens on calls to AcquireToken</param>
 public AuthenticationContextWrapper(string authority, bool validateAuthority, TokenCache tokenCache) => _authenticationContext = new AuthenticationContext(authority, validateAuthority, tokenCache);
Esempio n. 5
0
 /// <Summary>
 /// Constructor to create the context with the address of the authority and flag to turn address validation off. Using this constructor, address validation can be turned off. Make sure you are aware of the security implication of not validating the address.
 /// </Summary>
 /// <param name="authority">Address of the authority to issue token.</param>
 /// <param name="validateAuthority">Flag to turn address validation ON or OFF.</param>
 public AuthenticationContextWrapper(string authority, bool validateAuthority) => _authenticationContext = new AuthenticationContext(authority, validateAuthority);