packages feed

soap-tls (empty) → 0.1.0.0

raw patch · 5 files changed

+93/−0 lines, 5 filesdep +basedep +configuratordep +connectionsetup-changed

Dependencies added: base, configurator, connection, data-default, http-client-tls, soap, text, tls, x509-validation

Files

+ LICENSE view
@@ -0,0 +1,20 @@+Copyright (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.
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ changelog view
@@ -0,0 +1,3 @@+0.1:++  + Initial version.
+ soap-tls.cabal view
@@ -0,0 +1,32 @@+name:                soap-tls+version:             0.1.0.0+synopsis:            TLS-enabled SOAP transport (using tls package)+description:         TLS-enabled SOAP transport (using tls package)+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 && < 0.3+                     , http-client-tls >= 0.2 && < 0.3+                     , tls >= 1.2 && < 2+                     , connection >= 0.2 && < 0.3+                     , x509-validation+                     , text+                     , configurator+                     , data-default++  hs-source-dirs:      src+  default-language:    Haskell2010+  default-extensions:  OverloadedStrings
+ src/Network/SOAP/Transport/HTTP/TLS.hs view
@@ -0,0 +1,36 @@+-- | SSL-enabled http transport with support for https requests and client certificates.++module Network.SOAP.Transport.HTTP.TLS where++import Network.SOAP.Transport (Transport)+import Network.SOAP.Transport.HTTP (confTransportWith)++import Network.HTTP.Client.TLS+import Network.TLS+import Data.X509.Validation as X509+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)++confTransport :: Text -> Config -> IO Transport+confTransport section conf = do+    cert <- Conf.lookup conf (section <> ".client_cert")+    key <- Conf.lookup conf (section <> ".client_key")+    settings <- makeSettings cert key X509.validateDefault+    confTransportWith settings section conf id id++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