Sha256: d106da16c176cd00dc18979e42ce7b4f6041d7b5df15d48ec310ecc6510e56c6

Contents?: true

Size: 1.19 KB

Versions: 15

Compression:

Stored size: 1.19 KB

Contents

class Maestrano::Auth::SamlController < Maestrano::Rails::SamlBaseController
  def init
    session[:settings] = !!params[:settings]
    super
  end

  #== POST '/maestrano/auth/saml/consume'
  # Final phase of the Single Sign-On handshake. Find or create
  # the required resources (user and group) and sign the user
  # in
  def consume
    params[:tenant] ||= 'default'
    user = Maestrano::Connector::Rails::User.find_or_create_for_maestrano(user_auth_hash, params[:tenant])
    organization = Maestrano::Connector::Rails::Organization.find_or_create_for_maestrano(group_auth_hash, params[:tenant])
    if user && organization
      organization.add_member(user) unless organization.member?(user)

      session[:tenant] = params[:tenant]
      session[:uid] = user.uid
      session[:org_uid] = organization.uid
      session[:"role_#{organization.uid}"] = user_group_rel_hash[:role]
    end

    if session[:settings]
      session.delete(:settings)
      redirect_to main_app.root_path
    elsif current_organization && current_organization.oauth_uid && current_organization.sync_enabled
      redirect_to main_app.home_redirect_to_external_path
    else
      redirect_to main_app.root_path
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
maestrano-connector-rails-2.0.0.pre.RC6 app/controllers/maestrano/auth/saml_controller.rb
maestrano-connector-rails-2.0.0.pre.RC5 app/controllers/maestrano/auth/saml_controller.rb
maestrano-connector-rails-2.0.0.pre.RC4 app/controllers/maestrano/auth/saml_controller.rb
maestrano-connector-rails-2.0.0.pre.RC3 app/controllers/maestrano/auth/saml_controller.rb
maestrano-connector-rails-2.0.0.pre.RC2 app/controllers/maestrano/auth/saml_controller.rb
maestrano-connector-rails-2.0.0.pre.RC1 app/controllers/maestrano/auth/saml_controller.rb
maestrano-connector-rails-1.4.0 app/controllers/maestrano/auth/saml_controller.rb
maestrano-connector-rails-1.3.5 app/controllers/maestrano/auth/saml_controller.rb
maestrano-connector-rails-1.3.4 app/controllers/maestrano/auth/saml_controller.rb
maestrano-connector-rails-1.3.3 app/controllers/maestrano/auth/saml_controller.rb
maestrano-connector-rails-1.3.2 app/controllers/maestrano/auth/saml_controller.rb
maestrano-connector-rails-1.3.1 app/controllers/maestrano/auth/saml_controller.rb
maestrano-connector-rails-1.3.0 app/controllers/maestrano/auth/saml_controller.rb
maestrano-connector-rails-1.2.3 app/controllers/maestrano/auth/saml_controller.rb
maestrano-connector-rails-1.2.2 app/controllers/maestrano/auth/saml_controller.rb