zaikio-oauth_client 0.15.1 → 0.17.2
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 +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 +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 605b297bfe708d26eb51ed1060bf243fc3060fd27df8f4ec481dcf94a471fcc2
|
4
|
+
data.tar.gz: 839bb62b7d00b272978fa3f225bd7416a7c12cf7508e4ab2242183fcb7c8d801
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c7e04798b1ca7338e30005794e2d804a90633816323f678bd2f9a7bcb7f9b8f368e3e68ac38490c44bf48761db785169f41e8f9cf22ce7cdee7b40b82e5ee05
|
7
|
+
data.tar.gz: 189afa394a1a0739d5a4ed60ed4fc667ee8aed698329fb7eb87cc6785bfc88ee610028d9b5fb4ac8ba389c399104e8956c8656ce0a4bbb1132b039f6b1612446
|
@@ -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) # rubocop:disable Performance/StringIdentifierArgument
|
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.2
|
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
|