killbill-aviate 1.1.0.pre.4 → 1.1.0.pre.6

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: 2637a800931a97b96e7627862ec03523466f2783aa47dc3802baaa3adf41d0c6
4
- data.tar.gz: 74c7af1583e51fa00d1ac2c6f3dd2f47aafa1f69ee215d61a57ee54e84ef1b24
3
+ metadata.gz: 237b14cde57c3e487b24109830a9fece4b0adacc7258bdaf137fc223837d2ed7
4
+ data.tar.gz: 39131607c8da262ac2f0a9a9c8252e5f6d4ffa7463df8b89976c5ad3d72cede3
5
5
  SHA512:
6
- metadata.gz: f0d80352daf4ea71f30584f8ce56a7386bd49bf3150c7214e8b61ecfbbbb5f5d4fc9d47e5482d63e18271c1fbb74b16737ef2f3601668845dfd365b10c68cb29
7
- data.tar.gz: 7426986c49bce980ebbbf53974a19c2d650577b675b873e4fac0dc612b22c15f865c6695302dccdc307a7367b1019f33f3533e8f5f5483b1b743863b8444b298
6
+ metadata.gz: 4aec8c79ef28c8b01c66e86addec6291948913247665dd40581c3e256aef700ba2fa6fed39712d92105e68508f2ab568f1562cd55ff25b9fc8d8bb01a4f616fb
7
+ data.tar.gz: 6e008e248edac89eb61fd9586357260faa5729bb1b71c5f8834e605e8caf97a0ee511686e55c411ba22869510fa538e3be5f0922b4cac2cb187dc2db3b932450
@@ -1,8 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'aviate/client'
4
+ require 'securerandom'
5
+
4
6
  module Aviate
5
7
  class ConfigurationController < Aviate::EngineController
8
+
6
9
  def index
7
10
  @available = Killbill::Aviate::AviateClient.aviate_plugin_available?(options_for_klient).first
8
11
  end
@@ -12,15 +15,28 @@ module Aviate
12
15
  email = params[:aviate_email]
13
16
  password = params[:aviate_password]
14
17
  response = Killbill::Aviate::AviateClient.authenticate(email, password, cached_options_for_klient)
15
- if response['token']
16
- cookies.encrypted[:jwt_token] = {
17
- value: response['token'],
18
- httponly: true,
19
- secure: Rails.env.production?,
20
- same_site: :strict,
21
- expires: 1.hour.from_now
22
- }
18
+
19
+ if response.is_a?(Hash) && response['token']
20
+ reference_token = SecureRandom.hex(16)
21
+ session[:aviate_token_ref] = reference_token
22
+
23
+ # Store actual JWT in Rails cache using the reference token
24
+ Rails.cache.write("aviate_jwt_#{reference_token}", response['token'], expires_in: 1.hour)
25
+ flash[:notice] = "Successfully authenticated with Aviate"
26
+ else
27
+ flash[:error] = "Authentication failed. Please check your credentials."
28
+ end
29
+
30
+ redirect_to aviate_root_path
31
+ end
32
+
33
+ def session_destroy
34
+ if session[:aviate_token_ref].present?
35
+ jwt_cache_key = "aviate_jwt_#{session[:aviate_token_ref]}"
36
+ Rails.cache.delete(jwt_cache_key)
37
+ session.delete(:aviate_token_ref)
23
38
  end
39
+ flash[:notice] = "Successfully logged out from Aviate"
24
40
  redirect_to aviate_root_path
25
41
  end
26
42
  end
@@ -11,7 +11,13 @@
11
11
  </h5>
12
12
  <% if @available %>
13
13
  <div class="alert alert-success" role="alert">
14
- <%= t('aviate.configuration.authentication_success') %>
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Aviate
4
- VERSION = '1.1.0.pre.4'
4
+ VERSION = '1.1.0.pre.6'
5
5
  end
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
4
+ version: 1.1.0.pre.6
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-15 00:00:00.000000000 Z
11
+ date: 2025-10-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: killbill-assets-ui