Sha256: 37219a38b83eac42f8eaa290575e6be87103c467a50e50259afe09aed3029525
Contents?: true
Size: 1.85 KB
Versions: 3
Compression:
Stored size: 1.85 KB
Contents
module Authpds module Session module UrlHandling require "cgi" # URL to redirect to for login. # Preceded by :before_login def login_url(params={}) auth_pds_login_url "load-login", params end # URL to redirect to in the case of establishing a SSO session. def sso_url(params={}) auth_pds_login_url "sso", params end # URL to redirect to after logout. def logout_url(params={}) auth_pds_url "logout", user_session_redirect_url(redirect_logout_url), params end def auth_pds_login_url(func, params) auth_pds_url func, validate_url(params), :institute => insitution_code, :calling_system => calling_system end private :auth_pds_login_url def auth_pds_url(func, url, params) auth_pds_url = "#{pds_url}/pds?func=#{func}" params.each_pair do |key, value| next if key.blank? or value.blank? auth_pds_url << "&#{key}=#{CGI::escape(value)}" end auth_pds_url << "&url=#{CGI::escape(url)}" end private :auth_pds_url def user_session_redirect_url(url) controller.user_session_redirect_url(url) end private :user_session_redirect_url # Returns the URL for validating a UserSession on # return from a remote login system def validate_url(params={}) url = controller.send(validate_url_name, :return_url => user_session_redirect_url(params[:return_url])) return url if params.blank? url << "?" if url.match('\?').blank? params.each do |key, value| next if [:controller, :action, :return_url].include?(key) next if key.blank? or value.blank? url << "&#{calling_system}_#{key}=#{CGI::escape(value)}" end url end private :validate_url end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
authpds-1.1.5 | lib/authpds/session/url_handling.rb |
authpds-1.1.4 | lib/authpds/session/url_handling.rb |
authpds-1.1.3 | lib/authpds/session/url_handling.rb |