killbill-aviate 1.1.0.pre.8 → 1.1.0.pre.9
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/aviate/configuration_controller.rb +14 -11
- data/app/controllers/aviate/engine_controller.rb +14 -0
- data/app/views/aviate/configuration/index.html.erb +6 -3
- data/app/views/aviate/wallets/_form.html.erb +0 -2
- data/config/routes.rb +1 -1
- data/lib/aviate/client.rb +4 -2
- data/lib/aviate/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: ea3985ee1127fe9cbbc0a1896232e62c30141e42d473124a6e7e90a14fc00e95
|
|
4
|
+
data.tar.gz: ed28ef7bfc826edfaa466507a8420e881643d80c8a87b300d77c9245271f836c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 11f19b4f4d638a8ab19a2bdf37a047d3c5e0ad6f961bf3bcf820cde4b659e1602cd128c4d0783a35ffea9d8b743bdd64f530ea1f4d01c5850ca585f7bcd166bb
|
|
7
|
+
data.tar.gz: bdb605b58476704ab73016eb59588f880376a97803b56ad8c0379e029c74bd87b9d5895ce6321e20445a57271d53f190b231bea92d2811b10abe7a1be3783d02
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require 'aviate/client'
|
|
4
|
-
require 'securerandom'
|
|
5
4
|
|
|
6
5
|
module Aviate
|
|
7
6
|
class ConfigurationController < Aviate::EngineController
|
|
@@ -16,11 +15,14 @@ module Aviate
|
|
|
16
15
|
response = Killbill::Aviate::AviateClient.authenticate(email, password, cached_options_for_klient)
|
|
17
16
|
|
|
18
17
|
if response.is_a?(Hash) && response['token']
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
# Store JWT in encrypted cookie
|
|
19
|
+
cookies.encrypted[:jwt_token] = {
|
|
20
|
+
value: response['token'],
|
|
21
|
+
httponly: true,
|
|
22
|
+
secure: Rails.env.production?,
|
|
23
|
+
same_site: :strict,
|
|
24
|
+
expires: 1.hour.from_now
|
|
25
|
+
}
|
|
24
26
|
flash[:notice] = t('aviate.configuration.authentication_success')
|
|
25
27
|
else
|
|
26
28
|
flash[:error] = t('aviate.configuration.authentication_failed')
|
|
@@ -30,11 +32,12 @@ module Aviate
|
|
|
30
32
|
end
|
|
31
33
|
|
|
32
34
|
def session_destroy
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
# Delete JWT cookie
|
|
36
|
+
cookies.delete(:jwt_token)
|
|
37
|
+
|
|
38
|
+
# Clean up any existing session references
|
|
39
|
+
session.delete(:aviate_token_ref)
|
|
40
|
+
|
|
38
41
|
flash[:notice] = t('aviate.configuration.logout_success')
|
|
39
42
|
redirect_to aviate_root_path
|
|
40
43
|
end
|
|
@@ -63,5 +63,19 @@ module Aviate
|
|
|
63
63
|
flash[:error] = t('flashes.errors.wallet_authentication_failed')
|
|
64
64
|
redirect_to aviate_engine.aviate_root_path
|
|
65
65
|
end
|
|
66
|
+
|
|
67
|
+
private
|
|
68
|
+
|
|
69
|
+
def options_for_klient
|
|
70
|
+
# Get the base options from parent class
|
|
71
|
+
base_options = super
|
|
72
|
+
|
|
73
|
+
# Add JWT token from cookies if available
|
|
74
|
+
if cookies.encrypted[:jwt_token].present?
|
|
75
|
+
base_options.merge(jwt_token: cookies.encrypted[:jwt_token])
|
|
76
|
+
else
|
|
77
|
+
base_options
|
|
78
|
+
end
|
|
79
|
+
end
|
|
66
80
|
end
|
|
67
81
|
end
|
|
@@ -15,9 +15,12 @@
|
|
|
15
15
|
</div>
|
|
16
16
|
<div class="d-flex justify-content-end">
|
|
17
17
|
<%= link_to "Logout", aviate_session_destroy_path,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
class: "btn btn-outline-secondary",
|
|
19
|
+
data: {
|
|
20
|
+
turbo_method: :delete,
|
|
21
|
+
turbo_confirm: "Are you sure you want to logout from Aviate?"
|
|
22
|
+
}
|
|
23
|
+
%>
|
|
21
24
|
</div>
|
|
22
25
|
<% else %>
|
|
23
26
|
<div class="configuration-form">
|
data/config/routes.rb
CHANGED
|
@@ -5,7 +5,7 @@ Aviate::Engine.routes.draw do
|
|
|
5
5
|
|
|
6
6
|
scope '/configuration' do
|
|
7
7
|
match '/session_create' => 'configuration#session_create', :via => :post, :as => 'aviate_session_create'
|
|
8
|
-
match '/session_destroy' => 'configuration#session_destroy', :via => :delete, :as => 'aviate_session_destroy'
|
|
8
|
+
match '/session_destroy' => 'configuration#session_destroy', :via => [:get, :delete], :as => 'aviate_session_destroy'
|
|
9
9
|
end
|
|
10
10
|
|
|
11
11
|
resources :accounts, param: :account_id do
|
data/lib/aviate/client.rb
CHANGED
|
@@ -90,8 +90,8 @@ module Killbill
|
|
|
90
90
|
http.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
|
91
91
|
request = Net::HTTP::Post.new(uri.path)
|
|
92
92
|
request['Content-Type'] = 'application/json'
|
|
93
|
-
request['X-Killbill-ApiKey'] = options
|
|
94
|
-
request['X-Killbill-ApiSecret'] = options
|
|
93
|
+
request['X-Killbill-ApiKey'] = options&.dig(:api_key)
|
|
94
|
+
request['X-Killbill-ApiSecret'] = options&.dig(:api_secret)
|
|
95
95
|
request['Authorization'] = "Basic #{auth}"
|
|
96
96
|
request.body = {}.to_json
|
|
97
97
|
response = http.request(request)
|
|
@@ -103,6 +103,8 @@ module Killbill
|
|
|
103
103
|
private
|
|
104
104
|
|
|
105
105
|
def build_request_options(options)
|
|
106
|
+
return {} if options.nil?
|
|
107
|
+
|
|
106
108
|
request_options = {
|
|
107
109
|
api_key: options[:api_key],
|
|
108
110
|
api_secret: options[:api_secret]
|
data/lib/aviate/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: killbill-aviate
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.1.0.pre.
|
|
4
|
+
version: 1.1.0.pre.9
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Kill Bill core team
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2025-11-
|
|
11
|
+
date: 2025-11-10 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: killbill-assets-ui
|