Active Directory/Connect: Difference between revisions
Content added Content deleted
No edit summary |
|||
Line 92: | Line 92: | ||
let connect = new System.DirectoryServices.Protocols.LdapConnection(ldapServer) |
let connect = new System.DirectoryServices.Protocols.LdapConnection(ldapServer) |
||
connect.Bind()</lang> |
connect.Bind()</lang> |
||
=={{header|Haskell}}== |
|||
Example uses the [https://hackage.haskell.org/package/ldap-client <tt>ldap-client</tt>] package: |
|||
<lang haskell> |
|||
{-# LANGUAGE OverloadedStrings #-} |
|||
module Main (main) where |
|||
import Data.Foldable (for_) |
|||
import qualified Data.Text.Encoding as Text (encodeUtf8) |
|||
import Ldap.Client (Attr(..), Filter(..)) |
|||
import qualified Ldap.Client as Ldap (Dn(..), Host(..), search, with, typesOnly) |
|||
main :: IO () |
|||
main = do |
|||
entries <- Ldap.with (Ldap.Plain "localhost") 389 $ \ldap -> |
|||
Ldap.search ldap (Ldap.Dn "o=example.com") (Ldap.typesOnly True) (Attr "uid" := Text.encodeUtf8 "user") [] |
|||
for_ entries $ \entry -> |
|||
print entry |
|||
</lang> |
|||
=={{header|Java}}== |
=={{header|Java}}== |