apple_id 1.2.0 → 1.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/FUNDING.yml +3 -0
- data/.travis.yml +2 -1
- data/README.md +2 -2
- data/VERSION +1 -1
- data/apple_id.gemspec +1 -1
- data/lib/apple_id/client.rb +7 -1
- data/lib/apple_id/event_token/event.rb +11 -0
- data/lib/apple_id/event_token.rb +60 -0
- data/lib/apple_id/id_token.rb +1 -1
- data/lib/apple_id.rb +4 -0
- metadata +8 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 535212dfcb103a30e0977d80a0d5b8bd21d8ce25ccd0d13bf450542ba706473b
|
4
|
+
data.tar.gz: df08efbc2cc0de63e9645e8d4aa9a63c5f7a632b3b61fcd27f30c47cab52c673
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 067b35d844a7e2a2c802d0823c5ef2572e4b2d1515b7b9756c3b6393ebc0633074708656fc42d89ed7522acd69fb0d377102e770e643fe31ad6eb0cc394c0d64
|
7
|
+
data.tar.gz: 13439c70fc5982bd0576645b1411979f74b2adf4df0252e05fe03c55a691a218f2d0d63ae363a0e27c434abcf26dd9a9450c42e5ffb15e5388deb2344987ede9
|
data/.github/FUNDING.yml
ADDED
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -36,7 +36,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
36
36
|
|
37
37
|
## Contributing
|
38
38
|
|
39
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
39
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/nov/apple_id. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
40
40
|
|
41
41
|
## License
|
42
42
|
|
@@ -44,4 +44,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
44
44
|
|
45
45
|
## Code of Conduct
|
46
46
|
|
47
|
-
Everyone interacting in the AppleID project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/
|
47
|
+
Everyone interacting in the AppleID project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/nov/apple_id/blob/master/CODE_OF_CONDUCT.md).
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.4.1
|
data/apple_id.gemspec
CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
19
|
spec.require_paths = ['lib']
|
20
20
|
|
21
|
-
spec.add_runtime_dependency 'rack-oauth2', '~> 1.
|
21
|
+
spec.add_runtime_dependency 'rack-oauth2', '~> 1.21'
|
22
22
|
spec.add_runtime_dependency 'openid_connect', '~> 1.3.0'
|
23
23
|
spec.add_development_dependency 'bundler'
|
24
24
|
spec.add_development_dependency 'rake'
|
data/lib/apple_id/client.rb
CHANGED
@@ -7,7 +7,8 @@ module AppleID
|
|
7
7
|
def initialize(attributes)
|
8
8
|
attributes_with_default = {
|
9
9
|
authorization_endpoint: File.join(ISSUER, '/auth/authorize'),
|
10
|
-
token_endpoint:
|
10
|
+
token_endpoint: File.join(ISSUER, '/auth/token'),
|
11
|
+
revocation_endpoint: File.join(ISSUER, '/auth/revoke'),
|
11
12
|
}.merge(attributes)
|
12
13
|
super attributes_with_default
|
13
14
|
end
|
@@ -17,6 +18,11 @@ module AppleID
|
|
17
18
|
super :body, options
|
18
19
|
end
|
19
20
|
|
21
|
+
def revoke!(options = {})
|
22
|
+
self.secret = client_secret_jwt
|
23
|
+
super :body, options
|
24
|
+
end
|
25
|
+
|
20
26
|
private
|
21
27
|
|
22
28
|
def client_secret_jwt
|
@@ -0,0 +1,60 @@
|
|
1
|
+
module AppleID
|
2
|
+
class EventToken < OpenIDConnect::ConnectObject
|
3
|
+
class VerificationFailed < Error; end
|
4
|
+
|
5
|
+
attr_required :iss, :aud, :exp, :iat, :jti, :events
|
6
|
+
alias_method :original_jwt, :raw_attributes
|
7
|
+
alias_method :event, :events
|
8
|
+
|
9
|
+
def initialize(attributes = {})
|
10
|
+
super
|
11
|
+
@events = Event.decode attributes[:events]
|
12
|
+
end
|
13
|
+
|
14
|
+
def verify!(verify_signature: true, client: nil)
|
15
|
+
verify_signature! if verify_signature
|
16
|
+
verify_claims! client
|
17
|
+
self
|
18
|
+
end
|
19
|
+
|
20
|
+
class << self
|
21
|
+
def decode(jwt_string)
|
22
|
+
new JSON::JWT.decode jwt_string, :skip_verification
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def verify_signature!
|
29
|
+
original_jwt.verify! JWKS.fetch(original_jwt.kid)
|
30
|
+
rescue
|
31
|
+
raise VerificationFailed, 'Signature Verification Failed'
|
32
|
+
end
|
33
|
+
|
34
|
+
def verify_claims!(client)
|
35
|
+
aud = if client.respond_to?(:identifier)
|
36
|
+
client.identifier
|
37
|
+
else
|
38
|
+
client
|
39
|
+
end
|
40
|
+
|
41
|
+
failure_reasons = []
|
42
|
+
if self.iss != ISSUER
|
43
|
+
failure_reasons << :iss
|
44
|
+
end
|
45
|
+
if aud.present? && self.aud != aud
|
46
|
+
failure_reasons << :aud
|
47
|
+
end
|
48
|
+
if Time.now.to_i < iat
|
49
|
+
failure_reasons << :iat
|
50
|
+
end
|
51
|
+
if Time.now.to_i >= exp
|
52
|
+
failure_reasons << :exp
|
53
|
+
end
|
54
|
+
|
55
|
+
if failure_reasons.present?
|
56
|
+
raise VerificationFailed, "Claims Verification Failed at #{failure_reasons}"
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
data/lib/apple_id/id_token.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module AppleID
|
2
2
|
class IdToken < OpenIDConnect::ResponseObject::IdToken
|
3
|
-
class VerificationFailed <
|
3
|
+
class VerificationFailed < Error; end
|
4
4
|
|
5
5
|
attr_optional :email, :email_verified, :is_private_email, :nonce_supported, :real_user_status
|
6
6
|
attr_accessor :original_jwt_string
|
data/lib/apple_id.rb
CHANGED
@@ -8,6 +8,8 @@ module AppleID
|
|
8
8
|
::File.join(::File.dirname(__FILE__), '../VERSION')
|
9
9
|
).chomp
|
10
10
|
|
11
|
+
class Error < StandardError; end
|
12
|
+
|
11
13
|
def self.logger
|
12
14
|
@@logger
|
13
15
|
end
|
@@ -56,4 +58,6 @@ require 'apple_id/access_token'
|
|
56
58
|
require 'apple_id/id_token'
|
57
59
|
require 'apple_id/id_token/real_user_status'
|
58
60
|
require 'apple_id/jwks'
|
61
|
+
require 'apple_id/event_token'
|
62
|
+
require 'apple_id/event_token/event'
|
59
63
|
require 'apple_id/api/user_migration'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: apple_id
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- nov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-07-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack-oauth2
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1.
|
19
|
+
version: '1.21'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '1.
|
26
|
+
version: '1.21'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: openid_connect
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -129,6 +129,7 @@ executables: []
|
|
129
129
|
extensions: []
|
130
130
|
extra_rdoc_files: []
|
131
131
|
files:
|
132
|
+
- ".github/FUNDING.yml"
|
132
133
|
- ".gitignore"
|
133
134
|
- ".rspec"
|
134
135
|
- ".travis.yml"
|
@@ -145,6 +146,8 @@ files:
|
|
145
146
|
- lib/apple_id/access_token.rb
|
146
147
|
- lib/apple_id/api/user_migration.rb
|
147
148
|
- lib/apple_id/client.rb
|
149
|
+
- lib/apple_id/event_token.rb
|
150
|
+
- lib/apple_id/event_token/event.rb
|
148
151
|
- lib/apple_id/id_token.rb
|
149
152
|
- lib/apple_id/id_token/real_user_status.rb
|
150
153
|
- lib/apple_id/jwks.rb
|
@@ -167,7 +170,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
167
170
|
- !ruby/object:Gem::Version
|
168
171
|
version: '0'
|
169
172
|
requirements: []
|
170
|
-
rubygems_version: 3.1.
|
173
|
+
rubygems_version: 3.1.6
|
171
174
|
signing_key:
|
172
175
|
specification_version: 4
|
173
176
|
summary: Sign-in with Apple Backend
|