Sha256: 1546f0db2a1f7ce5cee011cf0c905f011c8139592c8d9cce0f43050559f0ad2e

Contents?: true

Size: 1.23 KB

Versions: 13

Compression:

Stored size: 1.23 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
      unless organization.member?(user)
        organization.add_member(user)
      end

      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
    else
      if 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
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
maestrano-connector-rails-1.2.1 app/controllers/maestrano/auth/saml_controller.rb
maestrano-connector-rails-1.2.0 app/controllers/maestrano/auth/saml_controller.rb
maestrano-connector-rails-1.1.2 app/controllers/maestrano/auth/saml_controller.rb
maestrano-connector-rails-1.1.1 app/controllers/maestrano/auth/saml_controller.rb
maestrano-connector-rails-1.1.0 app/controllers/maestrano/auth/saml_controller.rb
maestrano-connector-rails-1.0.4 app/controllers/maestrano/auth/saml_controller.rb
maestrano-connector-rails-1.0.3 app/controllers/maestrano/auth/saml_controller.rb
maestrano-connector-rails-1.0.2 app/controllers/maestrano/auth/saml_controller.rb
maestrano-connector-rails-1.0.1 app/controllers/maestrano/auth/saml_controller.rb
maestrano-connector-rails-1.0.0 app/controllers/maestrano/auth/saml_controller.rb
maestrano-connector-rails-0.4.4 app/controllers/maestrano/auth/saml_controller.rb
maestrano-connector-rails-0.4.3 app/controllers/maestrano/auth/saml_controller.rb
maestrano-connector-rails-0.4.2 app/controllers/maestrano/auth/saml_controller.rb