omniauth-apple 0.0.2 → 0.0.3

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: c485aae891ca049ae67179446bce1b1ec65386a9b7cbfdd965b7fde65fa688eb
4
- data.tar.gz: ebbc624c1ebd90025579dc882c39717f65b7a1cc48cb81ac9e4557c6fd67d30b
3
+ metadata.gz: 9209606bc989d401e7a3b4df233f14b0d126a25a8e5fa4aaf39e52bdc86f8518
4
+ data.tar.gz: 863dbd6c01b45573d5e2fba5fc84078bff8415a265c4e99098495d49737b4bb2
5
5
  SHA512:
6
- metadata.gz: 77ac0078fd69ce3038de8e8096581364bc71d739cbba2ac2669a8ae64fa0d3612edbba1e066831625dee3f330eea83e18b7eb1e7778d0f5829a9f15459460ffe
7
- data.tar.gz: a0f3692d3d130cf18f82941a93ca2bf925c909c58d8bc105791f3b9f2ea22f768ca61c23059d504f7d348751336b383001b51a24f58ddfd707c82fda174e8392
6
+ metadata.gz: ec26c40908a1c669daa5adb25d985ce9d583466544e35094d0dc81089a3fe973bc71f1182cdbbe83614aa426de3a99560f28691d3f35b9641969d8c824b28511
7
+ data.tar.gz: b51d3b1ea9738f76cdc383cb5a616fe71b4d1e0a3acb72f16145e5c1d71556d0b0082d6b724a3c9c82c8ab28e8c3711c4489772a00b897941896a881e7d82aaa
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Settings><!--This file was automatically generated by Ruby plugin.
3
+ You are allowed to:
4
+ 1. Remove rake task
5
+ 2. Add existing rake tasks
6
+ To add existing rake tasks automatically delete this file and reload the project.
7
+ --><RakeGroup description="" fullCmd="" taksId="rake" /></Settings>
@@ -1,5 +1,5 @@
1
1
  module Omniauth
2
2
  module Apple
3
- VERSION = "0.0.2"
3
+ VERSION = "0.0.3"
4
4
  end
5
5
  end
@@ -13,7 +13,8 @@ module OmniAuth
13
13
  token_url: '/auth/token'
14
14
  option :authorize_params,
15
15
  response_mode: 'form_post'
16
-
16
+ option :authorized_client_ids, []
17
+
17
18
  uid { id_info['sub'] }
18
19
 
19
20
  info do
@@ -32,7 +33,7 @@ module OmniAuth
32
33
  end
33
34
 
34
35
  def client
35
- ::OAuth2::Client.new(options.client_id, client_secret, deep_symbolize(options.client_options))
36
+ ::OAuth2::Client.new(client_id, client_secret, deep_symbolize(options.client_options))
36
37
  end
37
38
 
38
39
  def callback_url
@@ -42,9 +43,19 @@ module OmniAuth
42
43
  private
43
44
 
44
45
  def id_info
45
- id_token = request.params['id_token'] || access_token.params['id_token']
46
- log(:info, "id_token: #{id_token}")
47
- @id_info ||= ::JWT.decode(id_token, nil, false)[0] # payload after decoding
46
+ if request.params&.key?('id_token') || access_token&.params&.key?('id_token')
47
+ id_token = request.params['id_token'] || access_token.params['id_token']
48
+ log(:info, "id_token: #{id_token}")
49
+ @id_info ||= ::JWT.decode(id_token, nil, false)[0] # payload after decoding
50
+ end
51
+ end
52
+
53
+ def client_id
54
+ unless id_info.nil?
55
+ return id_info['aud'] if options.authorized_client_ids.include? id_info['aud']
56
+ end
57
+
58
+ options.client_id
48
59
  end
49
60
 
50
61
  def user_info
@@ -70,7 +81,7 @@ module OmniAuth
70
81
  payload = {
71
82
  iss: options.team_id,
72
83
  aud: 'https://appleid.apple.com',
73
- sub: options.client_id,
84
+ sub: client_id,
74
85
  iat: Time.now.to_i,
75
86
  exp: Time.now.to_i + 60
76
87
  }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-apple
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - nhosoya
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2020-01-16 00:00:00.000000000 Z
12
+ date: 2020-05-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: omniauth-oauth2
@@ -76,6 +76,7 @@ extensions: []
76
76
  extra_rdoc_files: []
77
77
  files:
78
78
  - ".gitignore"
79
+ - ".rakeTasks"
79
80
  - Gemfile
80
81
  - LICENSE
81
82
  - README.md
@@ -106,7 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
106
107
  - !ruby/object:Gem::Version
107
108
  version: '0'
108
109
  requirements: []
109
- rubygems_version: 3.1.2
110
+ rubygems_version: 3.0.3
110
111
  signing_key:
111
112
  specification_version: 4
112
113
  summary: OmniAuth strategy for Sign In with Apple