zaikio-oauth_client 0.19.2 → 0.19.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: 34a7bf1aa494d16086807798f3f15a3634571b485afae332ec57e7871b61dbd6
4
- data.tar.gz: 3ee46611f92593cdf2cfd60403fe08f0d5401aca3217b0d063e040d6583a95c0
3
+ metadata.gz: 58d2e1d10678b7eddb4afc7931c94e04299b63027c3b02c5773e03bf74b29b7d
4
+ data.tar.gz: 44459fbc11ec98ccdd1f88819416f50b704a1d9f1a32a7a24d17a92b863563e9
5
5
  SHA512:
6
- metadata.gz: b81867f191fd382ab76e06c2e3f4d7c7e76ad351ef10bd477f4eb352a7bf9545e677fdaefb7b83c6cdf3706caa86b095da8fbcd610ef9fae851c78c393312fbf
7
- data.tar.gz: 66de7443b83d3976aa42216969809ccb88c7e0d1e4c22c1c7a43bb59aad4c30b87e44fc41f3a72bdab4ecdb91ba1c4789676e97b48d40a5f03cc72a7555d72e2
6
+ metadata.gz: c4dd805f5c186d1d502afd9788b77ed7f9178672c841b03d7f9c5c97f81d5dc3243a255f1087f1e49bc312a024b4758df7599e871efcd650e34097527c927e51
7
+ data.tar.gz: 025cfe46f4cdc9cb9138b814d86a82f3b7590a6fba2e1261bbe420ba6d16a43392eb88306500a02a2fa5cc3047a7970a24e7c6e28fc6bf91dcc6833554d5165a
@@ -1,5 +1,5 @@
1
1
  module Zaikio
2
2
  module OAuthClient
3
- VERSION = "0.19.2".freeze
3
+ VERSION = "0.19.3".freeze
4
4
  end
5
5
  end
@@ -80,7 +80,7 @@ module Zaikio
80
80
 
81
81
  # This method can be used to find an active access token by id.
82
82
  # It might refresh the access token to get an active one.
83
- def find_active_access_token(id)
83
+ def find_active_access_token(id, valid_for: 30.seconds)
84
84
  return unless id
85
85
 
86
86
  if Rails.env.test?
@@ -88,7 +88,9 @@ module Zaikio
88
88
  return access_token if access_token
89
89
  end
90
90
 
91
- access_token = Zaikio::AccessToken.find_by(id: id)
91
+ access_token = Zaikio::AccessToken.valid(valid_for.from_now).or(
92
+ Zaikio::AccessToken.valid_refresh(valid_for.from_now)
93
+ ).find_by(id: id)
92
94
  access_token = access_token.refresh! if access_token&.expired?
93
95
 
94
96
  access_token
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zaikio-oauth_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.19.2
4
+ version: 0.19.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zaikio GmbH