Remove all "FileHasObject" edge reads and writes
[phabricator.git] / src / applications / auth / adapter / PhutilWordPressAuthAdapter.php
blobc09c7cffabfec0fd3e201ca91761391650cb3dee
1 <?php
3 /**
4 * Authentication adapter for WordPress.com OAuth2.
5 */
6 final class PhutilWordPressAuthAdapter extends PhutilOAuthAuthAdapter {
8 public function getAdapterType() {
9 return 'wordpress';
12 public function getAdapterDomain() {
13 return 'wordpress.com';
16 public function getAccountID() {
17 return $this->getOAuthAccountData('ID');
20 public function getAccountEmail() {
21 return $this->getOAuthAccountData('email');
24 public function getAccountName() {
25 return $this->getOAuthAccountData('username');
28 public function getAccountImageURI() {
29 return $this->getOAuthAccountData('avatar_URL');
32 public function getAccountURI() {
33 return $this->getOAuthAccountData('profile_URL');
36 public function getAccountRealName() {
37 return $this->getOAuthAccountData('display_name');
40 protected function getAuthenticateBaseURI() {
41 return 'https://public-api.wordpress.com/oauth2/authorize';
44 protected function getTokenBaseURI() {
45 return 'https://public-api.wordpress.com/oauth2/token';
48 public function getScope() {
49 return 'user_read';
52 public function getExtraAuthenticateParameters() {
53 return array(
54 'response_type' => 'code',
55 'blog_id' => 0,
59 public function getExtraTokenParameters() {
60 return array(
61 'grant_type' => 'authorization_code',
65 protected function loadOAuthAccountData() {
66 return id(new PhutilWordPressFuture())
67 ->setClientID($this->getClientID())
68 ->setAccessToken($this->getAccessToken())
69 ->setRawWordPressQuery('/me/')
70 ->resolve();