omniauth-seznam-cz 0.0.2 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9271faeba9c9cea0f61c4e121255521bde0b3852c8170e807071793d550710ed
4
- data.tar.gz: 89eb3f23cc24cef52e775f029e0532354c77be40fc3da4da7deb5ad66af03997
3
+ metadata.gz: b50b0a245cbaf3a116526977f608e7f16fa340e3ae773a808df284d6af2371f3
4
+ data.tar.gz: 0ed84fd322352e4475007cf95f89ef4cc2c8893b28d357f4ed580103a7da8dac
5
5
  SHA512:
6
- metadata.gz: '03235926e68fbb8016ba3f0511b77458befedd8a6f61c32c51f9e8784707ac9b60db4a6685982faf8ca5548e5deb24d223bff4a0cca38baa7b2aec7bd795ce84'
7
- data.tar.gz: 960ca9ced83c30fc181f8846054f0c7e428059eae600641abe743759f7e41a6af9c10dde81e3c0573a4d2367e869b04213a23494b664e7ff54d1e443deab2f57
6
+ metadata.gz: 88ea2c7a4697174ea6efcf6455ece58f1021eb7f843753d3dd2b258ff7c59d3745009ef3700d0d2fe762b90e1658b376fdffccd3c7cea8bbdc4a56b2557718b6
7
+ data.tar.gz: f34371a3666f9ea950f80b43e7841304d25850181d50054290fc97bd938466c2948bf7ed4f7bf71eb743f214df36511c6efb2a07bba77b05ad0ad579651f0bd7
data/.gitignore CHANGED
@@ -10,3 +10,4 @@ test/tmp
10
10
  test/version_tmp
11
11
  tmp
12
12
  .idea/
13
+ Gemfile.lock
data/README.md CHANGED
@@ -47,23 +47,33 @@ Here's an example of an authentication hash available in the callback by accessi
47
47
 
48
48
  ```ruby
49
49
  {
50
- "provider" => "seznam_cz",
51
- "uid" => "100000000000000000000",
52
- "info" => {
53
- "name" => "John Smith",
54
- "email" => "john@example.com",
55
- "first_name" => "John",
56
- "last_name" => "Smith",
57
- "image" => "https://lh4.googleusercontent.com/photo.jpg",
58
- "urls" => {
59
- "google" => "https://plus.google.com/+JohnSmith"
60
- }
50
+ "provider": "seznam_cz",
51
+ "uid": "100000000000000000000",
52
+ "info": {
53
+ "name": "Jan Sterba",
54
+ "email": "jan.sterba@seznam.cz",
55
+ "firstname": "Jan",
56
+ "lastname": "Sterba",
57
+ "contact_phone": null,
58
+ "avatar_url": null
59
+ },
60
+ "credentials": {
61
+ "token": "TOKEN",
62
+ "refresh_token": "REFRESH_TOKEN",
63
+ "expires_at": 1672768905,
64
+ "expires": true
61
65
  },
62
- "credentials" => {
63
- "token" => "TOKEN",
64
- "refresh_token" => "REFRESH_TOKEN",
65
- "expires_at" => 1496120719,
66
- "expires" => true
66
+ "extra": {
67
+ "raw_info": {
68
+ "advert_user_id": "100000000000000000000",
69
+ "domain": "seznam.cz",
70
+ "firstname": "Jan",
71
+ "lastname": "Sterba",
72
+ "message": "ok",
73
+ "oauth_user_id": "100000000000000000001",
74
+ "status": 200,
75
+ "username": "jan.sterba"
76
+ }
67
77
  }
68
78
  }
69
79
  ```
@@ -0,0 +1,5 @@
1
+ #!/bin/bash
2
+
3
+ rm *.gem
4
+ gem build omniauth-seznam-cz.gemspec
5
+ gem push omniauth-seznam-cz-*.gem
@@ -2,6 +2,6 @@
2
2
 
3
3
  module OmniAuth
4
4
  module SeznamCz
5
- VERSION = '0.0.2'
5
+ VERSION = '1.0.0'
6
6
  end
7
7
  end
