Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/auth/provider/PhabricatorFacebookAuthProvider.php
12256 views
1
<?php
2
3
final class PhabricatorFacebookAuthProvider
4
extends PhabricatorOAuth2AuthProvider {
5
6
public function getProviderName() {
7
return pht('Facebook');
8
}
9
10
protected function getProviderConfigurationHelp() {
11
$uri = PhabricatorEnv::getProductionURI($this->getLoginURI());
12
13
$domain = id(new PhutilURI($uri))->getDomain();
14
15
$table = array(
16
'Client OAuth Login' => pht('No'),
17
'Web OAuth Login' => pht('Yes'),
18
'Enforce HTTPS' => pht('Yes'),
19
'Force Web OAuth Reauthentication' => pht('Yes (Optional)'),
20
'Embedded Browser OAuth Login' => pht('No'),
21
'Use Strict Mode for Redirect URIs' => pht('Yes'),
22
'Login from Devices' => pht('No'),
23
'Valid OAuth Redirect URIs' => '`'.(string)$uri.'`',
24
'App Domains' => '`'.$domain.'`',
25
);
26
27
$rows = array();
28
foreach ($table as $k => $v) {
29
$rows[] = sprintf('| %s | %s |', $k, $v);
30
$rows[] = sprintf('|----| |');
31
}
32
$rows = implode("\n", $rows);
33
34
35
return pht(
36
'To configure Facebook OAuth, create a new Facebook Application here:'.
37
"\n\n".
38
'https://developers.facebook.com/apps'.
39
"\n\n".
40
'You should use these settings in your application:'.
41
"\n\n".
42
"%s\n".
43
"\n\n".
44
"After creating your new application, copy the **App ID** and ".
45
"**App Secret** to the fields above.",
46
$rows);
47
}
48
49
protected function newOAuthAdapter() {
50
return new PhutilFacebookAuthAdapter();
51
}
52
53
protected function getLoginIcon() {
54
return 'Facebook';
55
}
56
57
protected function getContentSecurityPolicyFormActions() {
58
return array(
59
// See T13254. After login with a mobile device, Facebook may redirect
60
// to the mobile site.
61
'https://m.facebook.com/',
62
);
63
}
64
65
}
66
67