Re: how to send SSL certificate in POST request?

2017-02-22 Thread Michael Ball
I had to do the same several months ago. You will need to create a java key 
store with the certificate. Once you have a keystore,  here's the clj-http 
docs on how to include it in an http request.

https://github.com/dakrone/clj-http#keystores-trust-stores

(client/post "https://example.com; {:keystore "/path/to/keystore.ks"
:keystore-type "jks" ; default: jks
:keystore-pass "secretpass"})





I don't know if it's much use to you but here's how I created the keystore 
using openssl first to convert to pkcs12 then the java keytool to build the 
keystore. 

openssl pkcs12 -export -in cert.pem -inkey "private_key.pem" -certfile 
> cert.pem -out keystore.p12
>
 

> keytool -importkeystore -srckeystore keystore.p12 -srcstoretype PKCS12 
> -destkeystore keystore.jks
>
 

> keytool -import -alias ejbca -keystore keystore.jks -file 
> VDPCA-Sandbox.pem -storepass password








On Tuesday, February 21, 2017 at 3:36:41 PM UTC-8, Pierre Masci wrote:
>
> Hi, I am new to Clojure and using clj-http for the first time, to 
> implement a REST client.
> I don't find anywhere how to indicate where my SSL certificate is located.
> Here is what I did:
>
> (ns my-client.core
>   (:require [clj-http.client :as client]
> [clojure.pprint :refer :all]))
>
> (def my-appkey "...")
>
> (defn login [username password appkey]
>   (client/post "https://.../api/certlogin;
>{:headers {"X-Application" appkey
>   "Content-Type" 
> "application/x-www-form-urlencoded"}
> :form-params {"username" username "password" password}}))
>
> (defn -main []
>   (pprint (login "..." "..." my-appkey)))
>
>
> This sends me back a response which indicates that I need to send the SSL 
> certificate.
> When I send the same request with curl and indicate the certificates, it 
> works. This is the successful curl request:
>
> curl -q -k --cert client-2048.crt --key client-2048.key 
> https://.../api/certlogin 
> -d "username=...=..." -H "X-Application: ..."
>  
>
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ANN] core.async 0.3.426

2017-02-22 Thread Gary Trakhman
Thank you so much for getting around to ASYNC-138+32, it was a usability
issue between idiomatic clojure code and async code, would show up almost
immediately in new projects, the workaround raised questions during
code-reviews, etc.

On Wed, Feb 22, 2017 at 1:47 PM Alex Miller  wrote:

> core.async 0.3.426 is now available.
>
> Try it via:  [org.clojure/core.async "0.3.426"]
>
> 0.3.426 includes the following changes:
>
>- ASYNC-169  - handling
>of catch and finally inside go blocks was broken, causing a number of 
> issues
>   - Related: ASYNC-100 
>   , ASYNC-173 ,
>   ASYNC-180 , ASYNC-179
>   , ASYNC-122
>   , ASYNC-78
>   , ASYNC-168
>   
>- ASYNC-138  - go blocks
>do not allow closed over locals to be cleared which can lead to a memory
>leak
>   - Related: ASYNC-32 
>- ASYNC-155  - preserve
>loop binding metadata when inside a go block
>- ASYNC-54  - fix bad
>type hint on MAX-QUEUE-SIZE
>- ASYNC-177  - fix
>docstring typo in Buffer protocol full? method
>- ASYNC-70  - docstring
>change in thread, thread-call
>- ASYNC-143  - assert
>that fixed buffers must have size > 0
>- Update tools.analyzer.jvm dependency
>
>
> Many thanks to Kevin Downey and Nicola Mometto for their help on the go
> block issues.
>
> Additionally, I've done some work to make the core.async build less weird
> and to match all the other contrib projects (other than how the version is
> computed). This will make core.async easier to use and manage for
> development and CI and also lets us use our automated CI matrix test setup
> to give us more coverage going forward.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ANN] core.async 0.3.426

2017-02-22 Thread Alex Miller
core.async 0.3.426 is now available.

Try it via:  [org.clojure/core.async "0.3.426"]

0.3.426 includes the following changes:

   - ASYNC-169  - handling of 
   catch and finally inside go blocks was broken, causing a number of issues
  - Related: ASYNC-100 , 
  ASYNC-173 , ASYNC-180 
  , ASYNC-179 
  , ASYNC-122 
  , ASYNC-78 
  , ASYNC-168 
  
   - ASYNC-138  - go blocks 
   do not allow closed over locals to be cleared which can lead to a memory 
   leak
  - Related: ASYNC-32 
   - ASYNC-155  - preserve 
   loop binding metadata when inside a go block
   - ASYNC-54  - fix bad type 
   hint on MAX-QUEUE-SIZE
   - ASYNC-177  - fix 
   docstring typo in Buffer protocol full? method
   - ASYNC-70  - docstring 
   change in thread, thread-call
   - ASYNC-143  - assert that 
   fixed buffers must have size > 0
   - Update tools.analyzer.jvm dependency


Many thanks to Kevin Downey and Nicola Mometto for their help on the go 
block issues.

Additionally, I've done some work to make the core.async build less weird 
and to match all the other contrib projects (other than how the version is 
computed). This will make core.async easier to use and manage for 
development and CI and also lets us use our automated CI matrix test setup 
to give us more coverage going forward.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.