-
Notifications
You must be signed in to change notification settings - Fork 0
/
HybridAuthComponent.php
64 lines (56 loc) · 1.24 KB
/
HybridAuthComponent.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
use Hybridauth\Hybridauth;
/**
* Class HybridAuthComponent
*/
class HybridAuthComponent extends CApplicationComponent
{
/**
* @var string
*/
public $action;
/**
* @var boolean
*/
public $debugMode = false;
/**
* @var array
*/
public $providers = array();
/**
* @var Hybridauth
*/
private $hybridAuth;
/**
* Initialize the component
*/
public function init()
{
if (null === $this->action) {
throw new CException('Property "action" is not set for HybridAuth Component.');
}
$config = array(
'base_url' => Yii::app()->createAbsoluteUrl($this->action),
'providers' => $this->providers,
'debug_mode' => $this->debugMode,
);
$this->hybridAuth = new Hybridauth($config);
}
/**
* @return Hybridauth
*/
public function getHybridAuth()
{
return $this->hybridAuth;
}
/**
* @param string $providerId
* @param array $parameters
*
* @return mixed
*/
public function authenticate($providerId, array $parameters = array())
{
return $this->hybridAuth->authenticate($providerId, $parameters);
}
}