Beispiel #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;
            }
        }
Beispiel #2
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;
        }