Skip to content

LDAP adaptor initialization exceptions cannot be handled #77

@btapia

Description

@btapia

Currently, in the callback_phase, none of the exceptions raised by the initialization of OmniAuth::LDAP::Adaptor are captured and derived to the fail!() method, giving no opportunity to be handled by the application.

The initialization is being done outside the begin-rescue block.

def callback_phase
  @adaptor = OmniAuth::LDAP::Adaptor.new @options

  return fail!(:missing_credentials) if missing_credentials?
  begin
    @ldap_user_info = @adaptor.bind_as(:filter => filter(@adaptor), :size => 1, :password => request['password'])
    return fail!(:invalid_credentials) if !@ldap_user_info

    @user_info = self.class.map_user(@@config, @ldap_user_info)
    super
  rescue Exception => e
    return fail!(:ldap_error, e)
  end
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions