コード例 #1
0
ファイル: UserAuth.cs プロジェクト: tgmurali/ServiceStack
        public static void PopulateMissing(this IUserAuthDetails instance, IAuthTokens tokens, bool overwriteReserved = false)
        {
            if (instance == null)
            {
                throw new ArgumentNullException("instance");
            }

            if (tokens == null)
            {
                throw new ArgumentNullException("tokens");
            }

            if (!tokens.UserId.IsNullOrEmpty())
            {
                instance.UserId = tokens.UserId;
            }

            if (!tokens.RefreshToken.IsNullOrEmpty())
            {
                instance.RefreshToken = tokens.RefreshToken;
            }

            if (tokens.RefreshTokenExpiry.HasValue)
            {
                instance.RefreshTokenExpiry = tokens.RefreshTokenExpiry;
            }

            if (!tokens.RequestToken.IsNullOrEmpty())
            {
                instance.RequestToken = tokens.RequestToken;
            }

            if (!tokens.RequestTokenSecret.IsNullOrEmpty())
            {
                instance.RequestTokenSecret = tokens.RequestTokenSecret;
            }

            if (!tokens.AccessToken.IsNullOrEmpty())
            {
                instance.AccessToken = tokens.AccessToken;
            }

            if (!tokens.AccessTokenSecret.IsNullOrEmpty())
            {
                instance.AccessTokenSecret = tokens.AccessTokenSecret;
            }

            if (tokens.Items != null)
            {
                var items = instance.Items ?? (instance.Items = new Dictionary <string, string>());
                tokens.Items.ForEach((x, y) => items[x] = y);
            }

            PopulateMissingExtended(instance, tokens, overwriteReserved);
        }
コード例 #2
0
        public static void PopulateMissing(this IUserAuthDetails instance, IAuthTokens tokens, bool overwriteReserved = false)
        {
            if (instance == null)
            {
                throw new ArgumentNullException("instance");
            }

            if (tokens == null)
            {
                throw new ArgumentNullException("tokens");
            }

            if (!tokens.UserId.IsNullOrEmpty())
            {
                instance.UserId = tokens.UserId;
            }

            if (!tokens.RefreshToken.IsNullOrEmpty())
            {
                instance.RefreshToken = tokens.RefreshToken;
            }

            if (tokens.RefreshTokenExpiry.HasValue)
            {
                instance.RefreshTokenExpiry = tokens.RefreshTokenExpiry;
            }

            if (!tokens.RequestToken.IsNullOrEmpty())
            {
                instance.RequestToken = tokens.RequestToken;
            }

            if (!tokens.RequestTokenSecret.IsNullOrEmpty())
            {
                instance.RequestTokenSecret = tokens.RequestTokenSecret;
            }

            if (!tokens.AccessToken.IsNullOrEmpty())
            {
                instance.AccessToken = tokens.AccessToken;
            }

            if (!tokens.AccessTokenSecret.IsNullOrEmpty())
            {
                instance.AccessTokenSecret = tokens.AccessTokenSecret;
            }

            PopulateMissingExtended(instance, tokens, overwriteReserved);
        }
コード例 #3
0
ファイル: UserAuthDetailsMap.cs プロジェクト: cody82/DownSite
 public UserAuthDetailsNHibernate(IUserAuthDetails userAuthDetails)
 {
     Id                 = userAuthDetails.Id;
     UserAuthId         = userAuthDetails.UserAuthId;
     Provider           = userAuthDetails.Provider;
     UserId             = userAuthDetails.UserId;
     UserName           = userAuthDetails.UserName;
     DisplayName        = userAuthDetails.DisplayName;
     FirstName          = userAuthDetails.FirstName;
     LastName           = userAuthDetails.LastName;
     Email              = userAuthDetails.Email;
     RequestToken       = userAuthDetails.RequestToken;
     RequestTokenSecret = userAuthDetails.RequestTokenSecret;
     Items              = userAuthDetails.Items;
     AccessToken        = userAuthDetails.AccessToken;
     AccessTokenSecret  = userAuthDetails.AccessTokenSecret;
     CreatedDate        = userAuthDetails.CreatedDate;
     ModifiedDate       = userAuthDetails.ModifiedDate;
 }
コード例 #4
0
        public static void PopulateMissing(this IUserAuthDetails instance, IAuthTokens tokens, bool overwriteReserved = false)
        {
            if (instance == null)
            {
                throw new ArgumentNullException(nameof(instance));
            }

            if (tokens == null)
            {
                throw new ArgumentNullException(nameof(tokens));
            }

            if (!tokens.UserId.IsNullOrEmpty())
            {
                instance.UserId = tokens.UserId;
            }

            if (!tokens.RefreshToken.IsNullOrEmpty())
            {
                instance.RefreshToken = tokens.RefreshToken;
            }

            if (tokens.RefreshTokenExpiry.HasValue)
            {
                instance.RefreshTokenExpiry = tokens.RefreshTokenExpiry;
            }

            if (!tokens.RequestToken.IsNullOrEmpty())
            {
                instance.RequestToken = tokens.RequestToken;
            }

            if (!tokens.RequestTokenSecret.IsNullOrEmpty())
            {
                instance.RequestTokenSecret = tokens.RequestTokenSecret;
            }

            if (!tokens.AccessToken.IsNullOrEmpty())
            {
                instance.AccessToken = tokens.AccessToken;
            }

            if (!tokens.AccessTokenSecret.IsNullOrEmpty())
            {
                instance.AccessTokenSecret = tokens.AccessTokenSecret;
            }

            if (tokens.Items != null)
            {
                if (instance.Items == null)
                {
                    instance.Items = new Dictionary <string, string>();
                }

                foreach (var entry in tokens.Items)
                {
                    instance.Items[entry.Key] = entry.Value;
                }
            }

            PopulateMissingExtended(instance, tokens, overwriteReserved);
        }