public void StoreAssociation(AssociationRelyingPartyType distinguishingFactor, Association assoc) { var assocRow = dataSet.Association.NewAssociationRow(); assocRow.DistinguishingFactor = distinguishingFactor.ToString(); assocRow.Handle = assoc.Handle; assocRow.Expires = assoc.Expires.ToLocalTime(); assocRow.PrivateData = assoc.SerializePrivateData(); dataSet.Association.AddAssociationRow(assocRow); }
public void StoreAssociation(Uri distinguishingFactor, Association assoc) { var assocRow = dataSet.Association.NewAssociationRow(); assocRow.DistinguishingFactor = distinguishingFactor.AbsoluteUri; assocRow.Handle = assoc.Handle; assocRow.Expires = assoc.Expires.ToLocalTime(); assocRow.PrivateData = assoc.SerializePrivateData(); dataSet.Association.AddAssociationRow(assocRow); }
public void StoreAssociation(AssociationRelyingPartyType distinguishingFactor, Association association) { var keyWithoutHandle = "assoc-" + distinguishingFactor.ToString(); var keyWithHandle = keyWithoutHandle + "-" + association.Handle; var expireIn = association.Expires - Current.Now; var @private = association.SerializePrivateData(); var newRecord = new Wrapper { Expires = association.Expires, PrivateData = @private, Handle = association.Handle }; Current.AddToCache(keyWithoutHandle, newRecord, expireIn); Current.AddToCache(keyWithHandle, newRecord, expireIn); }
/// <summary> /// Saves an <see cref="Association"/> for later recall. /// </summary> /// <param name="distinguishingFactor">The Uri (for relying parties) or Smart/Dumb (for providers).</param> /// <param name="association">The association to store.</param> /// <remarks> /// TODO: what should implementations do on association handle conflict? /// </remarks> public void StoreAssociation(Uri distinguishingFactor, Association association) { using (var dataContext = new TransactedDatabaseEntities(System.Data.IsolationLevel.ReadCommitted)) { var sharedAssociation = new OpenIdAssociation { DistinguishingFactor = distinguishingFactor.AbsoluteUri, AssociationHandle = association.Handle, ExpirationUtc = association.Expires, PrivateData = association.SerializePrivateData(), }; dataContext.AddToOpenIdAssociations(sharedAssociation); } }