示例#1
0
文件: VizFBDAO.cs 项目: radtek/vas
        public Settings SaveFBDetails(FBData fbData)
        {
            try
            {
                long userId = SaveFBUser(fbData.User);

                if (userId > 0)
                {
                    bool hasAllFriendsSaved = SaveFBFriends(fbData.Friends, userId);
                    if (hasAllFriendsSaved)
                    {
                        SaveDefaultSettings(userId);
                        return(GetSettings(userId));
                    }
                    else
                    {
                        throw new AppException(ErrorCode.FBFRIENDS_SAVE_FAILED);
                    }
                }
                else
                {
                    throw new AppException(ErrorCode.FBUSER_SAVE_FAILED);
                }
            }
            catch (Exception e)
            {
                Logger.Error(e.Message);
                throw new AppException(ErrorCode.SQL_GENERAL_ERROR);
            }
        }
示例#2
0
        public async Task <IActionResult> LoginCallback(FacebookLoginDto dto)
        {
            var tokenExchangeResponse = await "https://graph.facebook.com/oauth/access_token"
                                        .SetQueryParams(new
            {
                client_id     = _configuration[Constants.FB_ID],
                client_secret = _configuration[Constants.FB_SECRET],
                grant_type    = "client_credentials"
            })
                                        .GetJsonAsync <FbAccessToken>();


            var response = await "https://graph.facebook.com/debug_token"
                           .SetQueryParams(new
            {
                input_token  = dto.AccessToken,
                access_token = tokenExchangeResponse.Access_Token
            })
                           .GetJsonAsync();

            var fbData = new FBData()
            {
                App_id   = response.data.app_id,
                Is_valid = response.data.is_valid,
                User_id  = response.data.user_id
            };

            if (_authService.ValidateFbData(fbData, dto))
            {
                return(Ok(await _authService.AttemptLoginWithFacebookAsync(dto)));
            }

            return(Unauthorized());
        }
示例#3
0
        static void ListPrimitive(string parent, JSONObject obj, List <FBData> fbdata)
        {
            var fb = new FBData();

            fb.path = parent;
            fb.data = obj;
            fbdata.Add(fb);
        }
示例#4
0
 void Activate(FBData currData)
 {
     finalLifePoints = (int)currData.data.i;
     GameController.PlayAudio("Counter going up or down");
     currentSeconds = 0.0f;
     startSound     = true;
     Debug.Log(finalLifePoints);
 }
示例#5
0
        public Settings SaveFBDetails(FBData fbData)
        {
            IVizFBService service = ObjectFactory.Resolve <IVizFBService>();

            Settings settings = service.SaveFBDetails(fbData);
            var      session  = HttpContext.Current.Session;

            session["authinfo"] = fbData.User;
            return(settings);
        }
示例#6
0
 protected virtual void Activate(FBData currData)
 {
     if (currData.data.IsString)
     {
         cardName = currData.data.str;
         StartCoroutine(DrawCard(cardName));
     }
     else
     {
         position = (int)currData.data.i;
     }
 }
示例#7
0
    void Update()
    {
        if (currData.ready)
        {
            var obj = transform.Find(currData.path);
            if (obj != null)
            {
                Debug.Log(currData.path + ": " + currData.data);

                obj.gameObject.SendMessage("Activate", currData);
            }
            currData = default(FBData);
        }
    }
示例#8
0
        internal void ValidateSaveFBDetails(FBData fbData)
        {
            if (fbData == null)
            {
                AddError(ErrorCode.INVALID_USER);
            }
            if (fbData.User.id.Equals(string.Empty) || fbData.User.id.Equals(Zero))
            {
                AddError(ErrorCode.INVALID_FB_USER);
            }

            if (NoErrors)
            {
                return;
            }

            throw ClientException;
        }
