示例#1
0
        /// <summary>
        /// Public CasAuthenticationTicket constructor
        /// </summary>
        /// <param name="serviceTicket">CAS Service Ticket associated with this CasAuthenticationTicket</param>
        /// <param name="originatingServiceName">ServiceName used during CAS authentication/validation</param>
        /// <param name="clientHostAddress">IP address of the client initiating the authentication request</param>
        /// <param name="assertion">CAS assertion returned from the CAS server during ticket validation</param>
        public CasAuthenticationTicket(string serviceTicket, string originatingServiceName, string clientHostAddress, IAssertion assertion)
        {
            CasAuthentication.Initialize();
            Proxies = new List <string>();

            NetId                  = assertion.PrincipalName;
            ServiceTicket          = serviceTicket;
            OriginatingServiceName = originatingServiceName;
            ClientHostAddress      = clientHostAddress;
            Assertion              = assertion;

            if (DateTime.MinValue.CompareTo(assertion.ValidFromDate) != 0)
            {
                ValidFromDate = assertion.ValidFromDate;
            }
            else
            {
                ValidFromDate = DateTime.Now;
            }

            DateTime localValidUntil = ValidFromDate.Add(CasAuthentication.FormsTimeout);

            if (DateTime.MinValue.CompareTo(assertion.ValidUntilDate) != 0)
            {
                ValidUntilDate = localValidUntil.CompareTo(assertion.ValidUntilDate) < 0 ? localValidUntil : assertion.ValidUntilDate;
            }
            else
            {
                ValidUntilDate = localValidUntil;
            }
        }
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (obj == this)
            {
                return(true);
            }

            return(obj is CatalogPricingRule other &&
                   ((Name == null && other.Name == null) || (Name?.Equals(other.Name) == true)) &&
                   ((TimePeriodIds == null && other.TimePeriodIds == null) || (TimePeriodIds?.Equals(other.TimePeriodIds) == true)) &&
                   ((DiscountId == null && other.DiscountId == null) || (DiscountId?.Equals(other.DiscountId) == true)) &&
                   ((MatchProductsId == null && other.MatchProductsId == null) || (MatchProductsId?.Equals(other.MatchProductsId) == true)) &&
                   ((ApplyProductsId == null && other.ApplyProductsId == null) || (ApplyProductsId?.Equals(other.ApplyProductsId) == true)) &&
                   ((ExcludeProductsId == null && other.ExcludeProductsId == null) || (ExcludeProductsId?.Equals(other.ExcludeProductsId) == true)) &&
                   ((ValidFromDate == null && other.ValidFromDate == null) || (ValidFromDate?.Equals(other.ValidFromDate) == true)) &&
                   ((ValidFromLocalTime == null && other.ValidFromLocalTime == null) || (ValidFromLocalTime?.Equals(other.ValidFromLocalTime) == true)) &&
                   ((ValidUntilDate == null && other.ValidUntilDate == null) || (ValidUntilDate?.Equals(other.ValidUntilDate) == true)) &&
                   ((ValidUntilLocalTime == null && other.ValidUntilLocalTime == null) || (ValidUntilLocalTime?.Equals(other.ValidUntilLocalTime) == true)) &&
                   ((ExcludeStrategy == null && other.ExcludeStrategy == null) || (ExcludeStrategy?.Equals(other.ExcludeStrategy) == true)));
        }
示例#3
0
        /// <summary>
        /// Public CasAuthenticationTicket constructor
        /// </summary>
        /// <param name="serviceTicket">CAS Service Ticket associated with this CasAuthenticationTicket</param>
        /// <param name="originatingServiceName">ServiceName used during CAS authentication/validation</param>
        /// <param name="clientHostAddress">IP address of the client initiating the authentication request</param>
        /// <param name="assertion">CAS assertion returned from the CAS server during ticket validation</param>
        /// <param name="clock"></param>
        public CasAuthenticationTicket(
            string serviceTicket,
            string originatingServiceName,
            string clientHostAddress,
            IAssertion assertion,
            maxAttributes attributes,
            DateTime validFromDate)
        {
            Proxies = new List <string>();

            NetId                  = assertion.PrincipalName;
            ServiceTicket          = serviceTicket;
            OriginatingServiceName = originatingServiceName;
            ClientHostAddress      = clientHostAddress;
            Assertion              = assertion;

            if (DateTime.MinValue.CompareTo(assertion.ValidFromDate) != 0)
            {
                ValidFromDate = assertion.ValidFromDate;
            }
            else
            {
                ValidFromDate = validFromDate;
            }

            DateTime localValidUntil = ValidFromDate.Add(TimeSpan.FromDays(30));

            if (DateTime.MinValue.CompareTo(assertion.ValidUntilDate) != 0)
            {
                ValidUntilDate = localValidUntil.CompareTo(assertion.ValidUntilDate) < 0 ? localValidUntil : assertion.ValidUntilDate;
            }
            else
            {
                ValidUntilDate = localValidUntil;
            }

            this.MaxAttributes = attributes;
        }
        public override int GetHashCode()
        {
            int hashCode = -988778351;

            if (Name != null)
            {
                hashCode += Name.GetHashCode();
            }

            if (TimePeriodIds != null)
            {
                hashCode += TimePeriodIds.GetHashCode();
            }

            if (DiscountId != null)
            {
                hashCode += DiscountId.GetHashCode();
            }

            if (MatchProductsId != null)
            {
                hashCode += MatchProductsId.GetHashCode();
            }

            if (ApplyProductsId != null)
            {
                hashCode += ApplyProductsId.GetHashCode();
            }

            if (ExcludeProductsId != null)
            {
                hashCode += ExcludeProductsId.GetHashCode();
            }

            if (ValidFromDate != null)
            {
                hashCode += ValidFromDate.GetHashCode();
            }

            if (ValidFromLocalTime != null)
            {
                hashCode += ValidFromLocalTime.GetHashCode();
            }

            if (ValidUntilDate != null)
            {
                hashCode += ValidUntilDate.GetHashCode();
            }

            if (ValidUntilLocalTime != null)
            {
                hashCode += ValidUntilLocalTime.GetHashCode();
            }

            if (ExcludeStrategy != null)
            {
                hashCode += ExcludeStrategy.GetHashCode();
            }

            return(hashCode);
        }