-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from humhub/fix/auth-deprecations
Fix LinkedIn Auth Deprecations
- Loading branch information
Showing
6 changed files
with
86 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<?php | ||
|
||
namespace humhubContrib\auth\linkedin\authclient; | ||
|
||
use yii\authclient\clients\LinkedIn; | ||
use humhub\helpers\ArrayHelper; | ||
|
||
/** | ||
* LinkedIn allows authentication via LinkedIn OAuth. | ||
*/ | ||
class LinkedinAuthV2 extends LinkedIn | ||
{ | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
protected function defaultViewOptions() | ||
{ | ||
return [ | ||
'popupWidth' => 860, | ||
'popupHeight' => 480, | ||
'cssIcon' => 'fa fa-linkedin', | ||
'buttonBackgroundColor' => '#e0492f', | ||
]; | ||
} | ||
|
||
public function init() | ||
{ | ||
$this->scope = implode(' ', [ | ||
'openid', | ||
'profile', | ||
'email', | ||
]); | ||
} | ||
|
||
protected function initUserAttributes() | ||
{ | ||
return $this->api('userinfo', 'GET'); | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
protected function defaultNormalizeUserAttributeMap() | ||
{ | ||
return [ | ||
'id' => 'sub', | ||
'username' => 'displayName', | ||
'firstname' => function ($attributes) { | ||
return ArrayHelper::getValue($attributes, 'given_name', ''); | ||
}, | ||
'lastname' => function ($attributes) { | ||
return ArrayHelper::getValue($attributes, 'family_name', ''); | ||
}, | ||
'email' => function ($attributes) { | ||
return ArrayHelper::getValue($attributes, 'email', ''); | ||
}, | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters