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); }
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); }
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; }
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); }