Sha256: e6d6859ca27ddc6edc4ab89f8bf866c0724fcb47556d6052b93610e621d2aa92

Contents?: true

Size: 1.23 KB

Versions: 10

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(:setting)
      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

10 entries across 10 versions & 1 rubygems

Version Path
maestrano-connector-rails-0.4.1 app/controllers/maestrano/auth/saml_controller.rb
maestrano-connector-rails-0.4.0 app/controllers/maestrano/auth/saml_controller.rb
maestrano-connector-rails-0.3.13 app/controllers/maestrano/auth/saml_controller.rb
maestrano-connector-rails-0.3.12 app/controllers/maestrano/auth/saml_controller.rb
maestrano-connector-rails-0.3.11 app/controllers/maestrano/auth/saml_controller.rb
maestrano-connector-rails-0.3.10 app/controllers/maestrano/auth/saml_controller.rb
maestrano-connector-rails-0.3.9 app/controllers/maestrano/auth/saml_controller.rb
maestrano-connector-rails-0.3.8 app/controllers/maestrano/auth/saml_controller.rb
maestrano-connector-rails-0.3.7 app/controllers/maestrano/auth/saml_controller.rb
maestrano-connector-rails-0.3.6 app/controllers/maestrano/auth/saml_controller.rb