duo

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrDuoServer = errors.New("duo: server error")

ErrDuoServer is returned when an error is returned by the Duo servers for an unknown reason.

View Source
var ErrMethodNotSupported = errors.New("duo: method not supported")

ErrMethodNotSupported is returned when an attempt is made to use a Method that is currently not supported.

Functions

This section is empty.

Types

type Challenge

type Challenge struct {
	Devices []Device
	Methods []Method
	// contains filtered or unexported fields
}

An Challenge is a 2FA request from Duo.

func BeginChallenge

func BeginChallenge(c *http.Client, parent string, host string, sigRequest string, postAction string) (*Challenge, error)

BeginChallenge starts handling a Duo authentication request.

func (*Challenge) StartMethod

func (c *Challenge) StartMethod(method *Method) (*StatusResponse, error)

StartMethod starts the authentication process with the given Method.

func (*Challenge) WaitForCompletion

func (c *Challenge) WaitForCompletion() (*FinalResponse, *ChallengeResponse, error)

WaitForCompletion waits for the Challenge's authentication process to complete.

type ChallengeResponse

type ChallengeResponse struct {
	StatusCode string `json:"status_code"`
	Result     string `json:"result"`
	ResultURL  string `json:"result_url"`
	Parent     string `json:"parent"`
	Reason     string `json:"reason"`
	Status     string `json:"status"`
}

A ChallengeResponse is returned after a Challenge's Method is completed.

type Device

type Device struct {
	Index        string
	FriendlyName string
}

A Device is a device that can be used with a Method.

type FinalResponse

type FinalResponse struct {
	Parent string `json:"parent"`
	Cookie string `json:"cookie"`
}

A FinalResponse is returned after a Challenge is completed, and it can be used to finish the authentication process.

type Method

type Method struct {
	FriendlyName string
	DeviceName   string
	DeviceIndex  string
}

A Method is a method that can be used to complete a Challenge.

type StatusResponse

type StatusResponse struct {
	StatusCode string `json:"status_code"`
	Status     string `json:"status"`
}

A StatusResponse is returned after a Challenge's Method is started.

Jump to

Keyboard shortcuts

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