omniauth-seznam-cz 0.1.0 → 1.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: c648d155cac9a61f968db43ea6fc26ff6d665921fec222a48b66211673f9b7ad
4
- data.tar.gz: 6c9334d0ff6cea90af56f1f2f24203ce9b655f7548f2aa76f6b0bcaabe2f9c9c
3
+ metadata.gz: b50b0a245cbaf3a116526977f608e7f16fa340e3ae773a808df284d6af2371f3
4
+ data.tar.gz: 0ed84fd322352e4475007cf95f89ef4cc2c8893b28d357f4ed580103a7da8dac
5
5
  SHA512:
6
- metadata.gz: ca5180f1309200a762c9fd2c1fdad9d346730b96c2b43a4f4c186e8b8675c35edb689ca27cae35e91ae95fa55052b71a0e5eaad576685b92cd2beabfe0e2d8ea
7
- data.tar.gz: 6651969510ae8717ed2e8018d2585198ed09ede87dfbdbeda4691094e00b4b5ca86573eafee8feb549831bd3e13917ea53ad3f5a746687e331ac1b8c91057341
6
+ metadata.gz: 88ea2c7a4697174ea6efcf6455ece58f1021eb7f843753d3dd2b258ff7c59d3745009ef3700d0d2fe762b90e1658b376fdffccd3c7cea8bbdc4a56b2557718b6
7
+ data.tar.gz: f34371a3666f9ea950f80b43e7841304d25850181d50054290fc97bd938466c2948bf7ed4f7bf71eb743f214df36511c6efb2a07bba77b05ad0ad579651f0bd7
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
  ```
@@ -2,6 +2,6 @@
2
2
 
3
3
  module OmniAuth
4
4
  module SeznamCz
5
- VERSION = '0.1.0'
5
+ VERSION = '1.0.0'
6
6
  end
7
7
  end
@@ -6,6 +6,7 @@ require 'uri'
6
6
 
7
7
  module OmniAuth
8
8
  module Strategies
9
+ # Main class for Seznam.cz strategy.
9
10
  class SeznamCz < OmniAuth::Strategies::OAuth2
10
11
  ALLOWED_ISSUERS = ['login.szn.cz'].freeze
11
12
  BASE_SCOPES = %w[identity contact-phone avatar].freeze
@@ -34,14 +35,14 @@ module OmniAuth
34
35
  end
35
36
  end
36
37
 
37
- uid { raw_info['sub'] }
38
+ uid { raw_info['oauth_user_id'] }
38
39
 
39
40
  info do
40
41
  {
41
- username: raw_info['username'],
42
- email: raw_info['username'],
43
- domain: raw_info['domain'],
42
+ name: "#{raw_info['firstname']} #{raw_info['lastname']}",
43
+ email: "#{raw_info['username']}@#{raw_info['domain']}",
44
44
  firstname: raw_info['firstname'],
45
+ lastname: raw_info['lastname'],
45
46
  contact_phone: raw_info['contact-phone'],
46
47
  avatar_url: raw_info['avatar-url']
47
48
  }
@@ -51,6 +52,10 @@ module OmniAuth
51
52
  { 'raw_info' => raw_info }
52
53
  end
53
54
 
55
+ def callback_url
56
+ full_host + callback_path
57
+ end
58
+
54
59
  def raw_info
55
60
  @raw_info ||= access_token.get(USER_INFO_URL).parsed
56
61
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-seznam-cz
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Sterba