zaikio-oauth_client 0.19.1 → 0.20.0
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 821f98a1795103278c91ca8ab8a1e22696eaafa05359be7cfeca5511efa9f125
|
4
|
+
data.tar.gz: d92c6e1f033ae45682192875f95a4021ce47489d5ec97fd53d4d8d725ad8344c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6932c3a87827582e28c55540af6db76066e14fc61152ad4e50245ed916792a71545ebd40d9882c62ca6713bb40e3e7bfe4201c22fad5d364b9b8e1d61bcda640
|
7
|
+
data.tar.gz: 203fda493a173f5619eb32e536624848fcbd39623d35db5243c79bdbdfb3664b109b72bde6a1ee069ff1446a07931784a620588b641c9c8996aafee2d32441f7
|
@@ -1,11 +1,13 @@
|
|
1
1
|
module Zaikio
|
2
2
|
module OAuthClient
|
3
|
-
module Authenticatable
|
3
|
+
module Authenticatable # rubocop:disable Metrics/ModuleLength
|
4
4
|
extend ActiveSupport::Concern
|
5
5
|
|
6
6
|
def new
|
7
7
|
opts = params.permit(:client_name, :show_signup, :prompt, :prompt_email_confirmation,
|
8
|
-
:force_login, :state, :lang
|
8
|
+
:force_login, :state, :lang,
|
9
|
+
person: %i[first_name name email],
|
10
|
+
organization: [:name, :country_code, { kinds: [] }])
|
9
11
|
opts[:lang] ||= I18n.locale if defined?(I18n)
|
10
12
|
client_name = opts.delete(:client_name)
|
11
13
|
opts[:state] ||= session[:state] = SecureRandom.urlsafe_base64(32)
|
@@ -3,7 +3,7 @@ module Zaikio
|
|
3
3
|
module TestHelper
|
4
4
|
extend ActiveSupport::Concern
|
5
5
|
|
6
|
-
VirtualAccessToken = Struct.new(:bearer_id, :bearer_type, :audience, :expired?, keyword_init: true)
|
6
|
+
VirtualAccessToken = Struct.new(:id, :bearer_id, :bearer_type, :audience, :expired?, keyword_init: true)
|
7
7
|
|
8
8
|
class << self
|
9
9
|
def find_active_access_token(id)
|
@@ -12,6 +12,7 @@ module Zaikio
|
|
12
12
|
_, audience, person_id = id.split(":")
|
13
13
|
|
14
14
|
VirtualAccessToken.new(
|
15
|
+
id: id,
|
15
16
|
bearer_id: person_id,
|
16
17
|
audience: audience,
|
17
18
|
bearer_type: "Person",
|
data/lib/zaikio/oauth_client.rb
CHANGED
@@ -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.
|
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,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zaikio-oauth_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.20.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zaikio GmbH
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-08-
|
11
|
+
date: 2022-08-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionpack
|