@@ -12,7 +12,6 @@ module OmniAuth
12
12
  BASE_SCOPES = %w[identity contact-phone avatar].freeze
13
13
  DEFAULT_SCOPE = 'identity'
14
14
  USER_INFO_URL = 'https://login.szn.cz/api/v1/user'
15
- IMAGE_SIZE_REGEXP = /(s\d+(-c)?)|(w\d+-h\d+(-c)?)|(w\d+(-c)?)|(h\d+(-c)?)|c/
16
15
 
17
16
  option :name, 'seznam_cz'
18
17
  option :skip_image_info, true
@@ -20,9 +19,10 @@ module OmniAuth
20
19
  option :authorized_client_ids, []
21
20
 
22
21
  option :client_options,
23
- site: 'https://login.szn.cz/api/v1/oauth',
24
- authorize_url: 'https://login.szn.cz/api/v1/oauth/auth',
25
- token_url: 'https://login.szn.cz/api/v1/oauth/token'
22
+ site: 'https://login.szn.cz',
23
+ authorize_url: '/api/v1/oauth/auth',
24
+ token_url: '/api/v1/oauth/token',
25
+ auth_scheme: :request_body
26
26
 
27
27
  def authorize_params
28
28
  super.tap do |params|
@@ -35,14 +35,14 @@ module OmniAuth
35
35
  end
36
36
  end
37
37
 
38
- uid { raw_info['sub'] }
38
+ uid { raw_info['oauth_user_id'] }
39
39
 
40
40
  info do
41
41
  {
42
- username: raw_info['username'],
43
- email: raw_info['username'],
44
- domain: raw_info['domain'],
42
+ name: "#{raw_info['firstname']} #{raw_info['lastname']}",
43
+ email: "#{raw_info['username']}@#{raw_info['domain']}",
45
44
  firstname: raw_info['firstname'],
45
+ lastname: raw_info['lastname'],
46
46
  contact_phone: raw_info['contact-phone'],
47
47
  avatar_url: raw_info['avatar-url']
48
48
  }
@@ -52,6 +52,10 @@ module OmniAuth
52
52
  { 'raw_info' => raw_info }
53
53
  end
54
54
 
55
+ def callback_url
56
+ full_host + callback_path
57
+ end
58
+
55
59
  def raw_info
56
60
  @raw_info ||= access_token.get(USER_INFO_URL).parsed
57
61
  end
@@ -31,15 +31,15 @@ describe OmniAuth::Strategies::SeznamCz do
31
31
 
32
32
  describe '#client_options' do
33
33
  it 'has correct site' do
34
- expect(subject.client.site).to eq('https://login.szn.cz/api/v1/oauth')
34
+ expect(subject.client.site).to eq('https://login.szn.cz')
35
35
  end
36
36
 
37
37
  it 'has correct authorize_url' do
38
- expect(subject.client.options[:authorize_url]).to eq('https://login.szn.cz/api/v1/oauth/auth')
38
+ expect(subject.client.options[:authorize_url]).to eq('/api/v1/oauth/auth')
39
39
  end
40
40
 
41
41
  it 'has correct token_url' do
42
- expect(subject.client.options[:token_url]).to eq('https://login.szn.cz/api/v1/oauth/token')
42
+ expect(subject.client.options[:token_url]).to eq('/api/v1/oauth/token')
43
43
  end
44
44
 
45
45
  describe 'overrides' do
@@ -188,5 +188,4 @@ describe OmniAuth::Strategies::SeznamCz do
188
188
  expect(subject.token_params['bad']).to eq(nil)
189
189
  end
190
190
  end
191
-
192
191
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-seznam-cz
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Sterba
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-02 00:00:00.000000000 Z
11
+ date: 2022-01-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oauth2
@@ -107,9 +107,9 @@ files:
107
107
  - ".travis.yml"
108
108
  - CHANGELOG.md
109
109
  - Gemfile
110
- - Gemfile.lock
111
110
  - README.md
112
111
  - Rakefile
112
+ - bin/publish-gem.sh
113
113
  - lib/omniauth-seznam-cz.rb
114
114
  - lib/omniauth/seznam_cz.rb
