omniauth-osso 0.1.8 → 0.2.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: 56e18431f00e10031a36b55c2ebc0fbb472b27fb98cc794bd0925a80bd6a85f4
4
- data.tar.gz: 9cf0b3999072a6cceb1ff764cb3c55d5f0c16d0dd122f24c1b8fee6c92eb29d6
3
+ metadata.gz: 257baf2f9360500ab7c89d965a6591ed5f19fae096435b409c14ab5398d35e1a
4
+ data.tar.gz: 1ce66747bf46e62db83a24b73c312ae2c32fd0455a41784fb8654de14e1dd372
5
5
  SHA512:
6
- metadata.gz: 26ac30a6016727d1a97bcd3c2b6a49911da1b044487fb626b111586552e9ccf4cd8dd30b2866e3c4bc84ceb7218fb6200a745ffcc4e34ad906105029a24f16a6
7
- data.tar.gz: 92dc68770cc6445875a73375b02f5bc56704630ba735635d97b686476cdf80ad1cbb87a77cbcb030b4cb5c1a8e65a7b0bdc854de6bb3723b3c3fd2decd44d7aa
6
+ metadata.gz: 76e37f338722da1d8742df1c744e4e21303bb5796e7cba8b9744eb028dfc4b33a5570eced3ecb63f8029252bbb2322af612da954b7fea4456a063ef3f29fafed
7
+ data.tar.gz: 48f549fce5708546952078bd4b8180edc1d76685d24109c08d3a15d30fb0df7ea92f8d057f8beeb4cf96b77a22511fe63e7a65e1fd77644d0fbffaddf222d497
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- omniauth-osso (0.1.8.pre)
4
+ omniauth-osso (0.2.0)
5
5
  omniauth (~> 2.0.1)
6
6
  omniauth-oauth2 (>= 1.6, < 1.8)
7
7
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module OmniAuth
4
4
  module Osso
5
- VERSION = '0.1.8'
5
+ VERSION = '0.2.0'
6
6
  end
7
7
  end
@@ -88,10 +88,13 @@ module OmniAuth
88
88
  def user_param
89
89
  return @user_param if defined?(@user_param)
90
90
 
91
- @user_param = {
92
- domain: request.params['domain'],
93
- email: request.params['email']
94
- }.compact
91
+ params = request.params.reject { |_k, v| v.empty? }
92
+
93
+ @user_param = {}
94
+ @user_param = { domain: request.params['domain'] } if params['domain']
95
+ @user_param = { email: request.params['email'] } if params['email']
96
+
97
+ @user_param
95
98
  end
96
99
  end
97
100
  end
@@ -70,13 +70,48 @@ describe OmniAuth::Strategies::Osso do
70
70
  expect(instance.request_params[:domain]).to eq('example.com')
71
71
  end
72
72
 
73
- it 'includes email when an email address is passed as an authorize option' do
73
+ it 'includes email passed as a request param' do
74
74
  instance = subject.new('abc', 'def')
75
75
  instance.env = {}
76
76
  allow(instance).to receive(:request) do
77
77
  double('Request', params: { 'email' => 'user@example.com' }, scheme: 'https', url: url)
78
78
  end
79
+
80
+ expect(instance.request_params[:email]).to eq('user@example.com')
81
+ end
82
+
83
+ it 'only includes email as a request param when both keys are provided' do
84
+ instance = subject.new('abc', 'def')
85
+ instance.env = {}
86
+ allow(instance).to receive(:request) do
87
+ double('Request', params: { 'email' => 'user@example.com', 'domain' => 'example.com' }, scheme: 'https',
88
+ url: url)
89
+ end
90
+
79
91
  expect(instance.request_params[:email]).to eq('user@example.com')
92
+ expect(instance.request_params.keys).to_not include(:domain)
93
+ end
94
+
95
+ it 'domain as a request param when email key is a blank string' do
96
+ instance = subject.new('abc', 'def')
97
+ instance.env = {}
98
+ allow(instance).to receive(:request) do
99
+ double('Request', params: { 'email' => '', 'domain' => 'example.com' }, scheme: 'https',
100
+ url: url)
101
+ end
102
+
103
+ expect(instance.request_params[:domain]).to eq('example.com')
104
+ expect(instance.request_params.keys).to_not include(:email)
105
+ end
106
+
107
+ it 'only includes redirect_uri as a request param if neither email or domain are provided' do
108
+ instance = subject.new('abc', 'def')
109
+ instance.env = {}
110
+ allow(instance).to receive(:request) do
111
+ double('Request', params: {}, scheme: 'https', url: url)
112
+ end
113
+
114
+ expect(instance.request_params.keys).to eq([:redirect_uri])
80
115
  end
81
116
  end
82
117
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-osso
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Bauch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-25 00:00:00.000000000 Z
11
+ date: 2021-01-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: omniauth