示例#9
0
        private FBData getFBData()
        {
            FBData data = new FBData();

            data.User             = new FBUser();
            data.User.id          = "100006286272328";
            data.User.Work        = new List <FBEmployer>();
            data.User.FirstName   = "Fixture";
            data.User.UserName    = "******";
            data.User.TimeZone    = "5.5";
            data.User.Verified    = true;
            data.User.Locale      = "en_US";
            data.User.Link        = "https://www.facebook.com/fixture.unity";
            data.User.Name        = "Fixture Apps";
            data.User.LastName    = "Apps";
            data.User.Gender      = "male";
            data.User.UpdatedTime = DateTime.Parse("28 Dec 2013 14:11:06");
            data.User.ProfileUrl  = "http://facebook.com/unityteam";

            List <FBFriend> frnds = new List <FBFriend>();

            frnds.Add(CreateFriend("537462998", "Rakesh Ks", "https://m.ak.fbcdn.net/profile.ak/hprofile-ak-ash3/t5/370187_537462998_1257659137_q.jpg", "http://facebook.com/Rakesh Ks", "12.12", "12.12", "Rakesh [email protected]", "3467738468", true));
            frnds.Add(CreateFriend("610332030", "Donn Kabiraj", "https://m.ak.fbcdn.net/profile.ak/hprofile-ak-ash3/t5/623595_610332030_1326593215_q.jpg", "http://facebook.com/Donn Kabiraj", "12.12", "12.12", "Donn [email protected]", "3467738468", true));
            frnds.Add(CreateFriend("1084553779", "Purna Kumar", "https://m.ak.fbcdn.net/profile.ak/hprofile-ak-ash2/t5/370138_1084553779_897804858_q.jpg", "http://facebook.com/Purna Kumar", "12.12", "12.12", "Purna [email protected]", "3467738468", true));
            frnds.Add(CreateFriend("1320114662", "R.Ratish Kumar", "https://m.ak.fbcdn.net/profile.ak/hprofile-ak-frc1/t5/371795_1320114662_425662618_q.jpg", "http://facebook.com/R.Ratish Kumar", "12.12", "12.12", "R.Ratish [email protected]", "3467738468", true));
            frnds.Add(CreateFriend("1377566050", "Ranjith Selvaraj", "https://m.ak.fbcdn.net/profile.ak/hprofile-ak-frc1/t5/372425_1377566050_457968711_q.jpg", "http://facebook.com/Ranjith Selvaraj", "12.12", "12.12", "Ranjith [email protected]", "3467738468", true));
            frnds.Add(CreateFriend("1440228172", "Pramod Kumar Bugudai", "https://m.ak.fbcdn.net/profile.ak/hprofile-ak-ash2/t5/273655_1440228172_664609_q.jpg", "http://facebook.com/Pramod Kumar Bugudai", "12.12", "12.12", "Pramod Kumar [email protected]", "3467738468", true));
            frnds.Add(CreateFriend("100000056538048", "Vijay Anand Mca", "https://m.ak.fbcdn.net/profile.ak/hprofile-ak-frc1/t5/371080_100000056538048_459916951_q.jpg", "http://facebook.com/Vijay Anand Mca", "12.12", "12.12", "Vijay Anand [email protected]", "3467738468", true));
            frnds.Add(CreateFriend("100000553569379", "Prem Kumar Aol", "https://m.ak.fbcdn.net/profile.ak/hprofile-ak-ash2/t5/1116376_100000553569379_1770598516_q.jpg", "http://facebook.com/Prem Kumar Aol", "12.12", "12.12", "Prem Kumar [email protected]", "3467738468", true));
            frnds.Add(CreateFriend("100000662701952", "Suresh Elumalai", "https://m.ak.fbcdn.net/profile.ak/hprofile-ak-prn2/t5/1119178_100000662701952_1950039565_q.jpg", "http://facebook.com/Suresh Elumalai", "12.12", "12.12", "Suresh [email protected]", "3467738468", true));
            frnds.Add(CreateFriend("100000689750777", "Stephen Arputharaj", "https://m.ak.fbcdn.net/profile.ak/hprofile-ak-prn2/t5/1118303_100000689750777_132852229_q.jpg", "http://facebook.com/Stephen Arputharaj", "12.12", "12.12", "Stephen [email protected]", "3467738468", true));
            frnds.Add(CreateFriend("100000698491896", "Praveen Kumar U", "https://m.ak.fbcdn.net/profile.ak/hprofile-ak-ash3/t5/23221_100000698491896_1308_q.jpg", "http://facebook.com/Praveen Kumar U", "12.12", "12.12", "Praveen Kumar [email protected]", "3467738468", true));
            frnds.Add(CreateFriend("100000773228368", "Manikandan Murugesan", "https://m.ak.fbcdn.net/profile.ak/hprofile-ak-prn2/t5/186021_100000773228368_842357115_q.jpg", "http://facebook.com/Manikandan Murugesan", "12.12", "12.12", "Manikandan [email protected]", "3467738468", true));
            frnds.Add(CreateFriend("100000852425588", "Venugopal Sathyanarayanan", "https://m.ak.fbcdn.net/profile.ak/hprofile-ak-prn1/t5/173607_100000852425588_1905925208_q.jpg", "http://facebook.com/Venugopal Sathyanarayanan", "12.12", "12.12", "Venugopal [email protected]", "3467738468", true));
            frnds.Add(CreateFriend("100000992067997", "Santhosh Kumar Chandran", "https://m.ak.fbcdn.net/profile.ak/hprofile-ak-ash1/t5/275728_100000992067997_1107323127_q.jpg", "http://facebook.com/Santhosh Kumar Chandran", "12.12", "12.12", "Santhosh Kumar [email protected]", "3467738468", true));
            frnds.Add(CreateFriend("100001390244945", "Shaak Pathak", "https://m.ak.fbcdn.net/profile.ak/hprofile-ak-ash2/t5/1119555_100001390244945_793606983_q.jpg", "http://facebook.com/Shaak Pathak", "12.12", "12.12", "Shaak [email protected]", "3467738468", true));

            data.Friends         = new FBFriends();
            data.Friends.Friends = frnds;
            return(data);
        }
