zaikio-oauth_client 0.16.0 → 0.17.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: 959893e57238209160b6945a5044bbc82bdc862fb78cd69ba606356e376978a7
4
- data.tar.gz: b73e404116786a133e3438a12ebdfc87548da89c3a581a66436a6d2c0ef63ebd
3
+ metadata.gz: 6a2ab7697b4dc9fc67d8558ae29f3ccff27c56c408c1c900e2331ab027c11bf7
4
+ data.tar.gz: b2a2d6424454e99e57a43cbad9762506d13ffd5709e7ca1dee8f1c2c96d7631b
5
5
  SHA512:
6
- metadata.gz: 71c7597c63d0aa761754fae087a6dcbbca1c1ebcae034330d08bbcdf7dd837874901c5b343435005b97b033220609255903cbc0aae796ad7b88192c4d150fe36
7
- data.tar.gz: 38f0f062bebf746c5e23341524d9bcf4b3b31f9a70c972b5afa7ded4f72c6ec5ec5d1d694e8515412e9118359f8f8ee6bcdc493c28e55b5716d1c7261371dc06
6
+ metadata.gz: 8dc646a77bc4c31ee4ec0affc44017ebf7dc27cdfbd9c950e2fa6f542c030c82ee3be913f50474cc10f714e3c88132bcd601963170c3a02da05e677e8c2f23f1
7
+ data.tar.gz: 8b120868bccadf82c34a47e9eba11cfd0c3924a5db89c6463264cb1cc7ccbab7bcdad38d6a56138dfbfa334f9807fb200c470ebba7baa223a87d39b0e3cb212f
@@ -5,6 +5,10 @@ module Zaikio
5
5
 
6
6
  private
7
7
 
8
+ def new_path(options = {})
9
+ zaikio_oauth_client.new_connection_path(options)
10
+ end
11
+
8
12
  def approve_url(client_name = nil)
9
13
  zaikio_oauth_client.approve_connection_url(client_name)
10
14
  end
@@ -17,7 +17,7 @@ module Zaikio
17
17
  )
18
18
  end
19
19
 
20
- def approve # rubocop:disable Metrics/MethodLength,Metrics/AbcSize
20
+ def approve # rubocop:disable Metrics/MethodLength,Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
21
21
  if params[:error].present?
22
22
  redirect_to send(
23
23
  respond_to?(:error_path_for) ? :error_path_for : :default_error_path_for,
@@ -37,6 +37,7 @@ module Zaikio
37
37
 
38
38
  origin = session[:origin]
39
39
  session.delete(:origin)
40
+ session.delete(:oauth_attempts)
40
41
 
41
42
  session[:zaikio_access_token_id] = access_token.id unless access_token.organization?
42
43
 
@@ -44,6 +45,13 @@ module Zaikio
44
45
  respond_to?(:after_approve_path_for) ? :after_approve_path_for : :default_after_approve_path_for,
45
46
  access_token, origin
46
47
  )
48
+ rescue OAuth2::Error => e
49
+ raise e unless e.code == "invalid_grant"
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])
47
55
  end
48
56
 
49
57
  def destroy
@@ -59,6 +67,10 @@ module Zaikio
59
67
 
60
68
  private
61
69
 
70
+ def new_path(options = {})
71
+ zaikio_oauth_client.new_session_path(options)
72
+ end
73
+
62
74
  def approve_url(client_name = nil)
63
75
  zaikio_oauth_client.approve_session_url(client_name)
64
76
  end
@@ -1,5 +1,5 @@
1
1
  module Zaikio
2
2
  module OAuthClient
3
- VERSION = "0.16.0".freeze
3
+ VERSION = "0.17.0".freeze
4
4
  end
5
5
  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.16.0
4
+ version: 0.17.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: 2021-08-25 00:00:00.000000000 Z
11
+ date: 2021-09-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack