Пример #1
0
		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);
		}
Пример #2
0
        public bool RemoveAssociation(AssociationRelyingPartyType distinguishingFactor, string handle)
        {
            var keyWithoutHandle = "assoc-" + distinguishingFactor.ToString();
            var keyWithHandle    = keyWithoutHandle + "-" + handle;

            // lack of short-circuit here is important, both these calls need to run
            return(Current.RemoveFromCache(keyWithoutHandle) | Current.RemoveFromCache(keyWithHandle));
        }
Пример #3
0
		public bool RemoveAssociation(AssociationRelyingPartyType distinguishingFactor, string handle) {
			var row = dataSet.Association.FindByDistinguishingFactorHandle(distinguishingFactor.ToString(), handle);
			if (row != null) {
				dataSet.Association.RemoveAssociationRow(row);
				return true;
			} else {
				return false;
			}
		}
Пример #4
0
        public Association GetAssociation(AssociationRelyingPartyType distinguishingFactor, SecuritySettings securityRequirements)
        {
            var keyWithoutHandle = "assoc-" + distinguishingFactor.ToString();

            var wrapper = Current.GetFromCache<Wrapper>(keyWithoutHandle);

            if(wrapper == null) return null;

            return Association.Deserialize(wrapper.Handle, wrapper.Expires, wrapper.PrivateData);
        }
Пример #5
0
        public Association GetAssociation(AssociationRelyingPartyType distinguishingFactor, string handle)
        {
            var keyWithHandle = "assoc-" + distinguishingFactor.ToString() + "-" + handle;

            var wrapper = Current.GetFromCache<Wrapper>(keyWithHandle);

            if (wrapper == null) return null;

            return Association.Deserialize(wrapper.Handle, wrapper.Expires, wrapper.PrivateData);
        }
Пример #6
0
        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);
        }
Пример #7
0
		public Association GetAssociation(AssociationRelyingPartyType distinguishingFactor) {
			// properly escape the URL to prevent injection attacks.
			string value = distinguishingFactor.ToString();
			string filter = string.Format(CultureInfo.InvariantCulture, "{0} = '{1}'",
				dataSet.Association.DistinguishingFactorColumn.ColumnName, value);
			string sort = dataSet.Association.ExpiresColumn.ColumnName + " DESC";
			DataView view = new DataView(dataSet.Association, filter, sort, DataViewRowState.CurrentRows);
			if (view.Count == 0) return null;
			var row = (CustomStoreDataSet.AssociationRow)view[0].Row;
			return Association.Deserialize(row.Handle, row.Expires.ToUniversalTime(), row.PrivateData);
		}
Пример #8
0
        public Association GetAssociation(AssociationRelyingPartyType distinguishingFactor, SecuritySettings securityRequirements)
        {
            var keyWithoutHandle = "assoc-" + distinguishingFactor.ToString();

            var wrapper = Current.GetFromCache <Wrapper>(keyWithoutHandle);

            if (wrapper == null)
            {
                return(null);
            }

            return(Association.Deserialize(wrapper.Handle, wrapper.Expires, wrapper.PrivateData));
        }
Пример #9
0
        public Association GetAssociation(AssociationRelyingPartyType distinguishingFactor, string handle)
        {
            var keyWithHandle = "assoc-" + distinguishingFactor.ToString() + "-" + handle;

            var wrapper = Current.GetFromCache <Wrapper>(keyWithHandle);

            if (wrapper == null)
            {
                return(null);
            }

            return(Association.Deserialize(wrapper.Handle, wrapper.Expires, wrapper.PrivateData));
        }
Пример #10
0
        public bool RemoveAssociation(AssociationRelyingPartyType distinguishingFactor, string handle)
        {
            var row = dataSet.Association.FindByDistinguishingFactorHandle(distinguishingFactor.ToString(), handle);

            if (row != null)
            {
                dataSet.Association.RemoveAssociationRow(row);
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #11
0
        public Association GetAssociation(AssociationRelyingPartyType distinguishingFactor)
        {
            // properly escape the URL to prevent injection attacks.
            string value  = distinguishingFactor.ToString();
            string filter = string.Format(CultureInfo.InvariantCulture, "{0} = '{1}'",
                                          dataSet.Association.DistinguishingFactorColumn.ColumnName, value);
            string   sort = dataSet.Association.ExpiresColumn.ColumnName + " DESC";
            DataView view = new DataView(dataSet.Association, filter, sort, DataViewRowState.CurrentRows);

            if (view.Count == 0)
            {
                return(null);
            }
            var row = (CustomStoreDataSet.AssociationRow)view[0].Row;

            return(Association.Deserialize(row.Handle, row.Expires.ToUniversalTime(), row.PrivateData));
        }
Пример #12
0
        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);
        }
Пример #13
0
        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);
        }
Пример #14
0
 public Association GetAssociation(AssociationRelyingPartyType distinguishingFactor, string handle)
 {
     var assocRow = dataSet.Association.FindByDistinguishingFactorHandle(distinguishingFactor.ToString(), handle);
     return Association.Deserialize(assocRow.Handle, assocRow.Expires, assocRow.PrivateData);
 }
Пример #15
0
        public bool RemoveAssociation(AssociationRelyingPartyType distinguishingFactor, string handle)
        {
            var keyWithoutHandle = "assoc-" + distinguishingFactor.ToString();
            var keyWithHandle = keyWithoutHandle + "-" + handle;

            // lack of short-circuit here is important, both these calls need to run
            return Current.RemoveFromCache(keyWithoutHandle) | Current.RemoveFromCache(keyWithHandle);
        }
Пример #16
0
        public Association GetAssociation(AssociationRelyingPartyType distinguishingFactor, string handle)
        {
            var assocRow = dataSet.Association.FindByDistinguishingFactorHandle(distinguishingFactor.ToString(), handle);

            return(Association.Deserialize(assocRow.Handle, assocRow.Expires, assocRow.PrivateData));
        }