示例#10
0
        private void btSaveFBDatas_Click(object sender, EventArgs e)
        {
            string url    = "/api/VizFB/SaveFBDetails";
            FBData fbData = new FBData()
            {
                User = new FBUser
                {
                    id          = "12563162721",
                    FirstName   = "Vijay",
                    Gender      = "Male",
                    LastName    = "Ramesh",
                    Link        = "http://192.81.210.146",
                    Locale      = "en-US",
                    Name        = "Vijay",
                    ProfileUrl  = "http://facebook.com/unityteam",
                    TimeZone    = "GMT+5.30",
                    UpdatedTime = DateTime.Now,
                    UserName    = "******",
                    Verified    = true,
                    Work        = new List <FBEmployer>
                    {
                        new FBEmployer()
                        {
                            id   = "1237824",
                            Name = "OFS"
                        },
                        new FBEmployer()
                        {
                            id   = "1237825",
                            Name = "FA"
                        }
                    }
                },
                Friends = new FBFriends
                {
                    Friends = new List <FBFriend>
                    {
                        new FBFriend()
                        {
                            id          = "1725371",
                            Email       = "*****@*****.**",
                            ImageURL    = "http://graph.facebook.com/t/img_724872.jpg",
                            Lat         = "12.523623",
                            Lng         = "20.254624",
                            Name        = "Santhosh",
                            PhoneNumber = "1823912121",
                            ProfileURL  = "http://facebook.com/sandy"
                        },
                        new FBFriend()
                        {
                            id          = "1725372",
                            Email       = "*****@*****.**",
                            ImageURL    = "http://graph.facebook.com/t/img_724873.jpg",
                            Lat         = "12.553623",
                            Lng         = "20.256624",
                            Name        = "Sexy",
                            PhoneNumber = "1823912154",
                            ProfileURL  = "http://facebook.com/sexy"
                        }
                    }
                }
            };

            //string json = @"{"Friends":{"Friends":[{"Email":"Rakesh [email protected]","ImageURL":"https://m.ak.fbcdn.net/profile.ak/hprofile-ak-ash3/t5/370187_537462998_1257659137_q.jpg","Lat":"12.120","Lng":"12.120","Name":"Rakesh Ks","PhoneNumber":"3467738468","ProfileURL":"http://facebook.com/Rakesh Ks","id":"537462998","Selected":true},{"Email":"Donn [email protected]","ImageURL":"https://m.ak.fbcdn.net/profile.ak/hprofile-ak-ash3/t5/623595_610332030_1326593215_q.jpg","Lat":"12.121","Lng":"12.121","Name":"Donn Kabiraj","PhoneNumber":"3467738468","ProfileURL":"http://facebook.com/Donn Kabiraj","id":"610332030","Selected":true},{"Email":"Purna [email protected]","ImageURL":"https://m.ak.fbcdn.net/profile.ak/hprofile-ak-ash2/t5/370138_1084553779_897804858_q.jpg","Lat":"12.122","Lng":"12.122","Name":"Purna Kumar","PhoneNumber":"3467738468","ProfileURL":"http://facebook.com/Purna Kumar","id":"1084553779","Selected":true},{"Email":"R.Ratish [email protected]","ImageURL":"https://m.ak.fbcdn.net/profile.ak/hprofile-ak-frc1/t5/371795_1320114662_425662618_q.jpg","Lat":"12.123","Lng":"12.123","Name":"R.Ratish Kumar","PhoneNumber":"3467738468","ProfileURL":"http://facebook.com/R.Ratish Kumar","id":"1320114662","Selected":true},{"Email":"Ranjith [email protected]","ImageURL":"https://m.ak.fbcdn.net/profile.ak/hprofile-ak-frc1/t5/372425_1377566050_457968711_q.jpg","Lat":"12.124","Lng":"12.124","Name":"Ranjith Selvaraj","PhoneNumber":"3467738468","ProfileURL":"http://facebook.com/Ranjith Selvaraj","id":"1377566050","Selected":true},{"Email":"Pramod Kumar [email protected]","ImageURL":"https://m.ak.fbcdn.net/profile.ak/hprofile-ak-ash2/t5/273655_1440228172_664609_q.jpg","Lat":"12.125","Lng":"12.125","Name":"Pramod Kumar Bugudai","PhoneNumber":"3467738468","ProfileURL":"http://facebook.com/Pramod Kumar Bugudai","id":"1440228172","Selected":true},{"Email":"Vijay Anand [email protected]","ImageURL":"https://m.ak.fbcdn.net/profile.ak/hprofile-ak-frc1/t5/371080_100000056538048_459916951_q.jpg","Lat":"12.126","Lng":"12.126","Name":"Vijay Anand Mca","PhoneNumber":"3467738468","ProfileURL":"http://facebook.com/Vijay Anand Mca","id":"100000056538048","Selected":true},{"Email":"Prem Kumar [email protected]","ImageURL":"https://m.ak.fbcdn.net/profile.ak/hprofile-ak-ash2/t5/1116376_100000553569379_1770598516_q.jpg","Lat":"12.127","Lng":"12.127","Name":"Prem Kumar Aol","PhoneNumber":"3467738468","ProfileURL":"http://facebook.com/Prem Kumar Aol","id":"100000553569379","Selected":true},{"Email":"Suresh [email protected]","ImageURL":"https://m.ak.fbcdn.net/profile.ak/hprofile-ak-prn2/t5/1119178_100000662701952_1950039565_q.jpg","Lat":"12.128","Lng":"12.128","Name":"Suresh Elumalai","PhoneNumber":"3467738468","ProfileURL":"http://facebook.com/Suresh Elumalai","id":"100000662701952","Selected":true},{"Email":"Stephen [email protected]","ImageURL":"https://m.ak.fbcdn.net/profile.ak/hprofile-ak-prn2/t5/1118303_100000689750777_132852229_q.jpg","Lat":"12.129","Lng":"12.129","Name":"Stephen Arputharaj","PhoneNumber":"3467738468","ProfileURL":"http://facebook.com/Stephen Arputharaj","id":"100000689750777","Selected":true},{"Email":"Praveen Kumar [email protected]","ImageURL":"https://m.ak.fbcdn.net/profile.ak/hprofile-ak-ash3/t5/23221_100000698491896_1308_q.jpg","Lat":"12.1210","Lng":"12.1210","Name":"Praveen Kumar U","PhoneNumber":"3467738468","ProfileURL":"http://facebook.com/Praveen Kumar U","id":"100000698491896","Selected":true},{"Email":"Manikandan [email protected]","ImageURL":"https://m.ak.fbcdn.net/profile.ak/hprofile-ak-prn2/t5/186021_100000773228368_842357115_q.jpg","Lat":"12.1211","Lng":"12.1211","Name":"Manikandan Murugesan","PhoneNumber":"3467738468","ProfileURL":"http://facebook.com/Manikandan Murugesan","id":"100000773228368","Selected":true},{"Email":"Venugopal [email protected]","ImageURL":"https://m.ak.fbcdn.net/profile.ak/hprofile-ak-prn1/t5/173607_100000852425588_1905925208_q.jpg","Lat":"12.1212","Lng":"12.1212","Name":"Venugopal Sathyanarayanan","PhoneNumber":"3467738468","ProfileURL":"http://facebook.com/Venugopal Sathyanarayanan","id":"100000852425588","Selected":true},{"Email":"Santhosh Kumar [email protected]","ImageURL":"https://m.ak.fbcdn.net/profile.ak/hprofile-ak-ash1/t5/275728_100000992067997_1107323127_q.jpg","Lat":"12.1213","Lng":"12.1213","Name":"Santhosh Kumar Chandran","PhoneNumber":"3467738468","ProfileURL":"http://facebook.com/Santhosh Kumar Chandran","id":"100000992067997","Selected":true},{"Email":"Shaak [email protected]","ImageURL":"https://m.ak.fbcdn.net/profile.ak/hprofile-ak-ash2/t5/1119555_100001390244945_793606983_q.jpg","Lat":"12.1214","Lng":"12.1214","Name":"Shaak Pathak","PhoneNumber":"3467738468","ProfileURL":"http://facebook.com/Shaak Pathak","id":"100001390244945","Selected":true}]},"User":{"FirstName":"Fixture","Gender":"male","LastName":"Apps","Link":"http://facebook.com/unityteam","Locale":"en_US","Name":"Fixture Apps","ProfileUrl":"https://www.facebook.com/fixture.unity","work":[{"employer":{"id":"19549406249","name":"Tata Consultancy Services"}}],"UpdatedTime":"28 Dec 2013 14:11:06","UserName":"******","id":"100006286272328","Verified":true,"TimeZone":5.5}}";
            fbData = getFBData();
            bool result = InvokeService <FBData>(fbData, url, "POST", false, false);
        }
示例#11
0
        public bool ValidateFbData(FBData dto, FacebookLoginDto claim)
        {
            var appId = _configuration[Constants.FB_ID];

            return(dto.Is_valid && dto.App_id == appId && claim.UserId == dto.User_id);
        }
示例#12
0
 public Settings SaveFBDetails(FBData fbData)
 {
     new VizFBValidator().ValidateSaveFBDetails(fbData);
     return(dao.SaveFBDetails(fbData));
 }