Redirect to proper messages tab after bulk update
[gitorious.git] / script / test_ldap_connection
blob3620b75ec9b34d24751705d2fefec94cb4377907
1 #!/usr/bin/env ruby
2 # Test a username/password combination towards the LDAP server specified in config/authentication.yml
4 if ARGV.size < 2
5 abort "Usage: #{$0} username password"
6 end
8 require "./config/environment"
10 username = ARGV[0]
11 password = ARGV[1]
12 ldap = Gitorious::Authentication::Configuration.authentication_method('LDAP')
14 abort "You need to configure LDAP autentication in config/authentication.yml" unless ldap
16 if ldap.valid_credentials?(username, password)
17 puts "All good, your credentials are correct"
18 else
19 puts "Not there yet."
20 puts "For debugging purposes, this is the DN we tried: #{ldap.build_username(username)}"
21 end