Re: PEAR::Auth features, passing a container object of constructor and more

From: Date: Sat, 12 Jul 2003 15:26:05 +0000
Subject: Re: PEAR::Auth features, passing a container object of constructor and more
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-18199@lists.php.net to get a copy of this message
Yavor Shahpasov wrote:
I was thinking about extending the auth container to allow passing the container as an object instead of a new with parameters ex right now $auth_obj = new Auth('DB', $options, 'doLogin'); new way (optional) $auth_container = new Auth_Container_DB($options); $auth_obj = new Auth($auth_container, $options, 'doLogin'); This would make it easier to use custom containers. It would be implemented without breaking bc.
Sounds like a good idea, Actually, apart from a few flaws, the current design is pretty solid on Authentication. - After concluding that, I worked out how to sort out my Authorization layer, and just let Auth 'Authorize' :)
as alla wrote in a previous email
Attached is a patch that adds a flag to $auth->start() $auth->start(); // same behavour as usual.. $auth->start(true); // always register the session (eg. same as usual behaviour)
I don't think this should be determined in the start method, a better implementation would only start the session if the showLogin option has been set to true, which is what you need as I understand from your email. something like this should do the trick but I woudl have to do some testing.
cant do that, I dont use the showLogin as a callback, (actually, I randomly call getAuth() all over the code to do checks for various parts.. - some parts will throw you to a login, other parts will just show different data.. basically, I need to determine if the two conditions are met before starting the session: a) is there a session already. b) have they posted the username/password.. <- since the methods to determine this are currently private, the only option was to add it to start(). Regards Alan
    function start()
    {
        $this->assignData();
        if($this->showLogin){
            session_start();                if (!$this->checkAuth()) {
                $this->login();
            }
        }
    }
-- Can you help out? Need Consulting Services or Know of a Job? http://www.akbkhome.com

« previous php.pear.dev (#18199) next »