Skip to content

Commit d54bbfb

Browse files
pradtkewindhamg
andauthored
port v3 changes to v4 (linkedin)
* add config template entry for LinkedIn OIDC * update LinkedIn docs and add deprecation warnings * v3 changelog changes --------- Co-authored-by: gary_windham <[email protected]>
1 parent a928c36 commit d54bbfb

File tree

4 files changed

+40
-32
lines changed

4 files changed

+40
-32
lines changed

CHANGELOG.md

+8-1
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,16 @@ _Release: 2022-11-16
1515
* Improved psalm code quality
1616
* Better source code typing
1717

18+
## v3.3.0
19+
20+
_Release: 2023-06-12
21+
* LinkedIn OIDC Template
22+
* Deprecate old LinkedIn auth method
23+
* Upgrade `kevinrob/guzzle-cache-middleware` to fix Guzzle promise issue
24+
1825
## v3.2.0
1926

20-
_Release: 2020-?
27+
_Release: 2022-10-12
2128
* Amazon template
2229
* Apple template
2330
* Orcid auth source

docs/LINKEDIN.md

+12-31
Original file line numberDiff line numberDiff line change
@@ -3,48 +3,29 @@
33
**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*
44

55
- [LinkedIn as authsource](#linkedin-as-authsource)
6+
- [Enabling OIDC in your LinkedIn App](#enabling-oidc-in-your-linkedin-app)
67
- [Usage](#usage)
7-
- [Migrarting from OAuth v1 authlinkedin](#migrarting-from-oauth-v1-authlinkedin)
88

99
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
1010

1111
# LinkedIn as authsource
1212

13-
LinkedIn recommends using OAuth2 and their v2 apis. Their v1 apis and
14-
OAuth1 endpoints are being shutdown. LinkedIn v2 apis return data in a
15-
more complex format (json keys change based on language) and require
16-
additional API calls to get an email address. You need to use the
17-
`authoauth2:LinkedInV2Auth` authsource since LinkedIn doesn't conform
18-
the expected OIDC/OAuth pattern.
13+
The `LinkedInV2Auth` authsource has been deprecated, and we now recommend the use of OIDC, which is enabled in the LinkedIn developer portal via their [Sign In with LinkedIn V2](https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/sign-in-with-linkedin-v2#what-is-openid-connect) product. Use of OIDC facilitates the use of standard configuration patterns and claims endpoints.
14+
15+
## Enabling OIDC in your LinkedIn App
16+
17+
OIDC can be enabled in your existing LinkedIn App by simply adding **Sign In with LinkedIn v2** to your app's products. See the [Cirrus Identity Blog article](https://blog.cirrusidentity.com/enabling-linkedins-oidc-authentication) for details.
1918

2019
# Usage
2120

2221
```php
2322
'linkedin' => [
24-
'authoauth2:LinkedInV2Auth',
23+
'authoauth2:OAuth2',
24+
'template' => 'LinkedInOIDC',
2525
'clientId' => $apiKey,
2626
'clientSecret' => $apiSecret,
27-
// Adjust the scopes: default is to request email and liteprofile
28-
// 'scopes' => ['r_liteprofile'],
29-
],
30-
```
31-
32-
# Migrating from OAuth v1 authlinkedin
33-
34-
The `authlinkedin` module bundled with most versions of SSP uses
35-
deprecated OAuth v1 and v1 API endpoints. To migrate to the new
36-
LinkedIn API you will need to add a [redirect URI to your linkedin
37-
application](https://docs.microsoft.com/en-us/linkedin/shared/authentication/authorization-code-flow?context=linkedin/consumer/context). The
38-
redirect URI is
39-
40-
https://hostname/SSP_PATH/module.php/authoauth2/linkback.php
41-
42-
You will then need to change your `authsource` configuration to match the example usage above.
43-
44-
On your IdP side you may need to use `linkedin2name` from this module rather than `authlinkedin`.
45-
46-
```php
47-
// Convert linkedin names to ldap friendly names
48-
10 => array('class' => 'core:AttributeMap', 'authoauth2:linkedin2name'),
27+
// Adjust the scopes: default is to request 'openid' (required),
28+
// 'profile' and 'email'
29+
// 'scopes' => ['openid', 'profile'],
30+
]
4931
```
50-
There are some minor changes in user experience and consent which are outlined in [our blog post](https://blog.cirrusidentity.com/linkedin-user-interaction-changes).

src/Auth/Source/LinkedInV2Auth.php

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
<?php
22

3+
/**
4+
* DEPRECATED -- see docs/LINKEDIN.md
5+
*/
6+
37
/**
48
* Created by PhpStorm.
59
* User: patrick

src/ConfigTemplate.php

+16
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ class ConfigTemplate
8686
'label' => 'linkedin'
8787
];
8888

89+
// Deprecated
8990
public const LinkedInV2 = [
9091
'authoauth2:LinkedInV2Auth',
9192
// *** LinkedIn Endpoints ***
@@ -105,6 +106,21 @@ class ConfigTemplate
105106
'label' => 'linkedin'
106107
];
107108

109+
//https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/sign-in-with-linkedin-v2
110+
public const LinkedInOIDC = [
111+
'authoauth2:OAuth2',
112+
// *** LinkedIn oidc Endpoints ***
113+
'urlAuthorize' => 'https://www.linkedin.com/oauth/v2/authorization',
114+
'urlAccessToken' => 'https://www.linkedin.com/oauth/v2/accessToken',
115+
'urlResourceOwnerDetails' => 'https://api.linkedin.com/v2/userinfo',
116+
'attributePrefix' => 'oidc.',
117+
'scopes' => ['openid', 'email', 'profile'],
118+
'scopeSeparator' => ' ',
119+
120+
// Improve log lines
121+
'label' => 'linkedin'
122+
];
123+
108124
//https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-protocols-oidc
109125
//https://login.microsoftonline.com/common/v2.0/.well-known/openid-configuration
110126
// WARNING: The OIDC user resource endpoint only returns sub, which is a targeted id.

0 commit comments

Comments
 (0)