Module: Maestrano::Rails::MaestranoSecurity::ControllerFilters

Defined in:
lib/maestrano/rails/controllers/maestrano_security.rb

Instance Method Summary collapse

Instance Method Details

#session_presetObject



30
31
32
33
34
35
36
37
38
39
40
# File 'lib/maestrano/rails/controllers/maestrano_security.rb', line 30

def session_preset
  @session_preset ||= begin
    mno_session = (self.session[:maestrano] || self.session['maestrano'])
    if mno_session
      decrypted_session = JSON.parse(Base64.decode64(mno_session))
      decrypted_session['preset']
    else
      nil
    end
  end
end

#verify_maestrano_sessionObject

If a maestrano session is present then we check its validity. If not valid anymore the filter triggers a Maestrano SSO handshake



19
20
21
22
23
24
25
26
27
28
# File 'lib/maestrano/rails/controllers/maestrano_security.rb', line 19

def verify_maestrano_session
  if Maestrano[session_preset].param(:sso_enabled)
    unless controller_name == 'saml' && ['init','consume'].include?(action_name)
      if !Maestrano::SSO::Session[session_preset].new(session).valid?(if_session:true)
        redirect_to Maestrano::SSO[session_preset].init_url
      end
    end
  end
  true
end