duoapi

package module
v0.0.0-...-e9724b5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 28, 2018 License: BSD-3-Clause Imports: 12 Imported by: 0

README

Overview

duo_client - Demonstration client to call Duo API methods with Go.

Duo Auth API

The Duo Auth API provides a low-level API for adding strong two-factor authentication to applications that cannot directly display rich web content.

For more information see the Duo Auth API guide:

http://www.duosecurity.com/docs/authapi

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetInsecure

func SetInsecure() func(*apiOptions)

Optional parameter for testing only. Bypasses all TLS certificate validation.

func SetProxy

func SetProxy(proxy func(*http.Request) (*url.URL, error)) func(*apiOptions)

Optional parameter for NewDuoApi, used to configure an HTTP Connect proxy server for all outbound communications.

func SetTimeout

func SetTimeout(timeout time.Duration) func(*apiOptions)

Optional parameter for NewDuoApi, used to configure timeouts on API calls.

func UseTimeout

func UseTimeout(opts *requestOptions)

Pass to Request or SignedRequest to configure a timeout on the request

Types

type DuoApi

type DuoApi struct {
	// contains filtered or unexported fields
}

func NewDuoApi

func NewDuoApi(ikey string,
	skey string,
	host string,
	userAgent string,
	options ...func(*apiOptions)) *DuoApi

Build an return a DuoApi struct. ikey is your Duo integration key skey is your Duo integration secret key host is your Duo host userAgent allows you to specify the user agent string used when making

the web request to Duo.

options are optional parameters. Use SetTimeout() to specify a timeout value

for Rest API calls.  Use SetProxy() to specify proxy settings for Duo API calls.

Example: duoapi.NewDuoApi(ikey,skey,host,userAgent,duoapi.SetTimeout(10*time.Second))

func (*DuoApi) Call

func (duoapi *DuoApi) Call(method string,
	uri string,
	params url.Values,
	options ...DuoApiOption) (*http.Response, []byte, error)

Make an unsigned Duo Rest API call. See Duo's online documentation for the available REST API's. method is POST or GET uri is the URI of the Duo Rest call params HTTP query parameters to include in the call. options Optional parameters. Use UseTimeout to toggle whether the

Duo Rest API call should timeout or not.

Example: duo.Call("GET", "/auth/v2/ping", nil, duoapi.UseTimeout)

func (*DuoApi) SignedCall

func (duoapi *DuoApi) SignedCall(method string,
	uri string,
	params url.Values,
	options ...DuoApiOption) (*http.Response, []byte, error)

Make a signed Duo Rest API call. See Duo's online documentation for the available REST API's. method is POST or GET uri is the URI of the Duo Rest call params HTTP query parameters to include in the call. options Optional parameters. Use UseTimeout to toggle whether the

Duo Rest API call should timeout or not.

Example: duo.SignedCall("GET", "/auth/v2/check", nil, duoapi.UseTimeout)

type DuoApiOption

type DuoApiOption func(*requestOptions)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL