duo

package
v4.34.4 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Push Method - The device is activated for Duo Push.
	Push = "push"
	// OTP Method - The device is capable of generating passcodes with the Duo Mobile app.
	OTP = "mobile_otp"
	// Phone Method - The device can receive phone calls.
	Phone = "phone"
	// SMS Method - The device can receive batches of SMS passcodes.
	SMS = "sms"
)

Duo Methods.

Variables

View Source
var PossibleMethods = []string{Push} // OTP, Phone, SMS.

PossibleMethods is the set of all possible Duo 2FA methods.

Functions

This section is empty.

Types

type API

type API interface {
	Call(ctx *middlewares.AutheliaCtx, values url.Values, method string, path string) (*Response, error)
	PreAuthCall(ctx *middlewares.AutheliaCtx, values url.Values) (*PreAuthResponse, error)
	AuthCall(ctx *middlewares.AutheliaCtx, values url.Values) (*AuthResponse, error)
}

API interface wrapping duo api library for testing purpose.

type APIImpl

type APIImpl struct {
	*duoapi.DuoApi
}

APIImpl implementation of DuoAPI interface.

func NewDuoAPI

func NewDuoAPI(duoAPI *duoapi.DuoApi) *APIImpl

NewDuoAPI create duo API instance.

func (*APIImpl) AuthCall added in v4.33.0

func (d *APIImpl) AuthCall(ctx *middlewares.AutheliaCtx, values url.Values) (*AuthResponse, error)

AuthCall call to the DuoAPI.

func (*APIImpl) Call

func (d *APIImpl) Call(ctx *middlewares.AutheliaCtx, values url.Values, method string, path string) (*Response, error)

Call call to the DuoAPI.

func (*APIImpl) PreAuthCall added in v4.33.0

func (d *APIImpl) PreAuthCall(ctx *middlewares.AutheliaCtx, values url.Values) (*PreAuthResponse, error)

PreAuthCall call to the DuoAPI.

type AuthResponse added in v4.33.0

type AuthResponse struct {
	Result             string `json:"result"`
	Status             string `json:"status"`
	StatusMessage      string `json:"status_msg"`
	TrustedDeviceToken string `json:"trusted_device_token"`
}

AuthResponse is a response for a authorization request.

type Device added in v4.33.0

type Device struct {
	Capabilities []string `json:"capabilities"`
	Device       string   `json:"device"`
	DisplayName  string   `json:"display_name"`
	Name         string   `json:"name"`
	SmsNextcode  string   `json:"sms_nextcode"`
	Number       string   `json:"number"`
	Type         string   `json:"type"`
}

Device holds all necessary info for frontend.

type PreAuthResponse added in v4.33.0

type PreAuthResponse struct {
	Result          string   `json:"result"`
	StatusMessage   string   `json:"status_msg"`
	Devices         []Device `json:"devices"`
	EnrollPortalURL string   `json:"enroll_portal_url"`
}

PreAuthResponse is a response for a preauthorization request.

type Response

type Response struct {
	Response      json.RawMessage `json:"response"`
	Code          int             `json:"code"`
	Message       string          `json:"message"`
	MessageDetail string          `json:"message_detail"`
	Stat          string          `json:"stat"`
}

Response coming from Duo API.

Jump to

Keyboard shortcuts

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