Esempio n. 1
0
        public string Authenticate(LoginRequest request)
        {
            var appUser = _users.SingleOrDefault(x => x.Username == request.Username && x.Password == request.Password);

            //return null if user is not available
            if (appUser == null)
            {
                return(null);
            }

            //generate jwt token
            var token = _jwtProvider.generateJwtToken(appUser.UserRole);

            return(token);
        }