public Session Register()
        {
            String name = "public";

            // On récupère la date du client
            DateTime current = DateTime.Now;

            if (!OperationContext.Current.ServiceSecurityContext.IsAnonymous)
                name = Text.Sanitizer.SanitizeFileName(OperationContext.Current.ServiceSecurityContext.WindowsIdentity.Name);

            Session session = new Session();
            session.Identifiant = System.Guid.NewGuid();
            session.WindowsIdentityName = name;
            session.Expiration = current += expirationSpan;
            session.CurrentEtat = Etat.Available;

            _sessions.Add(session);

            return session;
        }
        public Session ReRegister(System.Guid identifiant)
        {
            String name = "public";
            Session ret = null;

            if (!OperationContext.Current.ServiceSecurityContext.IsAnonymous)
                name = Text.Sanitizer.SanitizeFileName(OperationContext.Current.ServiceSecurityContext.WindowsIdentity.Name);

            // On récupère la date du client
            DateTime current = DateTime.Now;

            Session session = new Session();
            session.Identifiant = identifiant;

            //int index = _sessions.IndexOf(session);
            int index = -1;
            int i = 0;
            foreach (Session s in _sessions)
            {
                if (s.Identifiant.Equals(identifiant))
                {
                    index = i;
                }
                else i++;
            }

            if (index != -1)
            {
                ret = _sessions.ElementAt(index);
                if(ret.WindowsIdentityName.Equals(name))
                {
                    ret.Expiration = current + expirationSpan;
                }
                else
                {
                    ret = null;
                }
            }

            return ret;
        }
 public bool Equals(Session o)
 {
     return Identifiant.Equals(o.Identifiant);
 }