/duo_go

An implementation of the Duo Security Web SDK in Go/Golang.

Primary LanguageGoApache License 2.0Apache-2.0

Overview

Build Status Coverage Status Go Report Card Pkg.Go.Dev Module Version

duo_go - Duo 2FA for Go web applications: https://duo.com/docs/duoweb

Installing

$ go get github.com/mschwager/duo_go

Using

Here's a short snippet of code demonstrating the library:

package main

import (
    "fmt"
    "github.com/mschwager/duo_go"
)

func main() {
    duo_configuration := &duo_go.Web{
        Ikey: "<ikey-here>",
        Skey: "<skey-here>",
        Akey: "<akey-here>",
    }
    sig_request, _ := duo_go.SignRequest(duo_configuration, "example_username")

    fmt.Println("Signature request: " + sig_request)
}
$ go run example.go
Signature request: TX|ZXh...|5ce...:APP|ZXh...|fc2...

For a more complete example, checkout the demo code.

Demo

Configure your ikey, skey, akey, and host, in duo_go_demo.go.

Then run the following command:

$ go run duo_go_demo/duo_go_demo.go

Testing

$ go test