From d5ea7c0ac34099aaade111e407fb2c78e3bbab8b Mon Sep 17 00:00:00 2001 From: Dyson Simmons Date: Thu, 5 Jan 2012 13:48:28 +1100 Subject: [PATCH 1/8] Destination in server.rb logout now set and used correctly. --- lib/casserver/server.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/casserver/server.rb b/lib/casserver/server.rb index 12d1f756..5053fa50 100644 --- a/lib/casserver/server.rb +++ b/lib/casserver/server.rb @@ -516,7 +516,8 @@ def self.init_database! # "logout" page, we take the user back to the login page with a "you have been logged out" # message, allowing for an opportunity to immediately log back in. This makes it # easier for the user to log out and log in as someone else. - @service = clean_service_url(params['service'] || params['destination']) + @service = clean_service_url(params['service'] + @destination = params['destination']) @continue_url = params['url'] @gateway = params['gateway'] == 'true' || params['gateway'] == '1' @@ -559,8 +560,8 @@ def self.init_database! @lt = generate_login_ticket - if @gateway && @service - redirect @service, 303 + if @gateway && @destination + redirect @destination, 303 elsif @continue_url render @template_engine, :logout else From 8e50a1abbb9f1df44ee77fa93cdf851e3d09d723 Mon Sep 17 00:00:00 2001 From: Dyson Simmons Date: Mon, 9 Jan 2012 17:49:16 +1100 Subject: [PATCH 2/8] Added gateway service redirect and changed logout template. --- lib/casserver/server.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/casserver/server.rb b/lib/casserver/server.rb index 5053fa50..9777ea82 100644 --- a/lib/casserver/server.rb +++ b/lib/casserver/server.rb @@ -562,8 +562,10 @@ def self.init_database! if @gateway && @destination redirect @destination, 303 + elsif @gateway && @destination + redirect @destination, 303 elsif @continue_url - render @template_engine, :logout + render @template_engine, :login else render @template_engine, :login end From 1a0b306349683b8e98de33840b5faccdedc3df55 Mon Sep 17 00:00:00 2001 From: Dyson Simmons Date: Wed, 11 Jan 2012 12:57:59 +1100 Subject: [PATCH 3/8] Fixed syntax. --- lib/casserver/server.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/casserver/server.rb b/lib/casserver/server.rb index 9777ea82..3ca335cf 100644 --- a/lib/casserver/server.rb +++ b/lib/casserver/server.rb @@ -516,7 +516,7 @@ def self.init_database! # "logout" page, we take the user back to the login page with a "you have been logged out" # message, allowing for an opportunity to immediately log back in. This makes it # easier for the user to log out and log in as someone else. - @service = clean_service_url(params['service'] + @service = clean_service_url(params['service']) @destination = params['destination']) @continue_url = params['url'] From bc9c7b58fedf5e6179574c96b18f5b06c861caf5 Mon Sep 17 00:00:00 2001 From: Dyson Simmons Date: Wed, 11 Jan 2012 13:04:17 +1100 Subject: [PATCH 4/8] Fixed syntax again. --- lib/casserver/server.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/casserver/server.rb b/lib/casserver/server.rb index 3ca335cf..8d7d9d39 100644 --- a/lib/casserver/server.rb +++ b/lib/casserver/server.rb @@ -517,7 +517,7 @@ def self.init_database! # message, allowing for an opportunity to immediately log back in. This makes it # easier for the user to log out and log in as someone else. @service = clean_service_url(params['service']) - @destination = params['destination']) + @destination = params['destination'] @continue_url = params['url'] @gateway = params['gateway'] == 'true' || params['gateway'] == '1' From 4e20749f53b079f36fdd75dc3e1aeb7fe495e427 Mon Sep 17 00:00:00 2001 From: Dyson Simmons Date: Mon, 16 Jan 2012 10:32:55 +1100 Subject: [PATCH 5/8] Added default service to config. --- lib/casserver/server.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/casserver/server.rb b/lib/casserver/server.rb index 8d7d9d39..b9f49f66 100644 --- a/lib/casserver/server.rb +++ b/lib/casserver/server.rb @@ -310,7 +310,7 @@ def self.init_database! headers['Expires'] = (Time.now - 1.year).rfc2822 # optional params - @service = clean_service_url(params['service']) + @service = clean_service_url(params['service']) || settings.config[:default_service] @renew = params['renew'] @gateway = params['gateway'] == 'true' || params['gateway'] == '1' From 901e937c20b246f41e13622e4188cdc0b76ad492 Mon Sep 17 00:00:00 2001 From: Dyson Simmons Date: Wed, 18 Jan 2012 11:37:34 +1100 Subject: [PATCH 6/8] Added default service to login post request. --- lib/casserver/server.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/casserver/server.rb b/lib/casserver/server.rb index b9f49f66..de060e03 100644 --- a/lib/casserver/server.rb +++ b/lib/casserver/server.rb @@ -400,7 +400,7 @@ def self.init_database! Utils::log_controller_action(self.class, params) # 2.2.1 (optional) - @service = clean_service_url(params['service']) + @service = clean_service_url(params['service']) || settings.config[:default_service] # 2.2.2 (required) @username = params['username'] From 37c14b682fbf7f7ce16c48babc67378690e95746 Mon Sep 17 00:00:00 2001 From: Dyson Simmons Date: Wed, 22 Feb 2012 20:55:20 +1100 Subject: [PATCH 7/8] Updated logout destination logic. --- lib/casserver/server.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/casserver/server.rb b/lib/casserver/server.rb index de060e03..9a70bf98 100644 --- a/lib/casserver/server.rb +++ b/lib/casserver/server.rb @@ -562,8 +562,8 @@ def self.init_database! if @gateway && @destination redirect @destination, 303 - elsif @gateway && @destination - redirect @destination, 303 + elsif @gateway && @service + redirect @service, 303 elsif @continue_url render @template_engine, :login else From a0cea4a794ad5a4ebafce1f8e1783fe563bdf860 Mon Sep 17 00:00:00 2001 From: Dyson Simmons Date: Mon, 5 Mar 2012 14:12:46 +1100 Subject: [PATCH 8/8] Updated exmaple config to include default service. --- config/config.example.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/config/config.example.yml b/config/config.example.yml index 47a17c4f..92180620 100644 --- a/config/config.example.yml +++ b/config/config.example.yml @@ -562,6 +562,15 @@ log: #enable_single_sign_out: true +##### SERVICES ################################################################# + +# The default service is used when no service is passed in the request + +# This is not part of the CAS specification. If no defualt service is set, and +# no service is passed in the request, behaviour is per the CAS specification. + +#default_service: 'https://au.edu.burnet.launchpad.dev/people/service' + ##### OTHER #################################################################### # You can set various ticket expiry times (specify the value in seconds).