diff --git a/Config/bootstrap.php b/Config/bootstrap.php index 361446e..70426b4 100644 --- a/Config/bootstrap.php +++ b/Config/bootstrap.php @@ -80,4 +80,11 @@ * )); * */ -Configure::write('Opauth.Strategy', array()); \ No newline at end of file +Configure::write('Opauth.Strategy', array()); + +/** + * AuthComponent Class Name + * Use to allow access to Opauth methods for users of AuthComponent + * eg. for Auth $this->Auth->allow() is used + */ +Configure::write('Opauth.AuthComponent','Auth'); \ No newline at end of file diff --git a/Controller/OpauthController.php b/Controller/OpauthController.php index 7f783ed..55b0485 100644 --- a/Controller/OpauthController.php +++ b/Controller/OpauthController.php @@ -3,8 +3,9 @@ class OpauthController extends OpauthAppController { public function beforeFilter() { // Allow access to Opauth methods for users of AuthComponent - if (is_object($this->Auth) && method_exists($this->Auth, 'allow')) { - $this->Auth->allow(); + $Auth = Configure::read('Opauth.AuthComponent'); + if ($Auth && is_object($this->{$Auth}) && method_exists($this->{$Auth}, 'allow')) { + $this->{$Auth}->allow(); } //Disable Security for the plugin actions in case that Security Component is active