Skip to content

Commit

Permalink
[TASK] Upgrade Hybrid Auth lib && add instagram provider
Browse files Browse the repository at this point in the history
  • Loading branch information
kalypso63 committed Dec 18, 2018
1 parent 85872e3 commit c6d307d
Show file tree
Hide file tree
Showing 11 changed files with 42 additions and 8 deletions.
3 changes: 2 additions & 1 deletion Classes/Service/SocialAuthenticationService.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ class SocialAuthenticationService extends AbstractAuthenticationService
'facebook' => 1,
'google' => 2,
'twitter' => 3,
'linkedin' => 4
'linkedin' => 4,
'instagram' => 5,
];

/**
Expand Down
13 changes: 13 additions & 0 deletions Classes/Utility/AuthUtility.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
use TYPO3\CMS\Core\Configuration\ExtensionConfiguration;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\HttpUtility;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;

/***************************************************************
*
Expand Down Expand Up @@ -96,6 +97,18 @@ public function initializeObject()
'id' => $this->extConfig['providers']['linkedin']['keys']['key'],
'secret' => $this->extConfig['providers']['linkedin']['keys']['secret']
)
),
'Instagram' => array(
'enabled' => $this->extConfig['providers']['instagram']['enabled'],
'keys' => array(
'id' => $this->extConfig['providers']['instagram']['keys']['id'],
'secret' => $this->extConfig['providers']['instagram']['keys']['secret']
),
'scope' => $this->extConfig['providers']['instagram']['scope'],
'wrapper' => array(
'class' => 'Hybrid_Providers_Instagram',
'path' => ExtensionManagementUtility::extPath('social_auth').'Resources/Private/Librairies/hybridauth/hybridauth/additional-providers/hybridauth-instagram/Providers/Instagram.php'
)
)
),
'debug_mode' => false,
Expand Down
4 changes: 2 additions & 2 deletions Configuration/TCA/Overrides/fe_users.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
die('Access denied.');
}


/**
* Add extra fields to the fe_users
*/
Expand All @@ -19,7 +18,8 @@
array('Facebook', 1),
array('Google', 2),
array('Twitter', 3),
array('LinkedIn', 4)
array('LinkedIn', 4),
array('Instagram', 5),
),
'size' => 1,
'maxitems' => 1,
Expand Down
5 changes: 5 additions & 0 deletions Configuration/TypoScript/setup.typoscript
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ plugin.tx_felogin_pi1{
typolink.ATagParams = class="btn btn-block btn-social btn-linkedin" rel="nofollow"
stdWrap.dataWrap = <span class="fa fa-linkedin"></span>{LLL:EXT:social_auth/Resources/Private/Language/locallang.xlf:linkedin.label}
}
instagram < .facebook
instagram{
typolink.ATagParams = class="btn btn-block btn-social btn-instagram" rel="nofollow"
stdWrap.dataWrap = <span class="fa fa-instagram"></span>{LLL:EXT:social_auth/Resources/Private/Language/locallang.xlf:instagram.label}
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion Documentation/UsersManual/Index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Users manual
============

- Install the extension using the Extension Manager
- Register new app on Facebook, Twitter, Google or LinkedIn and follow the instructions. Some examples are detailed on Hybrid auth user guide [http://hybridauth.sourceforge.net/userguide.html]
- Register new app on Facebook, Twitter, Google, LinkedIn or Instagram and follow the instructions. Some examples are detailed on Hybrid auth user guide [http://hybridauth.sourceforge.net/userguide.html]
- Configure via Extension Manager and add key + appId for each social provider & set options for fe_users creation (users pid and default usergroup id are required !)
- Storage User Pid should be different from classic fe_users PID to prevent unique username
- Add the static TS (typoscript) to your typoscript template
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Social Auth service for TYPO3 with Hybrid Auth API (Facebook, Twitter, Google +
## Installation instructions

* Install the extension using the Extension Manager
* Register new app on Facebook, Twitter, Google or LinkedIn and follow the instructions. Some examples are detailed on Hybrid auth user guide [http://hybridauth.sourceforge.net/userguide.html]
* Register new app on Facebook, Twitter, Google, LinkedIn or Instagram and follow the instructions. Some examples are detailed on Hybrid auth user guide [http://hybridauth.sourceforge.net/userguide.html]
* Configure via Extension Manager and add key + appId for each social provider & set options for fe_users creation (users pid and default usergroup id are required !)
* Storage User Pid should be different from classic fe_users PID to prevent unique username
* New for 8.7 instance, set file storage uid and path for fe_users.image (FAL is used now for image field)
Expand Down
3 changes: 3 additions & 0 deletions Resources/Private/Language/locallang.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
</trans-unit>
<trans-unit id="linkedin.label">
<source>Sign in with LinkedIn</source>
</trans-unit>
<trans-unit id="instagram.label">
<source>Sign in with Instagram</source>
</trans-unit>
</body>
</file>
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "kalypso63/social_auth",
"type": "typo3-cms-extension",
"description": "Authentification via social auth (Facebook, Twitter, Google + & LinkedIn)",
"description": "Authentication via social auth (Facebook, Twitter, Google +, LinkedIn & Instagram)",
"authors": [
{
"name": "VANCLOOSTER Mickael",
Expand Down
12 changes: 12 additions & 0 deletions ext_conf_template.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,18 @@ providers.linkedin.keys.key =
# cat=LinkedIn/2; type=string; label=LinkedIn Secret
providers.linkedin.keys.secret =

# cat=Instagram/0; type=boolean; label=Instagram enable : Enable Single Sign On via Instagram for this System
providers.instagram.enabled = 0

# cat=Instagram/1; type=string; label=Instagram Client Id
providers.instagram.keys.id =

# cat=Instagram/2; type=string; label=Instagram Client Secret
providers.instagram.keys.secret =

# cat=Instagram/3; type=string; label=Scope of get attributes
providers.instagram.scope = basic

# cat=Storage users/O; type=int; label= Storage Pid : The Storage Pid of the Page, where the fe_users should be stored
users.storagePid =

Expand Down
2 changes: 1 addition & 1 deletion ext_emconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

$EM_CONF[$_EXTKEY] = array(
'title' => 'Social auth',
'description' => 'Authentification via social auth (Facebook, Twitter, Google + & LinkedIn)',
'description' => 'Authentication via social auth (Facebook, Twitter, Google +, LinkedIn & Instagram)',
'category' => 'plugin',
'author' => 'VANCLOOSTER Mickael',
'author_email' => '[email protected]',
Expand Down
2 changes: 1 addition & 1 deletion ext_localconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
$extConfig = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
\TYPO3\CMS\Core\Configuration\ExtensionConfiguration::class
)->get('social_auth');
if ($extConfig['providers']['facebook']['enabled'] || $extConfig['providers']['google']['enabled'] || $extConfig['providers']['twitter']['enabled']) {
if ($extConfig['providers']['facebook']['enabled'] || $extConfig['providers']['google']['enabled'] || $extConfig['providers']['twitter']['enabled'] || $extConfig['providers']['instagram']['enabled']) {
$GLOBALS['TYPO3_CONF_VARS']['SVCONF']['auth']['setup']['FE_fetchUserIfNoSession'] = true;
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_post_processing'][$_EXTKEY] = 'MV\SocialAuth\Hooks\LogOffHook->postProcessing';
}
Expand Down

0 comments on commit c6d307d

Please sign in to comment.