Documentation ¶
Index ¶
- func GetPhonesExtension(ext string) func(*url.Values)
- func GetPhonesNumber(number string) func(*url.Values)
- func GetTokensTypeAndSerial(typ, serial string) func(*url.Values)
- func GetUsersUsername(name string) func(*url.Values)
- func Limit(limit uint64) func(*url.Values)
- func Offset(offset uint64) func(*url.Values)
- type AdminLog
- type AdminLogList
- type AdminLogResult
- type AuthLog
- type AuthLogList
- type AuthLogResult
- type Client
- func (c *Client) AssociateGroupWithUser(userID string, groupID string) (*duoapi.StatResult, error)
- func (c *Client) AssociateUserToken(userID, tokenID string) (*StringResult, error)
- func (c *Client) CreateUser(params url.Values) (*GetUserResult, error)
- func (c *Client) DeletePhone(phoneID string) (*duoapi.StatResult, error)
- func (c *Client) DeleteUser(userID string) (*duoapi.StatResult, error)
- func (c *Client) DisassociateGroupFromUser(userID string, groupID string) (*duoapi.StatResult, error)
- func (c *Client) GetAdminLogs(mintime time.Time, options ...func(*url.Values)) (*AdminLogResult, error)
- func (c *Client) GetAuthLogs(mintime time.Time, window time.Duration, options ...func(*url.Values)) (*AuthLogResult, error)
- func (c *Client) GetGroup(groupID string) (*GetGroupResult, error)
- func (c *Client) GetGroups(options ...func(*url.Values)) (*GetGroupsResult, error)
- func (c *Client) GetPhone(phoneID string) (*GetPhoneResult, error)
- func (c *Client) GetPhones(options ...func(*url.Values)) (*GetPhonesResult, error)
- func (c *Client) GetTelephonyLogs(mintime time.Time, options ...func(*url.Values)) (*TelephonyLogResult, error)
- func (c *Client) GetToken(tokenID string) (*GetTokenResult, error)
- func (c *Client) GetTokens(options ...func(*url.Values)) (*GetTokensResult, error)
- func (c *Client) GetU2FToken(registrationID string) (*GetU2FTokensResult, error)
- func (c *Client) GetU2FTokens(options ...func(*url.Values)) (*GetU2FTokensResult, error)
- func (c *Client) GetUser(userID string) (*GetUserResult, error)
- func (c *Client) GetUserBypassCodes(userID string, options ...func(*url.Values)) (*StringArrayResult, error)
- func (c *Client) GetUserGroups(userID string, options ...func(*url.Values)) (*GetGroupsResult, error)
- func (c *Client) GetUserPhones(userID string, options ...func(*url.Values)) (*GetPhonesResult, error)
- func (c *Client) GetUserTokens(userID string, options ...func(*url.Values)) (*GetTokensResult, error)
- func (c *Client) GetUserU2FTokens(userID string, options ...func(*url.Values)) (*GetU2FTokensResult, error)
- func (c *Client) GetUsers(options ...func(*url.Values)) (*GetUsersResult, error)
- func (c *Client) ModifyUser(userID string, params url.Values) (*GetUserResult, error)
- type GetGroupResult
- type GetGroupsResult
- type GetPhoneResult
- type GetPhonesResult
- type GetTokenResult
- type GetTokensResult
- type GetU2FTokensResult
- type GetUserResult
- type GetUsersResult
- type Group
- type ListResult
- type ListResultMetadata
- type LogListV2Metadata
- type Phone
- type StringArrayResult
- type StringResult
- type TelephonyLog
- type TelephonyLogList
- type TelephonyLogResult
- type Token
- type U2FToken
- type User
- type WebAuthnToken
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetPhonesExtension ¶
GetPhonesExtension sets the optional extension parameter for a GetPhones request.
func GetPhonesNumber ¶
GetPhonesNumber sets the optional number parameter for a GetPhones request.
func GetTokensTypeAndSerial ¶
GetTokensTypeAndSerial sets the optional type and serial parameters for a GetTokens request.
func GetUsersUsername ¶
GetUsersUsername sets the optional username parameter for a GetUsers request.
Types ¶
type AdminLog ¶
type AdminLog map[string]interface{}
An AdminLog retrieved from https://duo.com/docs/adminapi#administrator-logs TODO: @Duo update this to be a struct based on the returned JSON structure of an admin log.
type AdminLogList ¶
type AdminLogList []AdminLog
An AdminLogList holds log entries and provides functionality used for pagination.
func (AdminLogList) GetNextOffset ¶
func (logs AdminLogList) GetNextOffset(maxtime time.Time) func(params *url.Values)
GetNextOffset uses log timestamps to return an option that will configure a request to fetch the next page of logs. It returns nil when no more logs can be fetched.
type AdminLogResult ¶
type AdminLogResult struct { duoapi.StatResult Logs AdminLogList `json:"response"` }
AdminLogResult is the structured JSON result of GetAdminLogs (for the V1 API).
type AuthLog ¶
type AuthLog map[string]interface{}
An AuthLog retrieved from https://duo.com/docs/adminapi#authentication-logs TODO: @Duo update this to be a struct based on the returned JSON structure of an authentication log.
type AuthLogList ¶
type AuthLogList struct { Metadata LogListV2Metadata `json:"metadata"` Logs []AuthLog `json:"authlogs"` }
An AuthLogList holds retreived logs and V2 metadata used for pagination.
type AuthLogResult ¶
type AuthLogResult struct { duoapi.StatResult Response AuthLogList `json:"response"` }
AuthLogResult is the structured JSON result of GetAuthLogs (for the V2 API).
type Client ¶
Client provides access to Duo's admin API.
func (*Client) AssociateGroupWithUser ¶
AssociateGroupWithUser calls POST /admin/v1/users/:user_id/groups See https://duo.com/docs/adminapi#associate-group-with-user
func (*Client) AssociateUserToken ¶
func (c *Client) AssociateUserToken(userID, tokenID string) (*StringResult, error)
AssociateUserToken calls POST /admin/v1/users/:user_id/tokens See https://duo.com/docs/adminapi#associate-hardware-token-with-user
func (*Client) CreateUser ¶
func (c *Client) CreateUser(params url.Values) (*GetUserResult, error)
CreateUser calls POST /admin/v1/users See https://duo.com/docs/adminapi#create-user
func (*Client) DeletePhone ¶
func (c *Client) DeletePhone(phoneID string) (*duoapi.StatResult, error)
DeletePhone calls DELETE /admin/v1/phones/:phone_id See https://duo.com/docs/adminapi#delete-phone
func (*Client) DeleteUser ¶
func (c *Client) DeleteUser(userID string) (*duoapi.StatResult, error)
DeleteUser calls DELETE /admin/v1/users/:user_id See https://duo.com/docs/adminapi#delete-user
func (*Client) DisassociateGroupFromUser ¶
func (c *Client) DisassociateGroupFromUser(userID string, groupID string) (*duoapi.StatResult, error)
DisassociateGroupFromUser calls POST /admin/v1/users/:user_id/groups See https://duo.com/docs/adminapi#disassociate-group-from-user
func (*Client) GetAdminLogs ¶
func (c *Client) GetAdminLogs(mintime time.Time, options ...func(*url.Values)) (*AdminLogResult, error)
GetAdminLogs retrieves a page of admin logs with timestamps starting at mintime. It relies on the option provided by AdminLogResult.Logs.GetNextOffset() for pagination. Calls GET /admin/v1/logs/administrator See https://duo.com/docs/adminapi#administrator-logs
func (*Client) GetAuthLogs ¶
func (c *Client) GetAuthLogs(mintime time.Time, window time.Duration, options ...func(*url.Values)) (*AuthLogResult, error)
GetAuthLogs retrieves a page of authentication logs within the time range starting at mintime and ending at mintime + window. It relies on the option provided by AuthLogResult.Metadata.GetNextOffset() for pagination. Calls GET /admin/v2/logs/authentication See https://duo.com/docs/adminapi#authentication-logs
func (*Client) GetGroup ¶
func (c *Client) GetGroup(groupID string) (*GetGroupResult, error)
GetGroup calls GET /admin/v2/group/:group_id See https://duo.com/docs/adminapi#get-group-info
func (*Client) GetGroups ¶
func (c *Client) GetGroups(options ...func(*url.Values)) (*GetGroupsResult, error)
GetGroups calls GET /admin/v1/groups See https://duo.com/docs/adminapi#retrieve-groups
func (*Client) GetPhone ¶
func (c *Client) GetPhone(phoneID string) (*GetPhoneResult, error)
GetPhone calls GET /admin/v1/phones/:phone_id See https://duo.com/docs/adminapi#retrieve-phone-by-id
func (*Client) GetPhones ¶
func (c *Client) GetPhones(options ...func(*url.Values)) (*GetPhonesResult, error)
GetPhones calls GET /admin/v1/phones See https://duo.com/docs/adminapi#phones
func (*Client) GetTelephonyLogs ¶
func (c *Client) GetTelephonyLogs(mintime time.Time, options ...func(*url.Values)) (*TelephonyLogResult, error)
GetTelephonyLogs retrieves a page of telephony logs with timestamps starting at mintime. It relies on the option provided by TelephonyLogResult.Logs.GetNextOffset() for pagination. Calls GET /admin/v1/logs/telephony See https://duo.com/docs/adminapi#telephony-logs
func (*Client) GetToken ¶
func (c *Client) GetToken(tokenID string) (*GetTokenResult, error)
GetToken calls GET /admin/v1/tokens/:token_id See https://duo.com/docs/adminapi#retrieve-hardware-tokens
func (*Client) GetTokens ¶
func (c *Client) GetTokens(options ...func(*url.Values)) (*GetTokensResult, error)
GetTokens calls GET /admin/v1/tokens See https://duo.com/docs/adminapi#retrieve-hardware-tokens
func (*Client) GetU2FToken ¶
func (c *Client) GetU2FToken(registrationID string) (*GetU2FTokensResult, error)
GetU2FToken calls GET /admin/v1/u2ftokens/:registration_id See https://duo.com/docs/adminapi#retrieve-u2f-token-by-id
func (*Client) GetU2FTokens ¶
func (c *Client) GetU2FTokens(options ...func(*url.Values)) (*GetU2FTokensResult, error)
GetU2FTokens calls GET /admin/v1/u2ftokens See https://duo.com/docs/adminapi#retrieve-u2f-tokens
func (*Client) GetUser ¶
func (c *Client) GetUser(userID string) (*GetUserResult, error)
GetUser calls GET /admin/v1/users/:user_id See https://duo.com/docs/adminapi#retrieve-user-by-id
func (*Client) GetUserBypassCodes ¶
func (c *Client) GetUserBypassCodes(userID string, options ...func(*url.Values)) (*StringArrayResult, error)
GetUserBypassCodes calls POST /admin/v1/users/:user_id/bypass_codes see https://duo.com/docs/adminapi#create-bypass-codes-for-user
func (*Client) GetUserGroups ¶
func (c *Client) GetUserGroups(userID string, options ...func(*url.Values)) (*GetGroupsResult, error)
GetUserGroups calls GET /admin/v1/users/:user_id/groups See https://duo.com/docs/adminapi#retrieve-groups-by-user-id
func (*Client) GetUserPhones ¶
func (c *Client) GetUserPhones(userID string, options ...func(*url.Values)) (*GetPhonesResult, error)
GetUserPhones calls GET /admin/v1/users/:user_id/phones See https://duo.com/docs/adminapi#retrieve-phones-by-user-id
func (*Client) GetUserTokens ¶
func (c *Client) GetUserTokens(userID string, options ...func(*url.Values)) (*GetTokensResult, error)
GetUserTokens calls GET /admin/v1/users/:user_id/tokens See https://duo.com/docs/adminapi#retrieve-hardware-tokens-by-user-id
func (*Client) GetUserU2FTokens ¶
func (c *Client) GetUserU2FTokens(userID string, options ...func(*url.Values)) (*GetU2FTokensResult, error)
GetUserU2FTokens calls GET /admin/v1/users/:user_id/u2ftokens See https://duo.com/docs/adminapi#retrieve-u2f-tokens-by-user-id
func (*Client) GetUsers ¶
func (c *Client) GetUsers(options ...func(*url.Values)) (*GetUsersResult, error)
GetUsers calls GET /admin/v1/users See https://duo.com/docs/adminapi#retrieve-users
func (*Client) ModifyUser ¶
ModifyUser calls POST /admin/v1/users/:user_id See https://duo.com/docs/adminapi#modify-user
type GetGroupResult ¶
type GetGroupResult struct { duoapi.StatResult Response Group }
GetGroupResult models responses containing a single group.
type GetGroupsResult ¶
type GetGroupsResult struct { duoapi.StatResult ListResult Response []Group }
GetGroupsResult models responses containing a list of groups.
type GetPhoneResult ¶
type GetPhoneResult struct { duoapi.StatResult Response Phone }
GetPhoneResult models responses containing a single phone.
type GetPhonesResult ¶
type GetPhonesResult struct { duoapi.StatResult ListResult Response []Phone }
GetPhonesResult models responses containing a list of phones.
type GetTokenResult ¶
type GetTokenResult struct { duoapi.StatResult Response Token }
GetTokenResult models responses containing a single token.
type GetTokensResult ¶
type GetTokensResult struct { duoapi.StatResult ListResult Response []Token }
GetTokensResult models responses containing a list of tokens.
type GetU2FTokensResult ¶
type GetU2FTokensResult struct { duoapi.StatResult ListResult Response []U2FToken }
GetU2FTokensResult models responses containing a list of U2F tokens.
type GetUserResult ¶
type GetUserResult struct { duoapi.StatResult Response User }
GetUserResult models responses containing a single user.
type GetUsersResult ¶
type GetUsersResult struct { duoapi.StatResult ListResult Response []User }
GetUsersResult models responses containing a list of users.
type Group ¶
type Group struct { Desc string GroupID string `json:"group_id"` MobileOTPEnabled bool `json:"mobile_otp_enabled"` Name string PushEnabled bool `json:"push_enabled"` SMSEnabled bool `json:"sms_enabled"` Status string VoiceEnabled bool `json:"voice_enabled"` }
Group models a group to which users may belong.
type ListResult ¶
type ListResult struct {
Metadata ListResultMetadata `json:"metadata"`
}
type ListResultMetadata ¶
type LogListV2Metadata ¶
type LogListV2Metadata struct {
NextOffset []string `json:"next_offset"`
}
LogListV2Metadata holds pagination metadata for API V2 log endpoints.
func (LogListV2Metadata) GetNextOffset ¶
func (metadata LogListV2Metadata) GetNextOffset() func(params *url.Values)
GetNextOffset uses response metadata to return an option that will configure a request to fetch the next page of logs. It returns nil when no more logs can be fetched.
type Phone ¶
type Phone struct { Activated bool Capabilities []string Encrypted string Extension string Fingerprint string LastSeen string `json:"last_seen"` Model string Name string Number string PhoneID string `json:"phone_id"` Platform string Postdelay string Predelay string Screenlock string SMSPasscodesSent bool Type string Users []User }
Phone models a user's phone.
type StringArrayResult ¶
type StringArrayResult struct { duoapi.StatResult Response []string }
StringArrayResult models response containing an array of strings.
type StringResult ¶
type StringResult struct { duoapi.StatResult Response string }
StringResult models responses containing a simple string.
type TelephonyLog ¶
type TelephonyLog map[string]interface{}
A TelephonyLog retrieved from https://duo.com/docs/adminapi#telephony-logs TODO: @Duo update this to be a struct based on the returned JSON structure of a telephony log.
type TelephonyLogList ¶
type TelephonyLogList []TelephonyLog
An TelephonyLogList holds log entries and provides functionality used for pagination.
func (TelephonyLogList) GetNextOffset ¶
func (logs TelephonyLogList) GetNextOffset(maxtime time.Time) func(params *url.Values)
GetNextOffset uses log timestamps to return an option that will configure a request to fetch the next page of logs. It returns nil when no more logs can be fetched.
type TelephonyLogResult ¶
type TelephonyLogResult struct { duoapi.StatResult Logs TelephonyLogList `json:"response"` }
TelephonyLogResult is the structured JSON result of GetTelephonyLogs (for the V1 API).
type Token ¶
type Token struct { TokenID string `json:"token_id"` Type string Serial string TOTPStep *int `json:"totp_step"` Users []User }
Token models a hardware security token.
type U2FToken ¶
type U2FToken struct { DateAdded uint64 `json:"date_added"` RegistrationID string `json:"registration_id"` User *User }
U2FToken models a U2F security token.
type User ¶
type User struct { Alias1 *string `json:"alias1" url:"alias1"` Alias2 *string `json:"alias2" url:"alias2"` Alias3 *string `json:"alias3" url:"alias3"` Alias4 *string `json:"alias4" url:"alias4"` Created uint64 `json:"created"` Email string `json:"email" url:"email"` FirstName *string `json:"firstname" url:"firstname"` Groups []Group `json:"groups"` IsEnrolled bool `json:"is_enrolled"` LastDirectorySync *uint64 `json:"last_directory_sync"` LastLogin *uint64 `json:"last_login"` LastName *string `json:"lastname" url:"lastname"` LockoutReason *string `json:"lockout_reason"` Notes string `json:"notes" url:"notes"` Phones []Phone `json:"phones"` RealName *string `json:"realname" url:"realname"` Status string `json:"status" url:"status"` Tokens []Token `json:"tokens"` U2FTokens []U2FToken `json:"u2ftokens"` UserID string `json:"user_id"` Username string `json:"username" url:"username"` WebAuthnTokens []WebAuthnToken `json:"webauthncredentials"` }
User models a single user.