/// <summary>
 /// Constructor loading group attributes from a Saml.Response
 /// </summary>
 /// <param name="samlResponse"></param>
 public Membership(Saml.Response samlResponse)
 {
     NameValueCollection att = samlResponse.GetAttributes();
     UserUid = att["uid"];
     GroupUid = att["group_uid"];
     Role = att["group_role"];
 }
예제 #2
0
        /// <summary>
        /// Initialize a new User
        /// </summary>
        /// <returns></returns>
        public User New(Saml.Response samlResponse)
        {
            if (samlResponse != null)
            {
                NameValueCollection att = samlResponse.GetAttributes();
                SsoSession = att["mno_session"];
                SsoSessionRecheck = DateTime.Parse(att["mno_session_recheck"]);
                GroupUid = att["group_uid"];
                GroupRole = att["group_role"];
                Uid = att["uid"];
                VirtualUid = att["virtual_uid"];
                Email = att["email"];
                VirtualEmail = att["virtual_email"];
                FirstName = att["name"];
                LastName = att["surname"];
                Country = att["country"];
                CompanyName = att["company_name"];
            }

            return this;
        }
예제 #3
0
        /// <summary>
        /// Initialize the Group
        /// </summary>
        /// <returns></returns>
        public Group New(Saml.Response samlResponse)
        {
            if (samlResponse != null)
            {
                NameValueCollection att = samlResponse.GetAttributes();

                // General info
                Uid = att["group_uid"];
                Name = att["group_name"];
                Email = att["group_email"];
                CompanyName = att["company_name"];
                HasCreditCard = att["group_has_credit_card"].Equals("true");

                // Set Free trial in the past on failure
                try
                {
                    FreeTrialEndAt = DateTime.Parse(att["group_end_free_trial"]);
                }
                catch
                {
                    FreeTrialEndAt = new DateTime(1970, 1, 1, 0, 0, 0, 0);
                }

                // Geo info
                Currency = att["group_currency"];
                Timezone = TimeZoneConverter.fromOlsonTz(att["group_timezone"]);
                Country = att["group_country"];
                City = att["group_city"];
            }

            return this;
        }