-
Notifications
You must be signed in to change notification settings - Fork 5
/
OauthPlugin.php
142 lines (123 loc) · 3.32 KB
/
OauthPlugin.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
<?php
namespace Craft;
class OauthPlugin extends BasePlugin
{
// Public Methods
// =========================================================================
/**
* Get OAuth Providers
*/
public function getOauthProviders()
{
require_once(CRAFT_PLUGINS_PATH.'oauth/providers/Facebook.php');
require_once(CRAFT_PLUGINS_PATH.'oauth/providers/Github.php');
require_once(CRAFT_PLUGINS_PATH.'oauth/providers/Google.php');
require_once(CRAFT_PLUGINS_PATH.'oauth/providers/Instagram.php');
require_once(CRAFT_PLUGINS_PATH.'oauth/providers/Linkedin.php');
require_once(CRAFT_PLUGINS_PATH.'oauth/providers/Slack.php');
require_once(CRAFT_PLUGINS_PATH.'oauth/providers/Twitter.php');
require_once(CRAFT_PLUGINS_PATH.'oauth/providers/Vimeo.php');
return [
'Dukt\OAuth\Providers\Facebook',
'Dukt\OAuth\Providers\Github',
'Dukt\OAuth\Providers\Google',
'Dukt\OAuth\Providers\Instagram',
'Dukt\OAuth\Providers\Linkedin',
'Dukt\OAuth\Providers\Slack',
'Dukt\OAuth\Providers\Twitter',
'Dukt\OAuth\Providers\Vimeo'
];
}
/**
* Get Name
*/
public function getName()
{
return Craft::t('OAuth');
}
/**
* Get Description
*/
public function getDescription()
{
return Craft::t('Consume OAuth-based web services.');
}
/**
* Get Version
*/
public function getVersion()
{
return '2.1.4';
}
/**
* Get Schema Version
*
* @return string
*/
public function getSchemaVersion()
{
return '1.0.1';
}
/**
* Get Developer
*/
public function getDeveloper()
{
return 'Dukt';
}
/**
* Get Developer URL
*/
public function getDeveloperUrl()
{
return 'https://dukt.net/';
}
/**
* Get Documentation URL
*/
public function getDocumentationUrl()
{
return 'https://dukt.net/craft/oauth/docs/';
}
/**
* Has CP Section
*/
public function hasCpSection()
{
if(craft()->config->get('showCpSection', 'oauth') === true)
{
return true;
}
return false;
}
/**
* Hook Register CP Routes
*/
public function registerCpRoutes()
{
return array(
'oauth' => ['action' => "oauth/providers/index"],
'oauth/settings' => ['action' => "oauth/settings/index"],
'oauth/tokens' => ['action' => "oauth/tokens/index"],
'oauth/providers' => ['action' => "oauth/providers/index"],
'oauth/providers/(?P<handle>.*)/tokens' => ['action' => 'oauth/tokens/providerTokens'],
'oauth/providers/(?P<handle>.*)' => ['action' => "oauth/providers/providerInfos"],
'oauth/console' => ['action' => "oauth/console/index"],
'oauth/console/(?P<providerHandle>.*)' => ['action' => "oauth/console/provider"],
);
}
/**
* Get Settings URL
*/
public function getSettingsUrl()
{
return 'oauth';
}
/**
* Get release feed URL
*/
public function getReleaseFeedUrl()
{
return 'https://raw.githubusercontent.com/dukt/oauth/v2/releases.json';
}
}