18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/fluent/plugin/mongo_auth.rb', line 18
def authenticate(client)
begin
if [@user, @password, @auth_source].all?
client = client.with(user: @user, password: @password, auth_source: @auth_source)
elsif [@user, @password].all?
client = client.with(user: @user, password: @password)
elsif [@user, @auth_source, @auth_mech].all?
client = client.with(user: @user, auth_source: @auth_source, auth_mech: @auth_mech.to_sym)
end
rescue Mongo::Auth::Unauthorized => e
log.fatal e
exit!
end
client
end
|