There is a need for non-browser Duo authentication support in the IdP (particularly for Amazon Web Service command-line access).
I have written a collection of classes which provide this functionality. While they seem to work correctly, they have not been rigorously tested. You are welcome to use them in whole or in part as you see fit. They are written for v3.3.1
The code can be found at https://github.com/JohnPfeifer/duo-non-browser