duouniversal

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2021 License: BSD-3-Clause Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessDeviceInfo

type AccessDeviceInfo struct {
	Browser             string       `json:"browser"`
	BrowserVersion      string       `json:"browser_version"`
	FlashVersion        string       `json:"flash_version"`
	Hostname            string       `json:"host_name"`
	Ip                  string       `json:"ip"`
	IsEncryptionEnabled FlagStatus   `json:"is_encryption_enabled"`
	IsFirewallEnabled   FlagStatus   `json:"is_firewall_enabled"`
	IsPasswordSet       FlagStatus   `json:"is_password_set"`
	JavaVersion         string       `json:"java_version"`
	Location            LocationInfo `json:"location"`
	Os                  string       `json:"os"`
	OsVersion           string       `json:"os_version"`
}

type ApplicationInfo

type ApplicationInfo struct {
	Key  string `json:"key"`
	Name string `json:"name"`
}

type AuthContextInfo

type AuthContextInfo struct {
	AccessDevice AccessDeviceInfo `json:"access_device"`
	Alias        string           `json:"alias"`
	Application  ApplicationInfo  `json:"application"`
	AuthDevice   AuthDeviceInfo   `json:"auth_device"`
	Email        string           `json:"email"`
	EventType    string           `json:"event_type"`
	Factor       string           `json:"factor"`
	Isotimestamp string           `json:"isotimestamp"`
	OodSoftware  string           `json:"ood_software"`
	Reason       string           `json:"reason"`
	Result       string           `json:"result"`
	Timestamp    int              `json:"timestamp"`
	Txid         string           `json:"txid"`
	User         UserInfo         `json:"user"`
}

type AuthDeviceInfo

type AuthDeviceInfo struct {
	Ip       string       `json:"ip"`
	Location LocationInfo `json:"location"`
	Name     string       `json:"name"`
}

type AuthResultInfo

type AuthResultInfo struct {
	Result    string `json:"result"`
	Status    string `json:"status"`
	StatusMsg string `json:"status_msg"`
}

type BodyToken

type BodyToken struct {
	IdToken     string `json:"id_token"`
	AccessToken string `json:"access_token"`
	ExpiresIn   int    `json:"expires_in"`
	TokenType   string `json:"token_type"`
}

type Client

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

func NewClient

func NewClient(clientId, clientSecret, apiHost, redirectUri string) (*Client, error)

func NewClientDuoCodeAttribute

func NewClientDuoCodeAttribute(clientId, clientSecret, apiHost, redirectUri string, useDuoCodeAttribute bool) (*Client, error)

Creates a new Client with the ability to turn off use_duo_code_attribute

func (*Client) CreateAuthURL

func (client *Client) CreateAuthURL(username string, state string) (string, error)

func (*Client) ExchangeAuthorizationCodeFor2faResult

func (client *Client) ExchangeAuthorizationCodeFor2faResult(duoCode string, username string) (*TokenResponse, error)

func (*Client) ExchangeAuthorizationCodeFor2faResultWithNonce

func (client *Client) ExchangeAuthorizationCodeFor2faResultWithNonce(duoCode string, username string, nonce string) (*TokenResponse, error)

Exchange the duo_code for a token with Duo to determine if the auth was successful.

func (*Client) GenerateState

func (client *Client) GenerateState() (string, error)

Return a cryptographically-secure string of random characters with the default length

func (*Client) GenerateStateWithLength

func (client *Client) GenerateStateWithLength(length int) (string, error)

Return a cryptographically-secure string of random characters suitable for use in state values. length is the number of characters in the randomly generated string

func (*Client) HealthCheck

func (client *Client) HealthCheck() (*HealthCheckResponse, error)

Checks whether or not Duo is available.

type FlagStatus added in v1.0.2

type FlagStatus int32
const (
	Disabled FlagStatus = iota
	Enabled
	Unknown = 99
)

func (FlagStatus) MarshalJSON added in v1.0.2

func (f FlagStatus) MarshalJSON() ([]byte, error)

func (*FlagStatus) UnmarshalJSON added in v1.0.2

func (f *FlagStatus) UnmarshalJSON(data []byte) error

type HealthCheckResponse

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

type HealthCheckTime

type HealthCheckTime struct {
	Time int `json:"time"`
}

type LocationInfo

type LocationInfo struct {
	City    string `json:"city"`
	Country string `json:"country"`
	State   string `json:"state"`
}

type MapClaims

type MapClaims map[string]interface{}

type TokenResponse

type TokenResponse struct {
	PreferredUsername string          `json:"preferred_username"`
	AuthTime          int             `json:"auth_time"`
	Nonce             string          `json:"nonce"`
	AuthResult        AuthResultInfo  `json:"auth_result"`
	AuthContext       AuthContextInfo `json:"auth_context"`
	Audience          string          `json:"aud"`
	ExpiresAt         int64           `json:"exp"`
	Id                string          `json:"jti"`
	IssuedAt          int64           `json:"iat"`
	Issuer            string          `json:"iss"`
	Subject           string          `json:"sub"`
}

type UserInfo

type UserInfo struct {
	Groups []string `json:"groups"`
	Key    string   `json:"key"`
	Name   string   `json:"name"`
}

Jump to

Keyboard shortcuts

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