auth

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: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PushAcceptDetails

type PushAcceptDetails struct {
	CompanyName string `json:"company_name"`
	AppDesc     string `json:"application_description"`
	EnduserIP   string `json:"enduser_ip"`
}

PushAcceptDetails :

Details for the push_accept request.

Fields:

CompanyName: Displayed on the push to accept request.
AppDesc: Displayed on the push to accept request.
EnduserIP: Displayed on the push to accept request.

type Request

type Request struct {
	UserID      string             `json:"user_id"`
	ReqType     string             `json:"type"`
	Token       string             `json:"token,omitempty"`
	FactorID    string             `json:"factor_id,omitempty"`
	PushDetails *PushAcceptDetails `json:"push_accept_details,omitempty"`
	EvaluateNum bool               `json:"evaluate_number,omitempty"`
}

Request :

Request struct to build the required post parameters.

Fields:

[Required] UserId: the username that you want to submit access history for.
[Required] ReqType: type of auth request, valid entries: user_id, password, kba, oath,
	   pin, call, sms, email, push, push_accept, help_desk
Token: used to pass data for validation
[Required] FactorID: identifier to which attribute in the users profile the request type
	   should use. Also referred to as device id.
PushDetails: if ReqType is push_accept, push details will allow details of the auth attempt
	   to be sent with the push request.
EvaluateNum: if true, number profile evaluation will be performed. Only applicable for call
	   and sms auth request types

func (*Request) CheckPushAcceptStatus

func (r *Request) CheckPushAcceptStatus(c *sa.Client, refID string, timeout int, interval int) (*Response, error)

CheckPushAcceptStatus :

Helper function to check on the accept/deny status of a push to accept.

Parameters:

[Required] c: passing in the client containing authorization and host information.
[Required] refId: the reference id returned by the auth end point when the type is push_accept
[Required] timeout: the amount of time (in seconds) the check should run before failing.
[Required] interval: the frequency (in seconds) in which the api call to check the push status will run.
	   Recommended not to go lower than 5 (seconds)

func (*Request) Get

func (r *Request) Get(c *sa.Client, refID string) (*Response, error)

Get :

Executes a get request for checking push to accept status.

Parameters:

[Required] r: empty struct used to make Get easy.
[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.

func (*Request) Post

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

Post :

Executes a post to the auth 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.

func (*Request) SendCallOtp

func (r *Request) SendCallOtp(c *sa.Client, userID string, factorID string) (*Response, error)

SendCallOtp :

Helper function to send otp via phone call through auth endpoint posts.

Parameters:

[Required] c: passing in the client containing authorization and host information.
[Required] userID: the userID of the user the call will be sent to.
[Required] factorID: from factor_id of a user endpoint call. Identifier of the profile
	   attribute that the call should be sent to.

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) SendCallOtpWithEval

func (r *Request) SendCallOtpWithEval(c *sa.Client, userID string, factorID string) (*Response, error)

SendCallOtpWithEval :

Helper function to send otp via phone call with number profile evaluation through auth endpoint posts.

Parameters:

[Required] c: passing in the client containing authorization and host information.
[Required] userID: the userID of the user the call will be sent to.
[Required] factorID: from factor_id of a user endpoint call. Identifier of the profile
	   attribute that the call should be sent to.

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) SendEmailOtp

func (r *Request) SendEmailOtp(c *sa.Client, userID string, factorID string) (*Response, error)

SendEmailOtp :

Helper function to send otp via email through auth endpoint posts.

Parameters:

[Required] c: passing in the client containing authorization and host information.
[Required] userID: the userID of the user the email will be sent to.
[Required] factorID: from factor_id of a user endpoint email. Identifier of the profile
	   attribute that the email should be sent to.

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) SendHelpDesk

func (r *Request) SendHelpDesk(c *sa.Client, userID string, factorID string) (*Response, error)

SendHelpDesk :

Helper function to send otp to a help_desk agent via the auth endpoint posts.

Parameters:

[Required] c: passing in the client containing authorization and host information.
[Required] userID: the userID of the user requesting the help_desk method.
[Required] factorID: from factor_id of the user endpoint, the help_desk option.

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) SendOtpAdHoc

func (r *Request) SendOtpAdHoc(c *sa.Client, userID string, token string, reqType string, eval bool) (*Response, error)

SendOtpAdHoc :

Helper function for making ad-hoc otp deliveries to phone numbers or email address not in the backing datastore.

Parameters:

[Required] c: passing in the client containing authorization and host information.
[Required] userID: the userID of the user you wish to validate.
[Required] token: the number or email address the OTP will be delivered to.
[Required] reqType: the type of delivery method to be used. Only call, sms, or email are valid.
[Required] eval: if true, perform number profile evaluation against the provided token. Only valid for call and sms reqTypes.

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) SendPushAccept

func (r *Request) SendPushAccept(c *sa.Client, userID string, deviceID string, companyName string, appDesc string, userIP string) (*Response, error)

SendPushAccept :

Helper function to send otp via push notification through auth endpoint posts.

Parameters:

[Required] c: passing in the client containing authorization and host information.
[Required] userID: the userID of the user the push to accept will be sent to.
[Required] deviceId: from factor_id of the user endpoint, the device identifier which is registered.
companyName: Displayed on the push to accept request.
appDesc: Displayed on the push to accept request.
userIp: Displayed on the push to accept request.

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) SendPushNotify

func (r *Request) SendPushNotify(c *sa.Client, userID string, deviceID string) (*Response, error)

SendPushNotify :

Helper function to send otp via push notification through auth endpoint posts.

Parameters:

[Required] c: passing in the client containing authorization and host information.
[Required] userID: the userID of the user the push notification will be sent to.
[Required] deviceId: from factor_id of the user endpoint, the device identifier which is registered.

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) SendSMSOtp

func (r *Request) SendSMSOtp(c *sa.Client, userID string, factorID string) (*Response, error)

SendSMSOtp :

Helper function to send otp via sms through auth endpoint posts.

Parameters:

[Required] c: passing in the client containing authorization and host information.
[Required] userID: the userID of the user the sms will be sent to.
[Required] factorID: from factor_id of a user endpoint sms. Identifier of the profile
	   attribute that the sms should be sent to.

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) SendSMSOtpWithEval

func (r *Request) SendSMSOtpWithEval(c *sa.Client, userID string, factorID string) (*Response, error)

SendSMSOtpWithEval :

Helper function to send otp via sms with number profile evaluation through auth endpoint posts.

Parameters:

[Required] c: passing in the client containing authorization and host information.
[Required] userID: the userID of the user the sms will be sent to.
[Required] factorID: from factor_id of a user endpoint sms. Identifier of the profile
	   attribute that the sms should be sent to.

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) ValidateKba

func (r *Request) ValidateKba(c *sa.Client, userID string, answer string, kbqID string) (*Response, error)

ValidateKba :

Helper function for making Validate Kba auth endpoint posts.

Parameters:

[Required] c: passing in the client containing authorization and host information.
[Required] userID: the userID of the user you wish to validate.
[Required] answer: the answer for the kbq value you want to validate.
[Required] kbqId: the id of the kbq the answer will be validated against.

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) ValidateOath

func (r *Request) ValidateOath(c *sa.Client, userID string, oathOTP string, deviceID string) (*Response, error)

ValidateOath :

Helper function for making Validate Oath auth endpoint posts.

Parameters:

[Required] c: passing in the client containing authorization and host information.
[Required] userID: the userID of the user you wish to validate.
[Required] oathOtp: the otp value to be validated.
[Required] deviceId: from factor_id of the user endpoint, the device identifier to which Oath is registered to.

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) ValidatePassword

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

ValidatePassword :

Helper function for making Validate Password auth endpoint posts.

Parameters:

[Required] c: passing in the client containing authorization and host information.
[Required] userID: the userID of the user you wish to validate.
[Required] password: the password of the user you wish to validate.

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) ValidatePin

func (r *Request) ValidatePin(c *sa.Client, userID string, pin string) (*Response, error)

ValidatePin :

Helper function for making Validate Pin auth endpoint posts.

Parameters:

[Required] c: passing in the client containing authorization and host information.
[Required] userID: the userID of the user you wish to validate.
[Required] pin: the pin to be validated.

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) ValidateUser

func (r *Request) ValidateUser(c *sa.Client, userID string) (*Response, error)

ValidateUser :

Helper function for making Validate User auth endpoint posts.

Parameters:

[Required] c: passing in the client containing authorization and host information.
[Required] userID: the userID of the user you wish to validate.

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 {
	RefID        string         `json:"reference_id,omitempty"`
	Status       string         `json:"status"`
	Message      string         `json:"message"`
	UserID       string         `json:"user_id,omitempty"`
	OTP          string         `json:"otp,omitempty"`
	RawJSON      string         `json:"-"`
	HTTPResponse *http.Response `json:"-"`
}

Response :

Response struct that will be populated after the post request.

func (*Response) IsSignatureValid added in v1.1.0

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