115
115
  - lib/omniauth/seznam_cz/version.rb
data/Gemfile.lock DELETED
@@ -1,99 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- omniauth-seznam-cz (0.0.1)
5
- oauth2 (~> 1.1)
6
- omniauth (~> 2.0)
7
- omniauth-oauth2 (~> 1.7.1)
8
-
9
- GEM
10
- remote: https://rubygems.org/
11
- specs:
12
- ast (2.4.2)
13
- diff-lcs (1.5.0)
14
- faraday (1.8.0)
15
- faraday-em_http (~> 1.0)
16
- faraday-em_synchrony (~> 1.0)
17
- faraday-excon (~> 1.1)
18
- faraday-httpclient (~> 1.0.1)
19
- faraday-net_http (~> 1.0)
20
- faraday-net_http_persistent (~> 1.1)
21
- faraday-patron (~> 1.0)
22
- faraday-rack (~> 1.0)
23
- multipart-post (>= 1.2, < 3)
24
- ruby2_keywords (>= 0.0.4)
25
- faraday-em_http (1.0.0)
26
- faraday-em_synchrony (1.0.0)
27
- faraday-excon (1.1.0)
28
- faraday-httpclient (1.0.1)
29
- faraday-net_http (1.0.1)
30
- faraday-net_http_persistent (1.2.0)
31
- faraday-patron (1.0.0)
32
- faraday-rack (1.0.0)
33
- hashie (5.0.0)
34
- jwt (2.3.0)
35
- multi_json (1.15.0)
36
- multi_xml (0.6.0)
37
- multipart-post (2.1.1)
38
- oauth2 (1.4.7)
39
- faraday (>= 0.8, < 2.0)
40
- jwt (>= 1.0, < 3.0)
41
- multi_json (~> 1.3)
42
- multi_xml (~> 0.5)
43
- rack (>= 1.2, < 3)
44
- omniauth (2.0.4)
45
- hashie (>= 3.4.6)
46
- rack (>= 1.6.2, < 3)
47
- rack-protection
48
- omniauth-oauth2 (1.7.2)
49
- oauth2 (~> 1.4)
50
- omniauth (>= 1.9, < 3)
51
- parallel (1.21.0)
52
- parser (3.0.3.2)
53
- ast (~> 2.4.1)
54
- rack (2.2.3)
55
- rack-protection (2.1.0)
56
- rack
57
- rainbow (3.0.0)
58
- rake (12.3.3)
59
- regexp_parser (2.2.0)
60
- rexml (3.2.5)
61
- rspec (3.10.0)
62
- rspec-core (~> 3.10.0)
63
- rspec-expectations (~> 3.10.0)
64
- rspec-mocks (~> 3.10.0)
65
- rspec-core (3.10.1)
66
- rspec-support (~> 3.10.0)
67
- rspec-expectations (3.10.1)
68
- diff-lcs (>= 1.2.0, < 2.0)
69
- rspec-support (~> 3.10.0)
70
- rspec-mocks (3.10.2)
71
- diff-lcs (>= 1.2.0, < 2.0)
72
- rspec-support (~> 3.10.0)
73
- rspec-support (3.10.3)
74
- rubocop (0.93.1)
75
- parallel (~> 1.10)
76
- parser (>= 2.7.1.5)
77
- rainbow (>= 2.2.2, < 4.0)
78
- regexp_parser (>= 1.8)
79
- rexml
80
- rubocop-ast (>= 0.6.0)
81
- ruby-progressbar (~> 1.7)
82
- unicode-display_width (>= 1.4.0, < 2.0)
83
- rubocop-ast (1.15.1)
84
- parser (>= 3.0.1.1)
85
- ruby-progressbar (1.11.0)
86
- ruby2_keywords (0.0.5)
87
- unicode-display_width (1.8.0)
88
-
89
- PLATFORMS
90
- arm64-darwin-20
91
-
92
- DEPENDENCIES
93
- omniauth-seznam-cz!
94
- rake (~> 12.0)
95
- rspec (~> 3.6)
96
- rubocop (~> 0.49)
97
-
98
- BUNDLED WITH
99
- 2.2.16