omniauth-linkedin-openid 1.0.1 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5d24e038173a780854d661200c13cc6b7deaa126b861ef47006449e46f2e8b89
4
- data.tar.gz: 6aff8449c80b4aedb0402e0159db3d5bb088b4b6647c34876026a8cc492c17e1
3
+ metadata.gz: 50479ce9d7983a53ad4ed9da5ad084dd560994b93082cdf86e4b2e3a3d5418fd
4
+ data.tar.gz: 5655c4c6cda4adef371c4b917485c27f8b9e020ab89ea0b58d85f58b18f21713
5
5
  SHA512:
6
- metadata.gz: c27e72803f406b7b399e2c111d1c978b23885264248467acd69aebccd3e9dfe78cabd3dbd5f1128f02e89a17f88a09e0da1269916ba4e2336170043aabb5a9b0
7
- data.tar.gz: 30a1f67320926300d481596803444f3f8304544d7903077602e5b90f27eceab81a3e18f4e61a2791a06e126a09d33aecbe431009551ee296460dc7d69204444e
6
+ metadata.gz: e0a871c6e2975d65026b0ca17d5e472cdc29489f854bde4dc2b5959305f2eb1822da4a79f479184997ecbbada33e8599e06ac0577fb85e3b330e53d65fa43f6a
7
+ data.tar.gz: 8553f7ffbe0d84803e1b7f6a20076c8dab4deb4ea6803a54ee0d32785357dfcf75ca2a9b2d5855bef1e9d3926664024bcc6978fb3035f3428cd4684ca9765693
@@ -11,10 +11,10 @@ jobs:
11
11
  runs-on: ubuntu-latest
12
12
  strategy:
13
13
  matrix:
14
- ruby-version: ['2.4', '2.5', '2.6', '2.7', '3.0', '3.1', '3.2', 'truffleruby-head']
14
+ ruby-version: ['3.2', '3.3', '3.4', '4.0', 'truffleruby-head']
15
15
 
16
16
  steps:
17
- - uses: actions/checkout@v3
17
+ - uses: actions/checkout@v5
18
18
  - name: Set up Ruby ${{ matrix.ruby-version }}
19
19
  uses: ruby/setup-ruby@v1
20
20
  with:
data/README.md CHANGED
@@ -44,6 +44,10 @@ provider :linkedin,
44
44
  scope: 'openid profile email'
