public async Task <string> attemptLogin(string userName, string password)
        {
            var existingData = await getDataStore(userName);

            if (existingData == null)
            {
                return(null);
            }
            string token = null;

            if (existingData.accountInformation.userName == userName && existingData.accountInformation.password == password)
            {
                //this is bad, shoudl be comparing it to a salt!
                Dictionary <string, string> payload = new Dictionary <string, string>();
                payload["userName"] = userName;
                token = myJWTHelper.buildToken(userName);
                existingData.currentToken = token;
                await setData(existingData);
            }
            return(token);
        }
예제 #2
0
        public string attemptLogin(string userName, string password)
        {
            var existingData = myCachedData.Find(x => x.accountInformation.userName == userName);

            if (existingData == null)
            {
                return(null);
            }
            string token = null;

            if (existingData.accountInformation.userName == userName && existingData.accountInformation.password == password)
            {
                //this is bad, shoudl be comparing it to a salt!
                if (existingData.currentToken != null)
                {
                    token = existingData.currentToken;
                }
                token = myJWTHelper.buildToken(userName);
                existingData.currentToken = token;
                setData(existingData);
            }
            return(token);
        }