killbill-aviate 1.1.0.pre.4 → 1.1.0.pre.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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f80c0ac4a5aebd20024637e6db468fc097cfc2446a9fdd9dc7410a918263039d
|
|
4
|
+
data.tar.gz: 62371a45706e77cf5c34fe8dad425a33f62b08900d4f63fb6706a45e67c33a9b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f0b39b235144075c36ace2437d197febc254fe2e7fcd0904bae8ae54bfe00d43b04acb63e191c4f813e557ed507048430842c43c9c26711cfedd83f7ff1afcb0
|
|
7
|
+
data.tar.gz: 1a8b182ad6efd8d377c9e731c42d68bad7dfe8e6b8f74fe75b5c805aa6ab8d9ed33e8fd6203e2d52d56e2d8517c14e768bd3bf6b7c93b9ef6df7022463022d5f
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
require 'aviate/client'
|
|
4
4
|
module Aviate
|
|
5
5
|
class ConfigurationController < Aviate::EngineController
|
|
6
|
+
before_action :cleanup_expired_jwt
|
|
7
|
+
|
|
6
8
|
def index
|
|
7
9
|
@available = Killbill::Aviate::AviateClient.aviate_plugin_available?(options_for_klient).first
|
|
8
10
|
end
|
|
@@ -12,16 +14,33 @@ module Aviate
|
|
|
12
14
|
email = params[:aviate_email]
|
|
13
15
|
password = params[:aviate_password]
|
|
14
16
|
response = Killbill::Aviate::AviateClient.authenticate(email, password, cached_options_for_klient)
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
|
|
18
|
+
if response.is_a?(Hash) && response['token']
|
|
19
|
+
# Store JWT in server-side session instead of cookies to avoid header size limits
|
|
20
|
+
session[:aviate_jwt_token] = response['token']
|
|
21
|
+
session[:aviate_jwt_expires_at] = 1.hour.from_now.to_i
|
|
22
|
+
flash[:notice] = "Successfully authenticated with Aviate"
|
|
23
|
+
else
|
|
24
|
+
flash[:error] = "Authentication failed. Please check your credentials."
|
|
23
25
|
end
|
|
26
|
+
|
|
24
27
|
redirect_to aviate_root_path
|
|
25
28
|
end
|
|
29
|
+
|
|
30
|
+
def session_destroy
|
|
31
|
+
session.delete(:aviate_jwt_token)
|
|
32
|
+
session.delete(:aviate_jwt_expires_at)
|
|
33
|
+
flash[:notice] = "Successfully logged out from Aviate"
|
|
34
|
+
redirect_to aviate_root_path
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
private
|
|
38
|
+
|
|
39
|
+
def cleanup_expired_jwt
|
|
40
|
+
if session[:aviate_jwt_expires_at] && session[:aviate_jwt_expires_at] < Time.current.to_i
|
|
41
|
+
session.delete(:aviate_jwt_token)
|
|
42
|
+
session.delete(:aviate_jwt_expires_at)
|
|
43
|
+
end
|
|
44
|
+
end
|
|
26
45
|
end
|
|
27
46
|
end
|
|
@@ -11,7 +11,13 @@
|
|
|
11
11
|
</h5>
|
|
12
12
|
<% if @available %>
|
|
13
13
|
<div class="alert alert-success" role="alert">
|
|
14
|
-
|
|
14
|
+
<%= t('aviate.configuration.authentication_success') %>
|
|
15
|
+
</div>
|
|
16
|
+
<div class="d-flex justify-content-end">
|
|
17
|
+
<%= link_to "Logout", aviate_session_destroy_path,
|
|
18
|
+
method: :delete,
|
|
19
|
+
class: "btn btn-outline-secondary",
|
|
20
|
+
confirm: "Are you sure you want to logout from Aviate?" %>
|
|
15
21
|
</div>
|
|
16
22
|
<% else %>
|
|
17
23
|
<div class="configuration-form">
|
data/config/routes.rb
CHANGED
|
@@ -5,6 +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
9
|
end
|
|
9
10
|
|
|
10
11
|
resources :accounts, param: :account_id do
|
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.5
|
|
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-10-
|
|
11
|
+
date: 2025-10-16 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: killbill-assets-ui
|