Module: Gatekeeper::Helpers::Rack
- Defined in:
- lib/gatekeeper/helpers/rack.rb
Instance Method Summary collapse
- #absolute_url(suffix = nil) ⇒ Object
- #excluded_path? ⇒ Boolean
- #sso_logged_in? ⇒ Boolean
- #sso_login_as(user_id, sreg_params) ⇒ Object
- #sso_user_email ⇒ Object
- #sso_user_id ⇒ Object
Instance Method Details
#absolute_url(suffix = nil) ⇒ Object
26 27 28 29 30 31 32 33 34 |
# File 'lib/gatekeeper/helpers/rack.rb', line 26 def absolute_url(suffix = nil) port_part = case request.scheme when "http" request.port == 80 ? "" : ":#{request.port}" when "https" request.port == 443 ? "" : ":#{request.port}" end "#{request.scheme}://#{request.host}#{port_part}#{suffix}" end |
#excluded_path? ⇒ Boolean
36 37 38 |
# File 'lib/gatekeeper/helpers/rack.rb', line 36 def excluded_path? .exclude_paths && .exclude_paths.include?(request.path_info) end |
#sso_logged_in? ⇒ Boolean
4 5 6 |
# File 'lib/gatekeeper/helpers/rack.rb', line 4 def sso_logged_in? session[:sso] && sso_user_id end |
#sso_login_as(user_id, sreg_params) ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/gatekeeper/helpers/rack.rb', line 8 def sso_login_as(user_id, sreg_params) session.delete(:last_oidreq) session.delete('OpenID::Consumer::last_requested_endpoint') session.delete('OpenID::Consumer::DiscoveredServices::OpenID::Consumer::') session[:sso] ||= { } session[:sso][:user_id] = user_id sreg_params.each { |key, value| session[:sso][key.to_sym] = value.to_s } end |
#sso_user_email ⇒ Object
22 23 24 |
# File 'lib/gatekeeper/helpers/rack.rb', line 22 def sso_user_email session[:sso][:email] end |
#sso_user_id ⇒ Object
18 19 20 |
# File 'lib/gatekeeper/helpers/rack.rb', line 18 def sso_user_id session[:sso][:user_id] end |