Skip to content

Commit

Permalink
Merge pull request #15 from mdsol/develop
Browse files Browse the repository at this point in the history
Develop into Master
  • Loading branch information
sakhtermdsol committed Oct 26, 2015
2 parents ed40809 + 6ed32b7 commit c74e686
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.3.9.2
2.3.9.3
12 changes: 10 additions & 2 deletions lib/casclient/frameworks/rails/filter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class Filter
@@log = nil
@@fake_user = nil
@@fake_extra_attributes = nil
DEFAULT_TIMEOUT = 30.minutes

class << self
def filter(controller)
Expand Down Expand Up @@ -72,7 +73,6 @@ def filter(controller)
# so we need to set this here to ensure compatibility with configurations
# built around the old client.
controller.session[:casfilteruser] = st.user

if config[:enable_single_sign_out]
client.ticket_store.store_service_session_lookup(st, controller)
end
Expand Down Expand Up @@ -269,7 +269,15 @@ def redirect_to_cas_for_authentication(controller)
log.debug("Redirecting to #{redirect_url.inspect}")
controller.send(:redirect_to, redirect_url)
end


def auto_session_timeout(controller)
if controller.session[client.extra_attributes_session_key]
(controller.session[client.extra_attributes_session_key][:timeout] || DEFAULT_TIMEOUT).to_i
else
DEFAULT_TIMEOUT
end
end

private
def single_sign_out(controller)

Expand Down
9 changes: 9 additions & 0 deletions spec/casclient/frameworks/rails/filter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -173,4 +173,13 @@
end
end
end

context 'controller request auto session timeout' do
subject { Hash.new }
it 'should return a timeout value' do
subject[:cas_extra_attributes] = { timeout: '1800' }
controller = mock_controller_with_session(nil, subject)
CASClient::Frameworks::Rails::Filter.auto_session_timeout(controller).should eq(1800)
end
end
end

0 comments on commit c74e686

Please sign in to comment.