apple_id 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/apple_id/id_token.rb +19 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '018fb2f186c24595a953c2fe8e79c9091fcf83d10915b701dac91021dacfc04b'
|
4
|
+
data.tar.gz: a8b6bf32091ff20b60779551469a383f09ccf90d736ea1004046a9a635f993d2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 195ae7e87dff57ca72ee84be036a2a5927c9fdb7cbd9fa2f48e3a7421a0a9d77cd9ef7a042e1c567cdfff8f72305d9623889fade86a18b3939c2d0ba1efb7d32
|
7
|
+
data.tar.gz: acbc83c4ceb9c38e18db63b66a55855b96a26ca1b01f208cc7258bcb4c582487026c35bbe8b0446b0d8d0118c575b0201b7aab77b74e4d48f3b89bf83bc5d46c
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.4.0
|
data/lib/apple_id/id_token.rb
CHANGED
@@ -2,13 +2,22 @@ module AppleID
|
|
2
2
|
class IdToken < OpenIDConnect::ResponseObject::IdToken
|
3
3
|
class VerificationFailed < StandardError; end
|
4
4
|
|
5
|
-
attr_optional :email
|
5
|
+
attr_optional :email, :email_verified, :is_private_email, :nonce_supported
|
6
6
|
attr_accessor :original_jwt_string
|
7
7
|
alias_method :original_jwt, :raw_attributes
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
[:email_verified, :is_private_email, :nonce_supported].each do |boolean_claim|
|
10
|
+
define_method :"#{boolean_claim}?" do
|
11
|
+
claim_value = send(boolean_claim)
|
12
|
+
case claim_value
|
13
|
+
when String
|
14
|
+
claim_value == 'true'
|
15
|
+
else
|
16
|
+
!!claim_value
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
12
21
|
def verify!(verify_signature: true, client: nil, nonce: nil, state: nil, access_token: nil, code: nil)
|
13
22
|
verify_signature! if verify_signature
|
14
23
|
verify_claims! client, nonce, state, access_token, code
|
@@ -63,8 +72,12 @@ module AppleID
|
|
63
72
|
if aud.present? && self.aud != aud
|
64
73
|
failure_reasons << :aud
|
65
74
|
end
|
66
|
-
if
|
67
|
-
|
75
|
+
if !nonce_supported? && self.nonce.blank?
|
76
|
+
AppleID.logger.warn 'nonce is\'nt supported on this platform'
|
77
|
+
else
|
78
|
+
if nonce.present? && self.nonce != nonce
|
79
|
+
failure_reasons << :nonce
|
80
|
+
end
|
68
81
|
end
|
69
82
|
if s_hash.present? && self.s_hash != s_hash
|
70
83
|
failure_reasons << :s_hash
|
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: 0.
|
4
|
+
version: 0.4.0
|
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: 2020-03-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack-oauth2
|