authapi

package
v0.5.0-rc1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2016 License: BSD-3-Clause, MPL-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthAsync

func AuthAsync() func(*url.Values)

func AuthDevice

func AuthDevice(device string) func(*url.Values)

func AuthDisplayUsername

func AuthDisplayUsername(username string) func(*url.Values)

func AuthIpAddr

func AuthIpAddr(ip string) func(*url.Values)

func AuthPasscode

func AuthPasscode(passcode string) func(*url.Values)

func AuthPushinfo

func AuthPushinfo(pushinfo string) func(*url.Values)

func AuthType

func AuthType(type_ string) func(*url.Values)

func AuthUserId

func AuthUserId(userid string) func(*url.Values)

func AuthUsername

func AuthUsername(username string) func(*url.Values)

func EnrollUsername

func EnrollUsername(username string) func(*url.Values)

Optional parameter for the Enroll method.

func EnrollValidSeconds

func EnrollValidSeconds(secs uint64) func(*url.Values)

Optional parameter for the Enroll method.

func PreauthIpAddr

func PreauthIpAddr(ip string) func(*url.Values)

func PreauthTrustedToken

func PreauthTrustedToken(trustedtoken string) func(*url.Values)

func PreauthUserId

func PreauthUserId(userid string) func(*url.Values)

func PreauthUsername

func PreauthUsername(username string) func(*url.Values)

Types

type AuthApi

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

func NewAuthApi

func NewAuthApi(api duoapi.DuoApi) *AuthApi

Build a new Duo Auth API object. api is a duoapi.DuoApi object used to make the Duo Rest API calls. Example: authapi.NewAuthApi(*duoapi.NewDuoApi(ikey,skey,host,userAgent,duoapi.SetTimeout(10*time.Second)))

func (*AuthApi) Auth

func (api *AuthApi) Auth(factor string, options ...func(*url.Values)) (*AuthResult, error)

Duo's Auth method. https://www.duosecurity.com/docs/authapi#/auth Factor must be one of 'auto', 'push', 'passcode', 'sms' or 'phone'. Use AuthUserId to specify the user_id. Use AuthUsername to speicy the username. You must specify either AuthUserId or AuthUsername, but not both. Use AuthIpAddr to include the client's IP address. Use AuthAsync to toggle whether the call blocks for the user's response or not. If used asynchronously, get the auth status with the AuthStatus method. When using factor 'push', use AuthDevice to specify the device ID to push to. When using factor 'push', use AuthType to display some extra auth text to the user. When using factor 'push', use AuthDisplayUsername to display some extra text to the user. When using factor 'push', use AuthPushInfo to include some URL-encoded key/value pairs to display to the user. When using factor 'passcode', use AuthPasscode to specify the passcode entered by the user. When using factor 'sms' or 'phone', use AuthDevice to specify which device should receive the SMS or phone call.

func (*AuthApi) AuthStatus

func (api *AuthApi) AuthStatus(txid string) (*AuthStatusResult, error)

Duo's auth_status method. https://www.duosecurity.com/docs/authapi#/auth_status When using the Auth call in async mode, use this method to retrieve the result of the authentication attempt. txid is returned by the Auth call.

func (*AuthApi) Check

func (api *AuthApi) Check() (*CheckResult, error)

Call Duo's Check method. https://www.duosecurity.com/docs/authapi#/check Check is a signed Duo API call, which returns the Duo system's time. Use this method to determine whether your ikey, skey and host are correct, and whether your system time is in sync with Duo's.

func (*AuthApi) Enroll

func (api *AuthApi) Enroll(options ...func(*url.Values)) (*EnrollResult, error)

Duo's Enroll method. https://www.duosecurity.com/docs/authapi#/enroll Use EnrollUsername() to include the optional username parameter. Use EnrollValidSeconds() to change the default validation time limit that the user has to complete enrollment.

func (*AuthApi) EnrollStatus

func (api *AuthApi) EnrollStatus(userid string,
	activationCode string) (*EnrollStatusResult, error)

Duo's EnrollStatus method. https://www.duosecurity.com/docs/authapi#/enroll_status Return the status of an outstanding Enrollment.

func (api *AuthApi) Logo() (*LogoResult, error)

Duo's Logo method. https://www.duosecurity.com/docs/authapi#/logo If the API call is successful, the configured logo png is returned. Othwerwise, error information is returned in the LogoResult return value.

func (*AuthApi) Ping

func (api *AuthApi) Ping() (*PingResult, error)

Duo's Ping method. https://www.duosecurity.com/docs/authapi#/ping This is an unsigned Duo Rest API call which returns the Duo system's time. Use this method to determine whether your system time is in sync with Duo's.

func (*AuthApi) Preauth

func (api *AuthApi) Preauth(options ...func(*url.Values)) (*PreauthResult, error)

Duo's Preauth method. https://www.duosecurity.com/docs/authapi#/preauth options Optional values to include in the preauth call. Use PreauthUserId to specify the user_id parameter. Use PreauthUsername to specify the username parameter. You must specify PreauthUserId or PreauthUsername, but not both. Use PreauthIpAddr to include the ipaddr parameter, the ip address of the client attempting authroization. Use PreauthTrustedToken to specify the trusted_device_token parameter.

type AuthResult

type AuthResult struct {
	StatResult
	Response struct {
		// Synchronous
		Result     string
		Status     string
		Status_Msg string
		// Asynchronous
		Txid string
	}
}

Auth return type.

type AuthStatusResult

type AuthStatusResult struct {
	StatResult
	Response struct {
		Result               string
		Status               string
		Status_Msg           string
		Trusted_Device_Token string
	}
}

AuthStatus return type.

type CheckResult

type CheckResult struct {
	StatResult
	Response struct {
		Time int64
	}
}

Return object for the 'Check' API call.

type EnrollResult

type EnrollResult struct {
	StatResult
	Response struct {
		Activation_Barcode string
		Activation_Code    string
		Expiration         int64
		User_Id            string
		Username           string
	}
}

Enroll return type.

type EnrollStatusResult

type EnrollStatusResult struct {
	StatResult
	Response string
}

Response is "success", "invalid" or "waiting".

type LogoResult

type LogoResult struct {
	StatResult
	// contains filtered or unexported fields
}

Return object for the 'Logo' API call.

type PingResult

type PingResult struct {
	StatResult
	Response struct {
		Time int64
	}
}

Return object for the 'Ping' API call.

type PreauthResult

type PreauthResult struct {
	StatResult
	Response struct {
		Result            string
		Status_Msg        string
		Enroll_Portal_Url string
		Devices           []struct {
			Device       string
			Type         string
			Name         string
			Number       string
			Capabilities []string
		}
	}
}

Preauth return type.

type StatResult

type StatResult struct {
	Stat           string
	Code           *int32
	Message        *string
	Message_Detail *string
}

API calls will return a StatResult object. On success, Stat is 'OK'. On error, Stat is 'FAIL', and Code, Message, and Message_Detail contain error information.

Jump to

Keyboard shortcuts

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