apple_id 1.4.1 → 1.5.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: 535212dfcb103a30e0977d80a0d5b8bd21d8ce25ccd0d13bf450542ba706473b
4
- data.tar.gz: df08efbc2cc0de63e9645e8d4aa9a63c5f7a632b3b61fcd27f30c47cab52c673
3
+ metadata.gz: d960eb2153d5e632113ef0e7c916d1e4c98cc3c113cc3f174f6b3fbec13eb656
4
+ data.tar.gz: 5d894c4223f3ef3f0648736c3f9bcec50e798a59efc418526091cc740186eca7
5
5
  SHA512:
6
- metadata.gz: 067b35d844a7e2a2c802d0823c5ef2572e4b2d1515b7b9756c3b6393ebc0633074708656fc42d89ed7522acd69fb0d377102e770e643fe31ad6eb0cc394c0d64
7
- data.tar.gz: 13439c70fc5982bd0576645b1411979f74b2adf4df0252e05fe03c55a691a218f2d0d63ae363a0e27c434abcf26dd9a9450c42e5ffb15e5388deb2344987ede9
6
+ metadata.gz: 3a14c1cb7ee1eb22b902e8f536106c2141eb03d381131603c3627767cfc78755ce7f7a71b5a244d3ecf5682d58763c8c683ace0c6d76caf91838530dd833cc18
7
+ data.tar.gz: 115cd71531fefe3b923a8bcd47ea82edf1f8ef5f2cf0e63ebc872fe754a2e546fa94078009e36cf740b20f6f0cff900c0325e0f9c7ee445fdfae281f53030a75
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.4.1
1
+ 1.5.0
data/apple_id.gemspec CHANGED
@@ -18,7 +18,8 @@ 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'
21
+ spec.add_runtime_dependency 'json-jwt', '~> 1.15.0'
22
+ spec.add_runtime_dependency 'rack-oauth2', '~> 1.21.2'
22
23
  spec.add_runtime_dependency 'openid_connect', '~> 1.3.0'
23
24
  spec.add_development_dependency 'bundler'
24
25
  spec.add_development_dependency 'rake'
@@ -2,6 +2,30 @@ module AppleID
2
2
  class EventToken::Event < OpenIDConnect::ConnectObject
3
3
  attr_required :type, :sub, :event_time
4
4
 
5
+ module Type
6
+ EMAIL_ENABLED = 'email-enabled'
7
+ EMAIL_DISABLED = 'email-disabled'
8
+ CONSENT_REVOKED = 'consent-revoked'
9
+ ACCOUNT_DELETED = 'account-delete'
10
+ end
11
+
12
+ def email_enabled?
13
+ type == Type::EMAIL_ENABLED
14
+ end
15
+
16
+ def email_disabled?
17
+ type == Type::EMAIL_DISABLED
18
+ end
19
+
20
+ def consent_revoked?
21
+ type == Type::CONSENT_REVOKED
22
+ end
23
+
24
+ def account_deleted?
25
+ type == Type::ACCOUNT_DELETED
26
+ end
27
+ alias_method :account_delete?, :account_deleted?
28
+
5
29
  class << self
6
30
  def decode(json_string)
7
31
  new JSON.parse(json_string).with_indifferent_access
@@ -6,6 +6,8 @@ module AppleID
6
6
  alias_method :original_jwt, :raw_attributes
7
7
  alias_method :event, :events
8
8
 
9
+ delegate :type, :sub, :event_time, :email_enabled?, :email_disabled?, :consent_revoked?, :account_deleted?, to: :event
10
+
9
11
  def initialize(attributes = {})
10
12
  super
11
13
  @events = Event.decode attributes[:events]
data/lib/apple_id/jwks.rb CHANGED
@@ -1,27 +1,14 @@
1
1
  module AppleID
2
2
  class JWKS < JSON::JWK::Set
3
- class Cache
4
- def fetch(cache_key)
5
- yield
6
- end
7
- end
8
-
9
3
  def self.cache=(cache)
10
- @@cache = cache
4
+ JSON::JWK::Set::Fetcher.cache = cache
11
5
  end
12
6
  def self.cache
13
- @@cache
7
+ JSON::JWK::Set::Fetcher.cache
14
8
  end
15
- self.cache = Cache.new
16
9
 
17
- def self.fetch(cache_key)
18
- jwks = cache.fetch("apple_id:jwks:#{cache_key}") do
19
- new(
20
- JSON.parse(
21
- OpenIDConnect.http_client.get_content(JWKS_URI)
22
- ).with_indifferent_access[:keys]
23
- )
24
- end
10
+ def self.fetch(kid)
11
+ JSON::JWK::Set::Fetcher.fetch JWKS_URI, kid: kid
25
12
  end
26
13
  end
27
14
  end
metadata CHANGED
@@ -1,29 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apple_id
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - nov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-07-12 00:00:00.000000000 Z
11
+ date: 2022-08-11 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: json-jwt
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 1.15.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 1.15.0
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: rack-oauth2
15
29
  requirement: !ruby/object:Gem::Requirement
16
30
  requirements:
17
31
  - - "~>"
18
32
  - !ruby/object:Gem::Version
19
- version: '1.21'
33
+ version: 1.21.2
20
34
  type: :runtime
21
35
  prerelease: false
22
36
  version_requirements: !ruby/object:Gem::Requirement
23
37
  requirements:
24
38
  - - "~>"
25
39
  - !ruby/object:Gem::Version
26
- version: '1.21'
40
+ version: 1.21.2
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: openid_connect
29
43
  requirement: !ruby/object:Gem::Requirement