Beispiel #1
0
        /// <summary>
        /// create or update membership information of a user
        /// </summary>
        /// <param name="provider">provider name</param>
        /// <param name="providerUserId">provider user id</param>
        /// <param name="userName">user name</param>
        public override void CreateOrUpdateOAuthAccount(string provider, string providerUserId, string userName)
        {
            UserProfile userProfile = this.GetUserByName(userName);

            var membershipData = new WebpagesOauthMembership
            {
                RowKey   = providerUserId,
                Provider = provider,
                UserId   = Convert.ToInt32(userProfile.RowKey)
            };

            this.userManager.SaveUserMemberShipData(membershipData);
        }
Beispiel #2
0
        public UserDetails GetUserDetailsByProviderUserId(string providerUserId)
        {
            WebpagesOauthMembership membershipData = this.azureTableOperations.FetchEntity <WebpagesOauthMembership>("1", providerUserId);

            if (membershipData != null)
            {
                UserDetails userDetails = this.GetUserAndAccessDetailsByUserId(membershipData.UserId.ToString());

                if (userDetails != null)
                {
                    userDetails.MembershipInfo = membershipData;
                    return(userDetails);
                }
            }

            return(null);
        }
Beispiel #3
0
        /// <summary>
        /// Get user id for the given provider and provider user id
        /// </summary>
        /// <param name="provider">provider name</param>
        /// <param name="providerUserId">provider user id</param>
        /// <returns>user id</returns>
        public override int GetUserIdFromOAuth(string provider, string providerUserId)
        {
            try
            {
                WebpagesOauthMembership data = this.userManager.GetMembershipFromProvider(provider, providerUserId);

                if (data != null)
                {
                    return(data.UserId);
                }

                return(0);
            }
            catch
            {
                return(0);
            }
        }
Beispiel #4
0
 public void SaveUserMemberShipData(WebpagesOauthMembership membershipData)
 {
     this.azureTableOperations.InsertEntity(membershipData);
 }