Remove all "FileHasObject" edge reads and writes
[phabricator.git] / src / applications / auth / adapter / PhutilSlackAuthAdapter.php
blob6578a9af7a8fd512a461af8964cc653510df9ecf
1 <?php
3 /**
4 * Authentication adapter for Slack OAuth2.
5 */
6 final class PhutilSlackAuthAdapter extends PhutilOAuthAuthAdapter {
8 public function getAdapterType() {
9 return 'Slack';
12 public function getAdapterDomain() {
13 return 'slack.com';
16 public function getAccountID() {
17 $user = $this->getOAuthAccountData('user');
18 return idx($user, 'id');
21 public function getAccountEmail() {
22 $user = $this->getOAuthAccountData('user');
23 return idx($user, 'email');
26 public function getAccountImageURI() {
27 $user = $this->getOAuthAccountData('user');
28 return idx($user, 'image_512');
31 public function getAccountRealName() {
32 $user = $this->getOAuthAccountData('user');
33 return idx($user, 'name');
36 protected function getAuthenticateBaseURI() {
37 return 'https://slack.com/oauth/authorize';
40 protected function getTokenBaseURI() {
41 return 'https://slack.com/api/oauth.access';
44 public function getScope() {
45 return 'identity.basic,identity.team,identity.avatar';
48 public function getExtraAuthenticateParameters() {
49 return array(
50 'response_type' => 'code',
54 protected function loadOAuthAccountData() {
55 return id(new PhutilSlackFuture())
56 ->setAccessToken($this->getAccessToken())
57 ->setRawSlackQuery('users.identity')
58 ->resolve();