Module: Reactor::SessionHelper::AuthHelper
- Defined in:
- lib/reactor/session_helper.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
25 26 27 |
# File 'lib/reactor/session_helper.rb', line 25 def self.included(base) base.__send__(:before_filter, :rsession_auth) end |
Instance Method Details
#rsession_auth ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/reactor/session_helper.rb', line 4 def rsession_auth if RailsConnector::Configuration.mode == :editor && (jsessionid = ['JSESSIONID']).present? # Why the gsub? It's a dirty hack! Reason: JSESSIONIDs are unescaped # when read through Rails and hence all + are converted into spaces. # CM Kernel though stores escaped IDs. # From the possible generated characters only the + seems to be # problematic. # CGI.escape would be the solution, but it's deprecated # URI.escape does too much jsessionid.gsub!(' ','+') Rails.logger.info "Trying to log in at #{Reactor::Configuration.xml_access[:host]}:#{Reactor::Configuration.xml_access[:port]} with JSESSIONID=#{jsessionid}." rsession.login(jsessionid) if rsession.user? Rails.logger.info %|Logged in as "#{rsession.user_name}".| end else rsession.destroy end end |