1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-22 18:28:47 +02:00
phorge-phorge/src/applications/auth/provider/PhabricatorAuthProviderOAuth1Twitter.php
epriestley 25e43e872b Add Twitter as an authentication provider
Summary: Ref T3687. Depends on D6864. Implements the `OAuth1` provider in Phabricator (which is mostly similar to the OAuth2 provider, but doesn't share quite enough code to actually extend a common base class, I think) and Twitter as a concrete subclass.

Test Plan:
Created a Twitter provider. Registered, logged in, linked, refreshed account link.

{F57054}

{F57056}

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T3687

Differential Revision: https://secure.phabricator.com/D6865
2013-09-03 05:53:08 -07:00

35 lines
847 B
PHP

<?php
final class PhabricatorAuthProviderOAuth1Twitter
extends PhabricatorAuthProviderOAuth1 {
public function getProviderName() {
return pht('Twitter');
}
public function getConfigurationHelp() {
$login_uri = $this->getLoginURI();
return pht(
"To configure Twitter OAuth, create a new application here:".
"\n\n".
"https://dev.twitter.com/apps".
"\n\n".
"When creating your application, use these settings:".
"\n\n".
" - **Callback URL:** Set this to: `%s`".
"\n\n".
"After completing configuration, copy the **Consumer Key** and ".
"**Consumer Secret** to the fields above.",
$login_uri);
}
protected function newOAuthAdapter() {
return new PhutilAuthAdapterOAuthTwitter();
}
protected function getLoginIcon() {
return 'Twitter';
}
}