forest_liana 6.0.0.pre.beta.3 → 6.0.0.pre.beta.4

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: 3ea2912357a0fabb3b4c6527d848f9b728d2394c83155cd77314e54f66c1d8e2
4
- data.tar.gz: 69863c89f2668cb142f54ddc5a9fcc1c473417cef56fc307765e53a686572bd3
3
+ metadata.gz: 3d299c9968621d0592da4e25c67969073237e6cf0eac69d0d898e6db6027ad14
4
+ data.tar.gz: bbb59dfd951086e62df9829124fcf57ef0b71d40550597abeaff3de07450c946
5
5
  SHA512:
6
- metadata.gz: 11e36ad5a50676182d85029fe634e2874328c537bff2679e5a99661393e5d23c84fa3e30c165c376c06c0e8bc013beffc8d0b2497408276322a0811de8fbf222
7
- data.tar.gz: 3bb4aec7204cced667652ac92f1aef9e4897d282a578408603c2fd98b7b37079565ea39d58ef1d26ee4f62af545c41bd2e56666df4d0335f7b53a455c705f17a
6
+ metadata.gz: 9b3dc3c43d682e085dd95066648471f779bd03da28b935eb645532e04da42ab75651d679291d03118355cba35379655878fa9a3a36a2fb945fbdb1ac35099748
7
+ data.tar.gz: 2bd81a3eb3aa40c9129b1afd5fc86004eb10bbe6115f422537f82ffbeec0d94be77c542f68ed5494688464f1857bee5b691187a95d86a45357ca6d3e07b7c400
@@ -46,7 +46,7 @@ module ForestLiana
46
46
  { 'renderingId' => rendering_id },
47
47
  )
48
48
 
49
- redirect_to(result['authorization_url'])
49
+ render json: { authorizationUrl: result['authorization_url']}, status: 200
50
50
  rescue => error
51
51
  render json: { errors: [{ status: 500, detail: error.message }] },
52
52
  status: :internal_server_error, serializer: nil
@@ -8,11 +8,15 @@ module ForestLiana
8
8
  if client_data.nil?
9
9
  configuration = ForestLiana::OidcConfigurationRetriever.retrieve()
10
10
 
11
- client_credentials = ForestLiana::OidcDynamicClientRegistrator.register({
12
- token_endpoint_auth_method: 'none',
13
- redirect_uris: [callback_url],
14
- registration_endpoint: configuration['registration_endpoint']
15
- })
11
+ if ForestLiana.forest_client_id.nil?
12
+ client_credentials = ForestLiana::OidcDynamicClientRegistrator.register({
13
+ token_endpoint_auth_method: 'none',
14
+ redirect_uris: [callback_url],
15
+ registration_endpoint: configuration['registration_endpoint']
16
+ })
17
+ else
18
+ client_credentials['client_id'] = ForestLiana.forest_client_id
19
+ end
16
20
 
17
21
  client_data = { :client_id => client_credentials['client_id'], :issuer => configuration['issuer'] }
18
22
  Rails.cache.write(callback_url, client_data)
@@ -16,6 +16,7 @@ module ForestLiana
16
16
 
17
17
  mattr_accessor :env_secret
18
18
  mattr_accessor :auth_secret
19
+ mattr_accessor :forest_client_id
19
20
  mattr_accessor :application_url
20
21
  mattr_accessor :integrations
21
22
  mattr_accessor :apimap
@@ -1,3 +1,3 @@
1
1
  module ForestLiana
2
- VERSION = "6.0.0-beta.3"
2
+ VERSION = "6.0.0-beta.4"
3
3
  end
@@ -33,12 +33,13 @@ describe "Authentications", type: :request do
33
33
  }
34
34
  end
35
35
 
36
- it "should respond with a 302 code" do
37
- expect(response).to have_http_status(302)
36
+ it "should respond with a 200 code" do
37
+ expect(response).to have_http_status(200)
38
38
  end
39
39
 
40
40
  it "should return a valid authentication url" do
41
- expect(response.headers['Location']).to eq('https://api.forestadmin.com/oidc/auth?client_id=random_id&redirect_uri=http%3A%2F%2Flocalhost%3A3000%2Fforest%2Fauthentication%2Fcallback&response_type=code&scope=openid%20email%20profile&state=%7B%22renderingId%22%3D%3E42%7D')
41
+ body = JSON.parse(response.body, :symbolize_names => true)
42
+ expect(body[:authorizationUrl]).to eq('https://api.forestadmin.com/oidc/auth?client_id=random_id&redirect_uri=http%3A%2F%2Flocalhost%3A3000%2Fforest%2Fauthentication%2Fcallback&response_type=code&scope=openid%20email%20profile&state=%7B%22renderingId%22%3D%3E42%7D')
42
43
  end
43
44
  end
44
45
 
@@ -119,8 +119,8 @@ module ForestLiana
119
119
  records = getter.records
120
120
  count = getter.count
121
121
 
122
- assert records.count == 1
123
- assert count = 1
122
+ assert records.count == 2
123
+ assert count = 2
124
124
  assert records.first.id == 4
125
125
  assert records.first.name == 'Oak'
126
126
  assert records.first.owner.name == 'Arnaud Besnier'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: forest_liana
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.0.pre.beta.3
4
+ version: 6.0.0.pre.beta.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sandro Munda
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-14 00:00:00.000000000 Z
11
+ date: 2021-01-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails