示例#1
0
        protected virtual void UpdateLinkedAccount(LinkedAccount account, IEnumerable<Claim> claims = null)
        {
            if (account == null)
            {
                throw new ArgumentNullException("account");
            }

            account.LastLogin = DateTime.Now;
            account.UpdateClaims(claims);
        }
示例#2
0
        public virtual void AddOrUpdateLinkedAccount(string provider, string id, IEnumerable<Claim> claims = null)
        {
            if (String.IsNullOrWhiteSpace(provider))
            {
                throw new ArgumentNullException("provider");
            }
            if (String.IsNullOrWhiteSpace(id))
            {
                throw new ArgumentNullException("id");
            }

            var linked = GetLinkedAccount(provider, id);
            if (linked == null)
            {
                linked = new LinkedAccount
                {
                    ProviderName = provider,
                    ProviderAccountID = id
                };
                this.LinkedAccounts.Add(linked);
            }
            UpdateLinkedAccount(linked, claims);
        }