public void UpdateClaims(ICollection <UserClaim> claims) { OAuthUserClaims.Clear(); foreach (var claim in claims) { OAuthUserClaims.Add(claim); } }
public virtual object Clone() { return(new User { Id = Id, Status = Status, Credentials = Credentials == null ? new List <UserCredential>() : Credentials.Select(_ => (UserCredential)_.Clone()).ToList(), OAuthUserClaims = Claims == null ? new List <UserClaim>() : OAuthUserClaims.Select(_ => (UserClaim)_.Clone()).ToList(), DeviceRegistrationToken = DeviceRegistrationToken, CreateDateTime = CreateDateTime, UpdateDateTime = UpdateDateTime, Sessions = Sessions.Select(s => (UserSession)s.Clone()).ToList(), OTPCounter = OTPCounter, OTPKey = OTPKey, ExternalAuthProviders = ExternalAuthProviders.Select(e => (UserExternalAuthProvider)e.Clone()).ToList() }); }
public void UpdateClaim(string key, string value) { var claim = OAuthUserClaims.FirstOrDefault(c => c.Name == key); if (claim != null) { claim.Value = value; } else { OAuthUserClaims.Add(new UserClaim { Name = key, Value = value }); } }
public override object Clone() { return(new OAuthUser { Id = Id, Status = Status, Credentials = Credentials == null ? new List <UserCredential>() : Credentials.Select(_ => (UserCredential)_.Clone()).ToList(), OAuthUserClaims = Claims == null ? new List <UserClaim>() : OAuthUserClaims.Select(_ => (UserClaim)_.Clone()).ToList(), DeviceRegistrationToken = DeviceRegistrationToken, Consents = Consents == null ? new List <OAuthConsent>() : Consents.Select(c => (OAuthConsent)c.Clone()).ToList(), CreateDateTime = CreateDateTime, UpdateDateTime = UpdateDateTime, Sessions = Sessions.Select(s => (UserSession)s.Clone()).ToList(), OTPCounter = OTPCounter, OTPKey = OTPKey }); }