LDAP 認証はhttps://github.com/plataformatec/devise/wiki/How-To:-Authenticate-via-LDAPを使用して Rails に実装されており、正常に動作します。
システム テストhttp://guides.rubyonrails.org/testing.html#system-testing中に LDAP を使用しようとして失敗しました:
Rack app error handling request { POST /login }
#<NoMethodError: undefined method `[]' for nil:NilClass>
.../config/initializers/ldap_authenticatable.rb:92:in `ldap'
.../config/initializers/ldap_authenticatable.rb:60:in `bind_to_ldap'
.../config/initializers/ldap_authenticatable.rb:44:in `authenticate!'
エラーはldap.ymlファイルが原因で発生します。テストが extern ファイルから構成を読み取れないようです。LDAP パラメータを置き換える回避策
LDAP_CONFIG = YAML.load_file("#{Rails.root}/config/ldap.yml")[Rails.env]
def ldap
ldap = Net::LDAP.new({
:host => LDAP_CONFIG['host'],
:port => LDAP_CONFIG['port'],
...
と
def ldap
ldap = Net::LDAP.new({
:host => 'ldap.domainname.com',
:port => 636,
...
エラーを回避します。
これがバグかどうか教えてください。