Example #1
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="session"></param>
        /// <returns></returns>
        public string Serialize(SecurityTicket ticket)
        {
            MemoryStream serializationStream = null;
            BinaryWriter writer = null;
            byte[] buffer = null;

            if (ticket == null) return null;

            try
            {
                serializationStream = new MemoryStream();
                writer = new BinaryWriter(serializationStream);

                writer.Write(ticket.UserId);
                writer.Write(ticket.UserCode);
                writer.Write(ticket.UserName);
                writer.Write(ticket.DealerId);

                buffer = serializationStream.ToArray();
            }
            finally
            {
                if (serializationStream != null)
                {
                    serializationStream.Close();
                }
            }

            return Convert.ToBase64String(buffer);
        }
Example #2
0
        public SecurityTicket Deserialize(string data)
        {
            MemoryStream dataStream = null;
            BinaryReader reader = null;

            var ticket = new SecurityTicket();
            if (string.IsNullOrEmpty(data)) return ticket;

            var buffer = Convert.FromBase64String(data);
            try
            {
                dataStream = new MemoryStream(buffer);
                reader = new BinaryReader(dataStream);

                ticket.UserId = reader.ReadInt32();
                ticket.UserCode = reader.ReadString();
                ticket.UserName = reader.ReadString();
                ticket.DealerId = reader.ReadInt32();
            }
            finally
            {
                if (dataStream != null)
                {
                    dataStream.Close();
                }
            }

            return ticket;
        }
Example #3
0
        private UserIdentity LoadIdentity(HttpContext context)
        {
            SecurityTicket ticket;

            var persistor = new TicketPersistor();

            var cookie = context.Request.Cookies[CookieName];
            if (cookie == null)
            {
                ticket = new SecurityTicket();
            }
            else
            {
                ticket = persistor.Deserialize(cookie.Value);
            }

            var user = new UserIdentity(ticket);

            return user;
        }
Example #4
0
 public ProgramLogic(SecurityTicket ticket)
     : base(ticket)
 {
 }
Example #5
0
 public GenderLogic(SecurityTicket ticket)
     : base(ticket)
 {
 }
Example #6
0
 public ClaimLabourLogic(SecurityTicket ticket)
     : base(ticket)
 {
 }
Example #7
0
 public ModelLogic(SecurityTicket ticket)
     : base(ticket)
 {
 }
Example #8
0
 public PartTypeLogic(SecurityTicket ticket)
     : base(ticket)
 {
 }
Example #9
0
 public UserIdentity(SecurityTicket ticket)
 {
     _ticket = ticket;
 }
Example #10
0
 public PolicyLogic(SecurityTicket ticket)
     : base(ticket)
 {
 }
Example #11
0
 public LanguageLogic(SecurityTicket ticket)
     : base(ticket)
 {
 }
 public CustomerConcernLogic(SecurityTicket ticket)
     : base(ticket)
 {
 }
Example #13
0
 public DealerLogic(SecurityTicket ticket)
     : base(ticket)
 {
 }
 public WarrantyClaimLogic(SecurityTicket ticket)
     : base(ticket)
 {
 }
 public ClaimMiscellaneousLogic(SecurityTicket ticket)
     : base(ticket)
 {
 }
Example #16
0
 public ConditionLogic(SecurityTicket ticket)
     : base(ticket)
 {
 }
Example #17
0
 protected BaseLogic(SecurityTicket ticket)
 {
     _ticket = ticket;
 }
Example #18
0
 public VehicleLogic(SecurityTicket ticket)
     : base(ticket)
 {
 }
Example #19
0
 public ClaimPartLogic(SecurityTicket ticket)
     : base(ticket)
 {
 }
Example #20
0
 public ProductLogic(SecurityTicket ticket)
     : base(ticket)
 {
 }
Example #21
0
 public ClaimTypeLogic(SecurityTicket ticket)
     : base(ticket)
 {
 }