Skip to content
This repository was archived by the owner on Feb 6, 2024. It is now read-only.
Open
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
2 changes: 1 addition & 1 deletion app/helpers/casino/sessions_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def sign_in(authentication_result, options = {})
end

def set_tgt_cookie(tgt)
cookies[:tgt] = { value: tgt.ticket }.tap do |cookie|
cookies[:tgt] = { value: tgt.ticket, httponly: true}.tap do |cookie|
if tgt.long_term?
cookie[:expires] = CASino.config.ticket_granting_ticket[:lifetime_long_term].seconds.from_now
end
Expand Down
6 changes: 6 additions & 0 deletions spec/controllers/sessions_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,12 @@
ticket_granting_ticket.reload.should_not be_awaiting_two_factor_authentication
end

it 'creates an httponly cookie' do
controller.stub(:cookies).and_return(HashWithIndifferentAccess.new)
post :validate_otp, request_options
controller.cookies['tgt']['httponly'].should be(true)
end

context 'with a long-term ticket-granting ticket' do
let(:cookie_jar) { HashWithIndifferentAccess.new }

Expand Down