1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-28 16:30:59 +01:00

WordPress.com OAuth2 plugin

Summary:
This plugin provides an OAuth authentication provider to authenticate users using WordPress.com Connect.

This diff corresponds to github pull request https://github.com/facebook/phabricator/pull/593/ and had its libphutil counterpart reviewed in D9004.

Test Plan: Configured WordPress.com as an authentication provider, saw it show up on the login screen, registered a new account, got expected defaults for my username/name/email/profile picture.

Reviewers: chad, #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D9019
This commit is contained in:
Ashish SHUKLA 2014-05-08 14:23:12 -07:00 committed by epriestley
parent 38739755c6
commit 0da22abdb5
8 changed files with 68 additions and 19 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

View file

@ -1,92 +1,97 @@
{ {
"version" : 1, "version" : 1,
"sprites" : { "sprites" : {
"login-Amazon" : { "login-Amazon" : {
"name" : "login-Amazon", "name" : "login-Amazon",
"rule" : ".login-Amazon", "rule" : ".login-Amazon",
"hash" : "5961e41c525ef46c88558616fcf23272" "hash" : "5961e41c525ef46c88558616fcf23272"
}, },
"login-Asana" : { "login-Asana" : {
"name" : "login-Asana", "name" : "login-Asana",
"rule" : ".login-Asana", "rule" : ".login-Asana",
"hash" : "30df492eab339fa64c9ae9b21bb46a18" "hash" : "30df492eab339fa64c9ae9b21bb46a18"
}, },
"login-Disqus" : { "login-Disqus" : {
"name" : "login-Disqus", "name" : "login-Disqus",
"rule" : ".login-Disqus", "rule" : ".login-Disqus",
"hash" : "5f46ac50a5d9d13245971c298f49e13b" "hash" : "5f46ac50a5d9d13245971c298f49e13b"
}, },
"login-Dropbox" : { "login-Dropbox" : {
"name" : "login-Dropbox", "name" : "login-Dropbox",
"rule" : ".login-Dropbox", "rule" : ".login-Dropbox",
"hash" : "572ab36301762414365b68c0bc185ac5" "hash" : "572ab36301762414365b68c0bc185ac5"
}, },
"login-Facebook" : { "login-Facebook" : {
"name" : "login-Facebook", "name" : "login-Facebook",
"rule" : ".login-Facebook", "rule" : ".login-Facebook",
"hash" : "2b1511f5b4d12076dd9086d1bb187b28" "hash" : "2b1511f5b4d12076dd9086d1bb187b28"
}, },
"login-Generic" : { "login-Generic" : {
"name" : "login-Generic", "name" : "login-Generic",
"rule" : ".login-Generic", "rule" : ".login-Generic",
"hash" : "60d75c38668ffd6eea91a40e66186601" "hash" : "60d75c38668ffd6eea91a40e66186601"
}, },
"login-Github" : { "login-Github" : {
"name" : "login-Github", "name" : "login-Github",
"rule" : ".login-Github", "rule" : ".login-Github",
"hash" : "633696beb8c1eaac642ce4955be917d8" "hash" : "633696beb8c1eaac642ce4955be917d8"
}, },
"login-Google" : { "login-Google" : {
"name" : "login-Google", "name" : "login-Google",
"rule" : ".login-Google", "rule" : ".login-Google",
"hash" : "b7d3962a31df1e6c13e0a3c97c08f11d" "hash" : "b7d3962a31df1e6c13e0a3c97c08f11d"
}, },
"login-HTTP" : { "login-HTTP" : {
"name" : "login-HTTP", "name" : "login-HTTP",
"rule" : ".login-HTTP", "rule" : ".login-HTTP",
"hash" : "6fcf0f666c0f6f1e1cd8f397b41ed176" "hash" : "6fcf0f666c0f6f1e1cd8f397b41ed176"
}, },
"login-Jira" : { "login-Jira" : {
"name" : "login-Jira", "name" : "login-Jira",
"rule" : ".login-Jira", "rule" : ".login-Jira",
"hash" : "0ddadec77a95c1efc398886252ebeda9" "hash" : "0ddadec77a95c1efc398886252ebeda9"
}, },
"login-LDAP" : { "login-LDAP" : {
"name" : "login-LDAP", "name" : "login-LDAP",
"rule" : ".login-LDAP", "rule" : ".login-LDAP",
"hash" : "5b4e01ddf35cd40c8f061c90abc89b6c" "hash" : "5b4e01ddf35cd40c8f061c90abc89b6c"
}, },
"login-Linkedin" : { "login-Linkedin" : {
"name" : "login-Linkedin", "name" : "login-Linkedin",
"rule" : ".login-Linkedin", "rule" : ".login-Linkedin",
"hash" : "0dd89825046fa4fd0fe402aa2cd55fd1" "hash" : "0dd89825046fa4fd0fe402aa2cd55fd1"
}, },
"login-Openid" : { "login-Openid" : {
"name" : "login-Openid", "name" : "login-Openid",
"rule" : ".login-Openid", "rule" : ".login-Openid",
"hash" : "9267ffbb8d4e6dee409c4d8fa2d50c0a" "hash" : "9267ffbb8d4e6dee409c4d8fa2d50c0a"
}, },
"login-Persona" : { "login-Persona" : {
"name" : "login-Persona", "name" : "login-Persona",
"rule" : ".login-Persona", "rule" : ".login-Persona",
"hash" : "949faf7bf5ed377c06aa480da1f42b74" "hash" : "949faf7bf5ed377c06aa480da1f42b74"
}, },
"login-Phabricator" : { "login-Phabricator" : {
"name" : "login-Phabricator", "name" : "login-Phabricator",
"rule" : ".login-Phabricator", "rule" : ".login-Phabricator",
"hash" : "fad258eb347a1ccf5800b0ee2d8e6e49" "hash" : "fad258eb347a1ccf5800b0ee2d8e6e49"
}, },
"login-TwitchTV" : { "login-TwitchTV" : {
"name" : "login-TwitchTV", "name" : "login-TwitchTV",
"rule" : ".login-TwitchTV", "rule" : ".login-TwitchTV",
"hash" : "dbaa3f5e58fceb86598b2951fc5f9508" "hash" : "dbaa3f5e58fceb86598b2951fc5f9508"
}, },
"login-Twitter" : { "login-Twitter" : {
"name" : "login-Twitter", "name" : "login-Twitter",
"rule" : ".login-Twitter", "rule" : ".login-Twitter",
"hash" : "0b64983507a720b365474b778a966bab" "hash" : "0b64983507a720b365474b778a966bab"
}, },
"login-Yahoo" : { "login-WordPressCOM" : {
"name" : "login-WordPressCOM",
"rule" : ".login-WordPressCOM",
"hash" : "c22a183bfb1e46deeab864223ec48db9"
},
"login-Yahoo" : {
"name" : "login-Yahoo", "name" : "login-Yahoo",
"rule" : ".login-Yahoo", "rule" : ".login-Yahoo",
"hash" : "1cc6fceee294045fe6d1c1d3aa31d2c1" "hash" : "1cc6fceee294045fe6d1c1d3aa31d2c1"

View file

@ -1254,6 +1254,7 @@ phutil_register_library_map(array(
'PhabricatorAuthProviderOAuthGitHub' => 'applications/auth/provider/PhabricatorAuthProviderOAuthGitHub.php', 'PhabricatorAuthProviderOAuthGitHub' => 'applications/auth/provider/PhabricatorAuthProviderOAuthGitHub.php',
'PhabricatorAuthProviderOAuthGoogle' => 'applications/auth/provider/PhabricatorAuthProviderOAuthGoogle.php', 'PhabricatorAuthProviderOAuthGoogle' => 'applications/auth/provider/PhabricatorAuthProviderOAuthGoogle.php',
'PhabricatorAuthProviderOAuthTwitch' => 'applications/auth/provider/PhabricatorAuthProviderOAuthTwitch.php', 'PhabricatorAuthProviderOAuthTwitch' => 'applications/auth/provider/PhabricatorAuthProviderOAuthTwitch.php',
'PhabricatorAuthProviderOAuthWordPress' => 'applications/auth/provider/PhabricatorAuthProviderOAuthWordPress.php',
'PhabricatorAuthProviderPassword' => 'applications/auth/provider/PhabricatorAuthProviderPassword.php', 'PhabricatorAuthProviderPassword' => 'applications/auth/provider/PhabricatorAuthProviderPassword.php',
'PhabricatorAuthProviderPersona' => 'applications/auth/provider/PhabricatorAuthProviderPersona.php', 'PhabricatorAuthProviderPersona' => 'applications/auth/provider/PhabricatorAuthProviderPersona.php',
'PhabricatorAuthRegisterController' => 'applications/auth/controller/PhabricatorAuthRegisterController.php', 'PhabricatorAuthRegisterController' => 'applications/auth/controller/PhabricatorAuthRegisterController.php',
@ -4041,6 +4042,7 @@ phutil_register_library_map(array(
'PhabricatorAuthProviderOAuthGitHub' => 'PhabricatorAuthProviderOAuth2', 'PhabricatorAuthProviderOAuthGitHub' => 'PhabricatorAuthProviderOAuth2',
'PhabricatorAuthProviderOAuthGoogle' => 'PhabricatorAuthProviderOAuth2', 'PhabricatorAuthProviderOAuthGoogle' => 'PhabricatorAuthProviderOAuth2',
'PhabricatorAuthProviderOAuthTwitch' => 'PhabricatorAuthProviderOAuth2', 'PhabricatorAuthProviderOAuthTwitch' => 'PhabricatorAuthProviderOAuth2',
'PhabricatorAuthProviderOAuthWordPress' => 'PhabricatorAuthProviderOAuth2',
'PhabricatorAuthProviderPassword' => 'PhabricatorAuthProvider', 'PhabricatorAuthProviderPassword' => 'PhabricatorAuthProvider',
'PhabricatorAuthProviderPersona' => 'PhabricatorAuthProvider', 'PhabricatorAuthProviderPersona' => 'PhabricatorAuthProvider',
'PhabricatorAuthRegisterController' => 'PhabricatorAuthController', 'PhabricatorAuthRegisterController' => 'PhabricatorAuthController',

View file

@ -0,0 +1,38 @@
<?php
final class PhabricatorAuthProviderOAuthWordPress
extends PhabricatorAuthProviderOAuth2 {
public function getProviderName() {
return pht('WordPress.com');
}
protected function getProviderConfigurationHelp() {
$uri = PhabricatorEnv::getProductionURI('/');
$callback_uri = PhabricatorEnv::getURI($this->getLoginURI());
return pht(
"To configure WordPress.com OAuth, create a new WordPress.com ".
"Application here:\n\n".
"https://developer.wordpress.com/apps/new/.".
"\n\n".
"You should use these settings in your application:".
"\n\n".
" - **URL:** Set this to your full domain with protocol. For this ".
" Phabricator install, the correct value is: `%s`\n".
" - **Redirect URL**: Set this to: `%s`\n".
"\n\n".
"Once you've created an application, copy the **Client ID** and ".
"**Client Secret** into the fields above.",
$uri,
$callback_uri);
}
protected function newOAuthAdapter() {
return new PhutilAuthAdapterOAuthWordPress();
}
protected function getLoginIcon() {
return 'WordPressCOM';
}
}

View file

@ -86,6 +86,10 @@ only screen and (-webkit-min-device-pixel-ratio: 1.5) {
background-position: 0px -140px; background-position: 0px -140px;
} }
.login-Yahoo { .login-WordPressCOM {
background-position: -35px -140px; background-position: -35px -140px;
} }
.login-Yahoo {
background-position: -70px -140px;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 104 KiB

After

Width:  |  Height:  |  Size: 105 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 34 KiB