Sha256: 1c392e681795bb01065b6af22cd7de2caa7c945f69c053b6d1ae5bb6bb56ad8a
Contents?: true
Size: 1.41 KB
Versions: 23
Compression:
Stored size: 1.41 KB
Contents
# encoding: UTF-8 require File.dirname(__FILE__) + '/../spec_helper' require 'casserver/authenticators/ldap' describe CASServer::Authenticators::LDAP do before do @ldap_entry = mock(Net::LDAP::Entry.new) @ldap_entry.stub!(:[]).and_return("Test") @ldap = mock(Net::LDAP) @ldap.stub!(:host=) @ldap.stub!(:port=) @ldap.stub!(:encryption) @ldap.stub!(:bind_as).and_return(true) @ldap.stub!(:authenticate).and_return(true) @ldap.stub!(:search).and_return([@ldap_entry]) Net::LDAP.stub!(:new).and_return(@ldap) end describe '#validate' do it 'validate with preauthentication and with extra attributes' do auth = CASServer::Authenticators::LDAP.new auth_config = HashWithIndifferentAccess.new( :ldap => { :host => "ad.example.net", :port => 389, :base => "dc=example,dc=net", :filter => "(objectClass=person)", :auth_user => "authenticator", :auth_password => "itsasecret" }, :extra_attributes => [:full_name, :address] ) auth.configure(auth_config.merge('auth_index' => 0)) auth.validate( :username => 'validusername', :password => 'validpassword', :service => 'test.service', :request => {} ).should == true auth.extra_attributes.should == {:full_name => 'Test', :address => 'Test'} end end end
Version data entries
23 entries across 23 versions & 4 rubygems