Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Validating an Auth Driver
  • Hi,
      I'm creating an application with an attempt to allow a little bit of flexibility to what authentication driver is installer has set up.  The primary rule is that it uses a user table.  I'm riding on what is already standard for simpleauth and ormauth where their configs have this field defined (table_name).  The problem I'm facing however is that I cannot seem to find any method or way of retrieving the driver specific config fields from the driver.  If possible, I'd like to retrieve "table_name" from a process that makes less assumptions like:

    $driverConfig = 'ormauth'; //simpleauth, customauth, etc
    \Config::get($driverConfig.'.table_name');


    I suppose I can add a config parameter to my module config specifying the Auth driver's config file, that could work.  But I was hoping to possibly do something a little more dynamic if possible.

    Thoughts or suggestions?
  • All config is in the config file, which you can read like any other config file, using \Config::get() ?
  • Understood.  What I'm more or less seeking was whether or not there was a way to retrieve config parameters (or what config file it uses) from the Auth::instance().  Much the way get_config() works retrieving values from config/auth.php but from the driver-specific config file. 

    I do realize such a configuration file is optional depending upon the driver.  I've traversed through the code of ormauth and simpleauth a bit and found pretty much all references to any driver-specific config variables to be referenced using \Config::get(...), so I'm assuming such a method doesn't currently exist.  Just thought I'd ask in case I missed anything.
  • HarroHarro
    Accepted Answer
    Afaik drivers don't store configuration data, they use Config::get() internally too. So there is nothing to fetch.
  • \Auth\Auth_Driver::get_config()
  • Upon closer look, I misunderstood what that method is doing.  It's pulling from a config property and not from the auth config file.  I had dumped OrmAuth earlier in some testing and saw a "driver" index.  Made a false assumption that's where it was loading from.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion