zaikio-oauth_client 0.15.1.beta1 → 0.17.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/zaikio/oauth_client/connections_controller.rb +4 -0
- data/app/controllers/zaikio/oauth_client/subscriptions_controller.rb +1 -1
- data/app/models/zaikio/access_token.rb +1 -1
- data/lib/zaikio/oauth_client/authenticatable.rb +16 -3
- data/lib/zaikio/oauth_client/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 237bdb03b2ab2870ef2c0b9a92c9dac64fb2c67df2bba8e9234831eb14954f42
|
4
|
+
data.tar.gz: ae977109316a023585e008e669958775534eef2ecea309ede9b373d44f368fd4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 44945aba1999049638cca10555d4dc192e191fa1fdf81965fa43fe31d1ab01c5e6054769a94efe0e862feee171a24b6d9a50853395628e497e30fb4629295ddf
|
7
|
+
data.tar.gz: b97fe832a40614ef14da36d12492e368c86460b0dde1867f411d0360d581fb3fe60256b3efea8d1653d744a1598908d9636d1a97c7043a59de56f6b87deb23ee
|
@@ -63,7 +63,7 @@ module Zaikio
|
|
63
63
|
end
|
64
64
|
|
65
65
|
def bearer_klass
|
66
|
-
return unless Zaikio.const_defined?("Hub::Models", false)
|
66
|
+
return unless Zaikio.const_defined?(:"Hub::Models", false)
|
67
67
|
|
68
68
|
if Zaikio::Hub::Models.configuration.respond_to?(:"#{bearer_type.underscore}_class_name")
|
69
69
|
Zaikio::Hub::Models.configuration.public_send(:"#{bearer_type.underscore}_class_name").constantize
|
@@ -4,7 +4,8 @@ module Zaikio
|
|
4
4
|
extend ActiveSupport::Concern
|
5
5
|
|
6
6
|
def new
|
7
|
-
opts = params.permit(:client_name, :show_signup, :prompt, :
|
7
|
+
opts = params.permit(:client_name, :show_signup, :prompt, :prompt_email_confirmation,
|
8
|
+
:force_login, :state, :lang)
|
8
9
|
opts[:lang] ||= I18n.locale if defined?(I18n)
|
9
10
|
client_name = opts.delete(:client_name)
|
10
11
|
opts[:state] ||= session[:state] = SecureRandom.urlsafe_base64(32)
|
@@ -13,10 +14,10 @@ module Zaikio
|
|
13
14
|
redirect_uri: approve_url(client_name),
|
14
15
|
scope: oauth_scope,
|
15
16
|
**opts
|
16
|
-
)
|
17
|
+
), allow_other_host: true
|
17
18
|
end
|
18
19
|
|
19
|
-
def approve # rubocop:disable Metrics/MethodLength,Metrics/AbcSize
|
20
|
+
def approve # rubocop:disable Metrics/MethodLength,Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
|
20
21
|
if params[:error].present?
|
21
22
|
redirect_to send(
|
22
23
|
respond_to?(:error_path_for) ? :error_path_for : :default_error_path_for,
|
@@ -36,6 +37,7 @@ module Zaikio
|
|
36
37
|
|
37
38
|
origin = session[:origin]
|
38
39
|
session.delete(:origin)
|
40
|
+
session.delete(:oauth_attempts)
|
39
41
|
|
40
42
|
session[:zaikio_access_token_id] = access_token.id unless access_token.organization?
|
41
43
|
|
@@ -43,6 +45,13 @@ module Zaikio
|
|
43
45
|
respond_to?(:after_approve_path_for) ? :after_approve_path_for : :default_after_approve_path_for,
|
44
46
|
access_token, origin
|
45
47
|
)
|
48
|
+
rescue OAuth2::Error => e
|
49
|
+
raise e unless e.code == "invalid_grant" || e.code == "invalid_request"
|
50
|
+
raise e if session[:oauth_attempts].to_i >= 3
|
51
|
+
|
52
|
+
session[:oauth_attempts] = session[:oauth_attempts].to_i + 1
|
53
|
+
|
54
|
+
redirect_to new_path(client_name: params[:client_name])
|
46
55
|
end
|
47
56
|
|
48
57
|
def destroy
|
@@ -58,6 +67,10 @@ module Zaikio
|
|
58
67
|
|
59
68
|
private
|
60
69
|
|
70
|
+
def new_path(options = {})
|
71
|
+
zaikio_oauth_client.new_session_path(options)
|
72
|
+
end
|
73
|
+
|
61
74
|
def approve_url(client_name = nil)
|
62
75
|
zaikio_oauth_client.approve_session_url(client_name)
|
63
76
|
end
|
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.17.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zaikio GmbH
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionpack
|
@@ -183,11 +183,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
183
183
|
version: '0'
|
184
184
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
185
185
|
requirements:
|
186
|
-
- - "
|
186
|
+
- - ">="
|
187
187
|
- !ruby/object:Gem::Version
|
188
|
-
version:
|
188
|
+
version: '0'
|
189
189
|
requirements: []
|
190
|
-
rubygems_version: 3.2.
|
190
|
+
rubygems_version: 3.2.22
|
191
191
|
signing_key:
|
192
192
|
specification_version: 4
|
193
193
|
summary: Zaikio Platform Connectivity
|