Skip to content

Commit

Permalink
Net::LDAP#encryption accepts string
Browse files Browse the repository at this point in the history
  • Loading branch information
satoryu committed Nov 25, 2015
1 parent d65c597 commit 11ad905
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/net/ldap.rb
Original file line number Diff line number Diff line change
Expand Up @@ -589,9 +589,11 @@ def authenticate(username, password)
# :tls_options => { :ca_file => "/etc/cafile.pem", :ssl_version => "TLSv1_1" }
# }
def encryption(args)
case args
return if args.nil?

case method = args.to_sym
when :simple_tls, :start_tls
args = { :method => args, :tls_options => {} }
args = { :method => method, :tls_options => {} }
end
@encryption = args
end
Expand Down
6 changes: 6 additions & 0 deletions test/test_ldap.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,10 @@ def test_obscure_auth
@subject.auth "joe_user", password
assert_not_include(@subject.inspect, password)
end

def test_encryption
enc = @subject.encryption('start_tls')

assert_equal enc[:method], :start_tls
end
end

0 comments on commit 11ad905

Please sign in to comment.