Welcome Guest, Not a member yet? Register   Sign In
Loading Libraries at 'pre_controller' hook stage? (developing light-weight custom authentication)
#1

[eluser]beyondwords[/eluser]
Background:
I am looking to develop a custom authentication module. I've looked into auth and FreakAuth but they both have a lot of code for public sites. I am developing an internal site with fairly unique sign-up, and access control needs. If I've over-looked existing authentication solutions which might be lighter, or more easily customized, I'm game for that too.

Problem:
I would like to do the authentication as early in the load process as possible. To avoid loading a protected controller, then the login controller.

I have begun work on my library, but hit the major road-block that
Code:
$CI = get_instance();
gives me this error when I try to run the hook (via Filter) as 'pre_controller':

Quote:A PHP Error was encountered
Severity: Notice
Message: Trying to get property of non-object
Filename: filters/auth.php
Line Number: 12

I change the hook that invokes filter before to 'post_controller_constructor' and my filter and library work just fine. BUT, after my authentication library loads, if the user is attempting access without a login, or to a restricted area, every library, from config on, gets loaded again to load a new controller.

I need to be able to check session data (using DB Session) in order to verify a user's access privileges.

Am I missing something here? Is there a way to load libraries 'pre_controller'?
I tried to use the load_class method which the Controller library ends up invoking eventually, but then this causes errors further down the line when a controller wants to load those libraries, and can't since they're already loaded, but don't have access to them.

Thanks for any insight!


Messages In This Thread
Loading Libraries at 'pre_controller' hook stage? (developing light-weight custom authentication) - by El Forum - 07-17-2007, 01:32 AM



Theme © iAndrew 2016 - Forum software by © MyBB