allow access to TLSSettings for the connection, e.g. for use with client side certificates

This commit is contained in:
Matthias Hörmann 2016-12-26 19:39:48 +01:00 committed by Matvey Aksenov
parent 7a2cf37141
commit 889c66a046
2 changed files with 5 additions and 1 deletions

View File

@ -162,6 +162,7 @@ with host port f = do
case host of case host of
Plain h -> h Plain h -> h
Secure h -> h Secure h -> h
SecureWithTLSSettings h _ -> h
Insecure h -> h Insecure h -> h
, Conn.connectionPort = port , Conn.connectionPort = port
, Conn.connectionUseSecure = , Conn.connectionUseSecure =
@ -172,6 +173,7 @@ with host port f = do
, Conn.settingDisableSession = False , Conn.settingDisableSession = False
, Conn.settingUseServerName = False , Conn.settingUseServerName = False
} }
SecureWithTLSSettings _ t -> Just t
Insecure _ -> Just Conn.TLSSettingsSimple Insecure _ -> Just Conn.TLSSettingsSimple
{ Conn.settingDisableCertificateValidation = True { Conn.settingDisableCertificateValidation = True
, Conn.settingDisableSession = False , Conn.settingDisableSession = False

View File

@ -36,6 +36,7 @@ import Data.List.NonEmpty (NonEmpty)
import Data.Text (Text) import Data.Text (Text)
import Data.Typeable (Typeable) import Data.Typeable (Typeable)
import Network (PortNumber) import Network (PortNumber)
import Network.Connection (TLSSettings)
import qualified Ldap.Asn1.Type as Type import qualified Ldap.Asn1.Type as Type
@ -46,7 +47,8 @@ data Host =
| Insecure String -- ^ LDAP over TLS without the certificate validity check. | Insecure String -- ^ LDAP over TLS without the certificate validity check.
-- Only use for testing! -- Only use for testing!
| Secure String -- ^ LDAP over TLS. Use! | Secure String -- ^ LDAP over TLS. Use!
deriving (Show, Eq, Ord) | SecureWithTLSSettings String TLSSettings -- ^ LDAP over TLS with the ability to specify detailed TLS settings
deriving (Show)
-- | A token. All functions that interact with the Directory require one. -- | A token. All functions that interact with the Directory require one.
data Ldap = Ldap data Ldap = Ldap