import Ldap.Client as Ldap import qualified Ldap.Client.Bind as Ldap ldapTest :: App -> IO Text ldapTest app = do let ldapHost = ..... let ldapPort = ..... let ldapBindDn = ..... let ldapBindPassword = ..... let tlsSettings = if ..... then Ldap.defaultTlsSettings else Ldap.insecureTlsSettings res <- Ldap.with (Ldap.Tls ldapHost tlsSettings) (fromInteger ldapPort) $ \l -> do Ldap.bind l (Dn ldapBindDn) (Password $ encodeUtf8 ldapBindPassword) Ldap.search l (Dn "dc=.....") (typesOnly False) (And [ Attr "objectCategory" := "Person" , Attr "objectClass" := "user" , Attr "sAMAccountName" := encodeUtf8 "xyzuser" ]) [] case res of Left e -> return $ pack $ "ERROR: " ++ show e Right t -> return $ pack $ "OK: " ++ show t
Thursday, September 12, 2019
haskell LDAP TLS
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment