soap-tls-0.1.1.2/0000755000000000000000000000000012504223175011602 5ustar0000000000000000soap-tls-0.1.1.2/LICENSE0000644000000000000000000000206512504223175012612 0ustar0000000000000000Copyright (c) 2013 Alexander Bondarenko Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. soap-tls-0.1.1.2/changelog0000644000000000000000000000036012504223175013453 0ustar00000000000000000.1.1.3: * Drop upper bounds entirely. 0.1.1.1: * Raise http-client upper boundary. 0.1.1: + Server certificate validator can be specified for confTransport. * Re-export default validator from X509. 0.1: + Initial version. soap-tls-0.1.1.2/Setup.hs0000644000000000000000000000005612504223175013237 0ustar0000000000000000import Distribution.Simple main = defaultMain soap-tls-0.1.1.2/soap-tls.cabal0000644000000000000000000000267712504223175014344 0ustar0000000000000000name: soap-tls version: 0.1.1.2 synopsis: TLS-enabled SOAP transport (using tls package) description: TLS-enabled SOAP transport (using tls package) . > main = do > -- Initial one-time preparations. > settings <- makeSettings (Just "client.crt") (Just "client.key") validateDefault > transport <- initTransportWith settings "http://example.com/soap/endpoint" id (iconv "cp-1251") > > -- the rest is the same as before... homepage: https://bitbucket.org/dpwiz/haskell-soap license: MIT license-file: LICENSE author: Alexander Bondarenko maintainer: aenor.realm@gmail.com -- copyright: category: Web build-type: Simple cabal-version: >=1.10 extra-source-files: changelog library ghc-options: -Wall exposed-modules: Network.SOAP.Transport.HTTP.TLS build-depends: base >=4.6 && <5 , soap >= 0.2.2 , http-client >= 0.2 , http-client-tls >= 0.2 , tls >= 1.2 , connection >= 0.2 , x509 , x509-store , x509-validation , text , configurator , data-default hs-source-dirs: src default-language: Haskell2010 default-extensions: OverloadedStrings soap-tls-0.1.1.2/src/0000755000000000000000000000000012504223175012371 5ustar0000000000000000soap-tls-0.1.1.2/src/Network/0000755000000000000000000000000012504223175014022 5ustar0000000000000000soap-tls-0.1.1.2/src/Network/SOAP/0000755000000000000000000000000012504223175014564 5ustar0000000000000000soap-tls-0.1.1.2/src/Network/SOAP/Transport/0000755000000000000000000000000012504223175016560 5ustar0000000000000000soap-tls-0.1.1.2/src/Network/SOAP/Transport/HTTP/0000755000000000000000000000000012504223175017337 5ustar0000000000000000soap-tls-0.1.1.2/src/Network/SOAP/Transport/HTTP/TLS.hs0000644000000000000000000000400312504223175020332 0ustar0000000000000000-- | SSL-enabled http transport with support for https requests and client certificates. module Network.SOAP.Transport.HTTP.TLS ( confTransport , makeSettings -- * Certificate validation , ServerCertCallback, validateDefault ) where import Network.HTTP.Client (ManagerSettings) import Network.SOAP.Transport (Transport) import Network.SOAP.Transport.HTTP (confTransportWith) import Network.HTTP.Client.TLS import Network.TLS import Data.X509 import Data.X509.CertificateStore import Data.X509.Validation import Network.Connection (TLSSettings(..)) import Data.Monoid import Data.Text (Text) import Data.Default (def) import qualified Data.Configurator as Conf import Data.Configurator.Types (Config) type ServerCertCallback = CertificateStore -> ValidationCache -> ServiceID -> CertificateChain -> IO [FailedReason] -- | Initialize a SOAP HTTP transport with HTTPS support using tls. confTransport :: Text -- ^ Section name containing transport settings. -> Config -> ServerCertCallback -> IO Transport confTransport section conf onSC = do cert <- Conf.lookup conf (section <> ".client_cert") key <- Conf.lookup conf (section <> ".client_key") settings <- makeSettings cert key onSC confTransportWith settings section conf id id makeSettings :: Maybe FilePath -> Maybe FilePath -> ServerCertCallback -> IO ManagerSettings makeSettings (Just certFile) (Just keyFile) onSC = do creds <- either error Just `fmap` credentialLoadX509 certFile keyFile let onCR _ = return creds let hooks = def { onCertificateRequest = onCR , onServerCertificate = onSC } let clientParams = (defaultParamsClient "" "") { clientHooks = hooks } return $! mkManagerSettings (TLSSettings clientParams) Nothing makeSettings _ _ _ = return tlsManagerSettings