omniauth-linkedin-openid 1.0.2 → 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: c61c2750e538549bc8592c294baefe4f2e0500ee421bf17b016deb145e362e0f
4
- data.tar.gz: 98d1d95ebaee15aee2019ceb16f6a3fb76318272d5fb8bc6a5b25887a4ccb913
3
+ metadata.gz: 50479ce9d7983a53ad4ed9da5ad084dd560994b93082cdf86e4b2e3a3d5418fd
4
+ data.tar.gz: 5655c4c6cda4adef371c4b917485c27f8b9e020ab89ea0b58d85f58b18f21713
5
5
  SHA512:
6
- metadata.gz: a6e8be51a8670b35aa8ef2dc251f199d1c54ee6c18aba294c01a8b874f84c964488ef11d024386a6c659cc89798967e2c118edb280ff77599fb9e366abd02af4
7
- data.tar.gz: b78ed6d4fcf1c13036583da58ce9cb9688f2259a12c6ebf94caca99c381ca702fbcf7683e73e050d6b66e5f205b86417806e32d25c276495a8ed22e49756821b
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:
@@ -24,7 +24,9 @@ module OmniAuth
24
24
 
25
25
  info do
26
26
  {
27
- email: raw_info['email'],
27
+ email: verified_email,
28
+ unverified_email: raw_info['email'],
29
+ email_verified: raw_info['email_verified'],
28
30
  first_name: raw_info['given_name'],
29
31
  last_name: raw_info['family_name'],
30
32
  picture_url: raw_info['picture']
@@ -57,6 +59,10 @@ module OmniAuth
57
59
 
58
60
  private
59
61
 
62
+ def verified_email
63
+ raw_info['email_verified'] == true ? raw_info['email'] : nil
64
+ end
65
+
60
66
  def fields_mapping
61
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
62
68
  {
@@ -1,5 +1,5 @@
1
1
  module OmniAuth
2
2
  module LinkedInOpenID
3
- VERSION = "1.0.2"
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",
@@ -68,6 +68,44 @@ describe OmniAuth::Strategies::LinkedIn do
68
68
  end
69
69
  end
70
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
+
71
109
  describe '#extra' do
72
110
  let(:raw_info) { Hash[:foo => 'bar'] }
73
111
 
@@ -100,6 +138,8 @@ describe OmniAuth::Strategies::LinkedIn do
100
138
  describe 'scope' do
101
139
  before :each do
102
140
  allow(subject).to receive(:session).and_return({})
141
+ allow(subject).to receive(:callback_url)
142
+ .and_return('https://example.com/auth/linkedin/callback')
103
143
  end
104
144
 
105
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.2
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-09-19 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.3.3
142
+ rubygems_version: 3.5.3
143
143
  signing_key:
144
144
  specification_version: 4
145
145
  summary: OmniAuth strategy for LinkedIn using OpenID.