omniauth-sberbusiness 1.0.4 → 1.0.5

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: fc6a24d6b570f4a4ee525fca24fb894a5a3bd732be93b89b15d21c01c8442e3c
4
- data.tar.gz: 3557c296ec5f0b6b7fb08866f84565e5664bac34244bc77306f32fa41c71292a
3
+ metadata.gz: ba7fa11ea9bd25f870de1fe86b3b2be85ebb8bacbba832ca69bc37de2900fd63
4
+ data.tar.gz: c3d1e32dd2eaa7500d85fd5a615a06232b3298c109fa3655311e1846cf01fa15
5
5
  SHA512:
6
- metadata.gz: b720db90f54c0ef88124077f3681a0de7430ebe591a9429fb3bbf930ad2410014069d0968dd908885b8313cdbf456775425468ca08f9c20dc67403e20493a882
7
- data.tar.gz: e9baea1e868b23932099630ae310af10ed9b197498b77aab832941974715e50a3135d717212576b70f3336c5b519d2af5f95a996435e5421900e93eb5dbe24a3
6
+ metadata.gz: f74419d268a369102133a3029bf3316332c67cdc3d6615c81d9594c6e0b727b88a7808266986e48015c5110b358638435170a0f2e96258335f80022379a0ac1e
7
+ data.tar.gz: dc509a2030e560af04bb05188ae9f5d47464e541c315f7e150871b7cfff4ce6fedf3ccb4bed083038ac19a7e610bc4e591b6a8a59620927cb1c37eae42e83545
@@ -2,6 +2,6 @@
2
2
 
3
3
  module OmniAuth
4
4
  module Sberbusiness
5
- VERSION = '1.0.4'
5
+ VERSION = '1.0.5'
6
6
  end
7
7
  end
@@ -3,6 +3,7 @@
3
3
  require 'omniauth/strategies/oauth2'
4
4
  require 'securerandom'
5
5
  require 'base64'
6
+ require 'pry'
6
7
 
7
8
  module OmniAuth
8
9
  module Strategies
@@ -31,6 +32,11 @@ module OmniAuth
31
32
 
32
33
  uid { raw_info['sub'].to_s }
33
34
 
35
+ def client
36
+ change_links if options.test
37
+ super
38
+ end
39
+
34
40
  # https://github.com/intridea/omniauth/wiki/Auth-Hash-Schema
35
41
  info do
36
42
  {
@@ -72,7 +78,7 @@ module OmniAuth
72
78
  return result unless options.test
73
79
 
74
80
  org_info = access_token.get(options.client_options['client_info_path'], headers: info_headers).body
75
- result.merge({ client_info: org_info.force_encoding('UTF-8') })
81
+ result.merge(client_info: org_info.force_encoding('UTF-8'))
76
82
  end
77
83
  end
78
84
 
@@ -81,6 +87,9 @@ module OmniAuth
81
87
  end
82
88
 
83
89
  def authorize_params
90
+ # add links in options
91
+ change_links if options.test
92
+
84
93
  super.tap do |params|
85
94
  %w[state scope response_type client_type client_id nonce].each do |v|
86
95
  next unless request.params[v]
@@ -103,6 +112,19 @@ module OmniAuth
103
112
  }
104
113
  end
105
114
 
115
+ def change_links
116
+ options.client_options[:site] = options.client_options[:test_site] ||
117
+ 'https://edupirfintech.sberbank.ru:9443'
118
+ options.client_options[:token_url] = options.client_options[:test_token_url] ||
119
+ 'https://edupirfintech.sberbank.ru:9443/ic/sso/api/v1/oauth/token'
120
+ options.client_options[:authorize_url] = options.client_options[:test_authorize_url] ||
121
+ 'https://edupir.testsbi.sberbank.ru:9443/ic/sso/api/v1/oauth/authorize'
122
+ options.client_options[:user_info_path] = options.client_options[:test_user_info_path] ||
123
+ '/ic/sso/api/v1/oauth/user-info'
124
+ options.client_options[:client_info_path] = options.client_options[:test_client_info_path] ||
125
+ '/fintech/api/v1/client-info'
126
+ end
127
+
106
128
  def callback_url
107
129
  options.redirect_url || (full_host + script_name + callback_path)
108
130
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-sberbusiness
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergei Baksheev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-07-30 00:00:00.000000000 Z
11
+ date: 2021-08-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: omniauth-oauth2