I have created my own authenticator which handles OAuth 2:
class OauthAuthenticate extends BaseAuthenticate
I would like to use a custom component (extended from Component
) in my OauthAuthenticate
class.
How can I to load my component there? The traditional
public $components = array('OauthAuthenticate');
doesn't work - the component is not loaded.
BaseAuthenticate
class cannot load component via $components
array as is usual in controllers, but loading a component is possible in constructor:
private $utilComponent = null;
public function __construct(ComponentCollection $collection, array $settings)
{
$this->utilComponent = $collection->load('Util');
}