Skip to content

Commit aa2a33e

Browse files
committed
Fix issue with header too large
1 parent 96e301b commit aa2a33e

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

app/controllers/kaui/engine_controller.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,12 @@ class Kaui::EngineController < ApplicationController
1212
# Common options for the Kill Bill client
1313
def options_for_klient(options = {})
1414
user_tenant_options = Kaui.current_tenant_user_options(current_user, session)
15-
user_tenant_options.merge(options)
15+
user_tenant_options.merge!(options)
1616
# Pass the X-Request-Id seen by Rails to Kill Bill
1717
# Note that this means that subsequent requests issued by a single action will share the same X-Request-Id in Kill Bill
1818
user_tenant_options[:request_id] ||= request.request_id
19-
user_tenant_options[:jwt_token] ||= session[:jwt_token]
19+
# Use session storage for JWT tokens instead of cookies to avoid header size limits
20+
user_tenant_options[:jwt_token] = session[:aviate_jwt_token]
2021
user_tenant_options
2122
end
2223

app/controllers/kaui/sessions_controller.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ def after_sign_in_path_for(_resource)
2828
end
2929

3030
def after_sign_out_path_for(_resource)
31+
cookies.delete(:jwt_token)
3132
kaui_path
3233
end
3334

lib/kaui.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,6 @@ def self.current_tenant_user_options(user, session)
297297
password: user.password,
298298
session_id: user.kb_session_id
299299
}
300-
result[:jwt_token] = session[:jwt_token] if session[:jwt_token]
301300
if user_tenant
302301
result[:api_key] = user_tenant.api_key
303302
result[:api_secret] = user_tenant.api_secret

0 commit comments

Comments
 (0)