45
45
  ```
46
46
 
47
+ ## Email Verification
48
+
49
+ LinkedIn returns the member's primary email with a separate, optional `email_verified` flag. `info.email` is only set when LinkedIn reports the email as verified, so it is safe to use for finding or linking accounts. The email as LinkedIn returned it is always available in `info.unverified_email`, and the flag in `info.email_verified`.
50
+
47
51
  ## Profile Fields
48
52
 
49
53
  When specifying which permissions you want users to grant to your application, you can also specify the array of fields that you want returned in the OmniAuth hash. The following fields are requested by default:
@@ -8,7 +8,8 @@ module OmniAuth
8
8
  option :client_options, {
9
9
  :site => 'https://api.linkedin.com',
10
10
  :authorize_url => 'https://www.linkedin.com/oauth/v2/authorization?response_type=code',
11
- :token_url => 'https://www.linkedin.com/oauth/v2/accessToken'
11
+ :token_url => 'https://www.linkedin.com/oauth/v2/accessToken',
12
+ :token_method => :post_with_query_string
12
13
  }
13
14
 
14
15
  option :scope, 'openid profile email'
@@ -23,7 +24,9 @@ module OmniAuth
23
24
 
24
25
  info do
25
26
  {
26
- email: raw_info['email'],
27
+ email: verified_email,
28
+ unverified_email: raw_info['email'],
29
+ email_verified: raw_info['email_verified'],
27
30
  first_name: raw_info['given_name'],
28
31
  last_name: raw_info['family_name'],
29
32
  picture_url: raw_info['picture']
@@ -56,6 +59,10 @@ module OmniAuth
56
59
 
57
60
  private
58
61
 
62
+ def verified_email
63
+ raw_info['email_verified'] == true ? raw_info['email'] : nil
64
+ end
65
+
59
66
  def fields_mapping
60
67
  # https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/sign-in-with-linkedin-v2?context=linkedin%2Fconsumer%2Fcontext#api-request-to-retreive-member-details
61
68
  {
@@ -1,5 +1,5 @@
1
1
  module OmniAuth
2
2
  module LinkedInOpenID
3
- VERSION = "1.0.1"
3
+ VERSION = "2.0.0"
4
4
  end
5
5
  end
@@ -15,6 +15,7 @@ Gem::Specification.new do |gem|
15
15
  gem.name = 'omniauth-linkedin-openid'
16
16
  gem.require_paths = ['lib']
17
17
  gem.version = OmniAuth::LinkedInOpenID::VERSION
18
+ gem.required_ruby_version = '>= 3.2'
18
19
 
19
20
  gem.metadata = {
20
21
  "bug_tracker_uri" => "https://github.com/jclusso/omniauth-linkedin-openid/issues",
@@ -20,6 +20,10 @@ describe OmniAuth::Strategies::LinkedIn do
20
20
  it 'has correct `token_url`' do
21
21
  expect(subject.client.options[:token_url]).to eq('https://www.linkedin.com/oauth/v2/accessToken')
22
22
  end
23
+
24
+ it 'has a correct `token_method`' do
25
+ expect(subject.client.options[:token_method]).to eq(:post_with_query_string)
26
+ end
23
27
  end
24
28
 
25
29
  describe '#callback_path' do
@@ -64,6 +68,44 @@ describe OmniAuth::Strategies::LinkedIn do
64
68
  end
65
69
  end
66
70
 
71
+ describe '#info email' do
72
+ let(:email) { 'member@example.com' }
73
+
74
+ before :each do
75
+ allow(subject).to receive(:raw_info) { raw_info }
76
+ end
77
+
78
+ context 'when the email is verified' do
79
+ let(:raw_info) { Hash['email' => email, 'email_verified' => true] }
80
+
81
+ it 'returns the email' do
82
+ expect(subject.info[:email]).to eq(email)
83
+ expect(subject.info[:unverified_email]).to eq(email)
84
+ expect(subject.info[:email_verified]).to eq(true)
85
+ end
86
+ end
87
+
88
+ context 'when the email is not verified' do
89
+ let(:raw_info) { Hash['email' => email, 'email_verified' => false] }
90
+
91
+ it 'only returns the email as unverified_email' do
92
+ expect(subject.info[:email]).to be_nil
93
+ expect(subject.info[:unverified_email]).to eq(email)
94
+ expect(subject.info[:email_verified]).to eq(false)
95
+ end
96
+ end
97
+
98
+ context 'when email_verified is missing' do
99
+ let(:raw_info) { Hash['email' => email] }
100
+
101
+ it 'only returns the email as unverified_email' do
102
+ expect(subject.info[:email]).to be_nil
103
+ expect(subject.info[:unverified_email]).to eq(email)
104
+ expect(subject.info[:email_verified]).to be_nil
105
+ end
106
+ end
107
+ end
108
+
67
109
  describe '#extra' do
68
110
  let(:raw_info) { Hash[:foo => 'bar'] }
69
111
 
@@ -96,6 +138,8 @@ describe OmniAuth::Strategies::LinkedIn do
96
138
  describe 'scope' do
97
139
  before :each do
98
140
  allow(subject).to receive(:session).and_return({})
141
+ allow(subject).to receive(:callback_url)
142
+ .and_return('https://example.com/auth/linkedin/callback')
99
143
  end
100
144
 
101
145
  it 'sets default scope' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-linkedin-openid
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jarrett Lusso
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-02-25 00:00:00.000000000 Z
11
+ date: 2026-10-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oauth2
@@ -132,14 +132,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
132
132
  requirements:
133
133
  - - ">="
134
134
  - !ruby/object:Gem::Version
135
- version: '0'
135
+ version: '3.2'
136
136
  required_rubygems_version: !ruby/object:Gem::Requirement
137
137
  requirements:
138
138
  - - ">="
139
139
  - !ruby/object:Gem::Version
140
140
  version: '0'
141
141
  requirements: []
142
- rubygems_version: 3.4.10
142
+ rubygems_version: 3.5.3
143
143
  signing_key:
144
144
  specification_version: 4
145
145
  summary: OmniAuth strategy for LinkedIn using OpenID.