public void AddClaim(UserClaims claim) { if (_claims == null) _claims = new List<UserClaims>(); _claims.Add(claim); }
private void ParseClaims(AuthenticationResult authenticationResult, OAuthAuthenticationParameters parameters) { var claims = new UserClaims(); claims.Contact = new ContactClaims(); if (authenticationResult.ExtraData.ContainsKey("username")) { claims.Contact.Email = authenticationResult.ExtraData["username"]; } else { //request email claims.Contact.Email = RequestEmailFromFacebook(authenticationResult.ExtraData["accesstoken"]); } claims.Name = new NameClaims(); if (authenticationResult.ExtraData.ContainsKey("name")) { var name = authenticationResult.ExtraData["name"]; if (!String.IsNullOrEmpty(name)) { var nameSplit = name.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); if (nameSplit.Length >= 2) { claims.Name.First = nameSplit[0]; claims.Name.Last = nameSplit[1]; } else { claims.Name.Last = nameSplit[0]; } } } parameters.AddClaim(claims); }