oath

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2017 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Request

type Request struct {
	UserID   string `json:"user_id,omitempty"`
	Password string `json:"password,omitempty"`
	Token    string `json:"token,omitempty"`
	FactorID string `json:"factor_id,omitempty"`
}

Request :

Request struct to build the required post parameters.

Fields:

[Required] UserId: the username that you want to submit access history for.
[Required] Password: The password of the user you are retrieving oath settings for.
[Required] Token: The otp of the user you are retrieving oath settings for.
[Required] FactorID: The id of the device you are retrieving oath settings for.

func (*Request) GetOATHSettings

func (r *Request) GetOATHSettings(c *sa.Client, userID string, password string, otp string, id string) (*Response, error)

GetOATHSettings :

Helper function to retrieve the oath settings for a given user.

Parameters:

[Required] c: passing in the client containing authorization and host information.
[Required] userID: the userID of the user whose oath settings you want.
[Required] password: the password of the user whose oath settings you want.
[Required] otp: the otp of the user whose oath settings you want.

Returns:

Response: Struct marshaled from the Json response from the API endpoints.
Error: If an error is encountered, response will be nil and the error must be handled.

func (*Request) Post

func (r *Request) Post(c *sa.Client) (*Response, error)

Post :

Executes a post to the oath endpoint.

Parameters:

[Required] r: should have all required fields of the struct populated before using.
[Required] c: passing in the client containing authorization and host information.

Returns:

Response: Struct marshaled from the Json response from the API endpoints.
Error: If an error is encountered, response will be nil and the error must be handled.

type Response

type Response struct {
	ServerTime    string         `json:"server_time,omitempty"`
	Key           string         `json:"key,omitempty"`
	Interval      string         `json:"interval,omitempty"`
	Length        string         `json:"length,omitempty"`
	Offset        string         `json:"offset,omitempty"`
	PinControl    string         `json:"pin_control,omitempty"`
	FailedWipe    string         `json:"failed_wipe,omitempty"`
	ScreenTimeout string         `json:"screen_timeout,omitempty"`
	RawJSON       string         `json:"-"`
	HTTPResponse  *http.Response `json:"-"`
}

Response :

Response struct that will be populated after the post request.

func (*Response) IsSignatureValid

func (r *Response) IsSignatureValid(c *sa.Client) (bool, error)

IsSignatureValid :

Helper function to validate the SecureAuth Response signature in X-SA-SIGNATURE

Parameters:

[Required] r: response struct with HTTPResponse
[Required] c: passing in the client with application id and key

Returns:

bool: if true, computed signature matches X-SA-SIGNATURE. if false, computed signature does not match.
error: If an error is encountered, bool will be false and the error must be handled.

Jump to

Keyboard shortcuts

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