Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions app/controllers/concerns/remember_device_concern.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def save_remember_device_preference(remember_device_preference)
return if remember_device_preference != '1' && remember_device_preference != 'true'
cookies.encrypted[:remember_device] = {
value: RememberDeviceCookie.new(user_id: current_user.id, created_at: Time.zone.now).to_json,
expires: remember_device_cookie_expiration,
expires: IdentityConfig.store.remember_device_expiration_hours_aal_1.hours.from_now,
}
end

Expand Down Expand Up @@ -83,12 +83,4 @@ def handle_valid_remember_device_analytics(cookie_created_at:)
cookie_age_seconds: (Time.zone.now - cookie_created_at).to_i,
)
end

def remember_device_cookie_expiration
if IdentityConfig.store.set_remember_device_session_expiration
nil
else
IdentityConfig.store.remember_device_expiration_hours_aal_1.hours.from_now
end
end
end
1 change: 0 additions & 1 deletion config/application.yml.default
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,6 @@ session_timeout_in_minutes: 15
session_timeout_warning_seconds: 150
session_total_duration_timeout_in_minutes: 720
ses_configuration_set_name: ''
set_remember_device_session_expiration: false
sp_handoff_bounce_max_seconds: 2
show_unsupported_passkey_platform_authentication_setup: false
show_user_attribute_deprecation_warnings: false
Expand Down
1 change: 0 additions & 1 deletion lib/identity_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,6 @@ def self.build_store(config_map)
config.add(:session_timeout_in_minutes, type: :integer)
config.add(:session_timeout_warning_seconds, type: :integer)
config.add(:session_total_duration_timeout_in_minutes, type: :integer)
config.add(:set_remember_device_session_expiration, type: :boolean)
config.add(:show_unsupported_passkey_platform_authentication_setup, type: :boolean)
config.add(:show_user_attribute_deprecation_warnings, type: :boolean)
config.add(:skip_encryption_allowed_list, type: :json)
Expand Down
32 changes: 5 additions & 27 deletions spec/features/remember_device/cookie_expiration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,12 @@

let(:user) { user_with_2fa }

context 'with feature flag set' do
before do
allow(IdentityConfig.store).to receive(:set_remember_device_session_expiration).
and_return(true)
end

it 'expires the remember device cookie' do
sign_in_user_with_remember_device
expire_cookies
sign_in_user(user)

expect(current_url).to match(%r{/login/two_factor/})
end
end

context 'with feature flag unset' do
before do
allow(IdentityConfig.store).to receive(:set_remember_device_session_expiration).
and_return(false)
end

it 'does not expire the remember device cookie' do
sign_in_user_with_remember_device
expire_cookies
sign_in_user(user)
it 'does not expire the remember device cookie' do
sign_in_user_with_remember_device
expire_cookies
sign_in_user(user)

expect(current_url).to match(%r{/account})
end
expect(current_url).to match(%r{/account})
end

def sign_in_user_with_remember_device
Expand Down