Ejemplo n.º 1
0
    def getSessionOpenId(self,my_session,socket,cookies):
        myopenid=my_session.get_openid()
        if myopenid is not None:
            return myopenid

        name_cookie=self.config.cookies['session_openid']
        sid=None
        if cookies:
            cmsid=cookies.get(name_cookie,None)
            if cmsid:
                sid=cmsid.value

        # If a session id was not set, create a new one
        if sid is None:
            sid = openid.cryptutil.randomString(16, '0123456789abcdef')
            session = None
        else:
            try:
                session = self.sessions_openid.get(sid)
            except:
                session = None

        # If no session exists for this session ID, create one
        if session is None:
            session = {'id': sid }
            my_session.set_openid (session)
            (k,v)=tuple_cookie(name_cookie,
                               sid,
                               path='/')
            socket.add_header(k,v)
            self.sessions_openid[sid] = session
        return session
Ejemplo n.º 2
0
 def envoie_cookie_session(self,socket,value,date):
     # Actualisation du cookie de session. 
     (k,v)=tuple_cookie(self.config.cookies['session'],
                        value,
                        date=date,
                        path='/')
     socket.add_header(k,v)
Ejemplo n.º 3
0
 def annule_autoconnect(self,socket,config):
     (k,v)=tuple_cookie(config.cookies['session_auto_openid'],
                        '',
                        path='/')
     socket.add_header(k,v)
Ejemplo n.º 4
0
 def crea_autoconnect(self,socket,value):
     (k,v)=tuple_cookie(self.config.cookies['session_auto_openid'],
                        value,
                        path='/')
     socket.add_header(k,v)