techjoomla / com_api

API framework for Joomla
http://docs.techjoomla.com/joomla-rest-api/com-api-introduction
GNU General Public License v3.0
123 stars 97 forks source link

x-auth request header use changes #25

Closed vishal22 closed 7 years ago

leadingcode commented 8 years ago

Good idea!

coolbung commented 8 years ago

@vishal22 this should be much more simplified. The authentication class should be simply decided based on the header value. The default value of this should be picked up from the config.

So in the constructor you should do -

$auth_method = headers['x-auth'] ? headers['x-auth'] : $params->get('auth_method');
$this->set('auth_method', $auth_method);

Then remove all the code related to key/login checks. All that code is unnecessary. Great chance for #strengthbysubtraction !

In the authenticateRequest() method just have -

$className      = 'APIAuthentication'.ucwords($this->get('auth_method'));
coolbung commented 8 years ago

@vishal22 you should use http://php.net/manual/en/function.getallheaders.php instead of the apache specific function

coolbung commented 8 years ago

@vishal22 knock knock..