Example #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);
		}
Example #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));
        }
Example #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;
			}
		}
Example #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);
        }
Example #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);
        }
Example #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);
        }
Example #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);
		}
Example #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));
        }
Example #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));
        }
Example #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);
            }
        }
Example #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));
        }
Example #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);
        }
Example #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);
        }
Example #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);
 }
Example #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);
        }
Example #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));
        }