Documentation
¶
Index ¶
- Constants
- func IsBadRequest(err error) bool
- func TryGetHTTPError(r *http.Response) error
- type AuthenticationFactor
- type EmailVerificationRequiredError
- type ErrorWithMessage
- type FactorType
- type FieldError
- type HTTPError
- type MFAChallengeError
- type MFAEnrollmentError
- type OrganizationAuthenticationMethodsRequiredError
- type OrganizationSelectionRequiredError
- type PendingAuthenticationOrganizationInfo
- type ResponseErrors
- type SSORequiredError
- type User
Constants ¶
const ( EmailVerificationRequiredCode = "email_verification_required" MFAEnrollmentCode = "mfa_enrollment" MFAChallengeCode = "mfa_challenge" OrganizationSelectionRequiredCode = "organization_selection_required" SSORequiredCode = "sso_required" OrganizationAuthenticationMethodsRequiredCode = "organization_authentication_methods_required" )
Authentication error code constants
Variables ¶
This section is empty.
Functions ¶
func IsBadRequest ¶
func TryGetHTTPError ¶
TryGetHTTPError returns an error when the http response contains invalid status code.
Types ¶
type AuthenticationFactor ¶
type AuthenticationFactor struct {
ID string `json:"id"`
Type FactorType `json:"type"`
}
AuthenticationFactor represents an MFA factor
type EmailVerificationRequiredError ¶
type EmailVerificationRequiredError struct {
HTTPError
Code string `json:"code"`
Message string `json:"message"`
Email string `json:"email"`
EmailVerificationID string `json:"email_verification_id"`
PendingAuthenticationToken string `json:"pending_authentication_token"`
}
EmailVerificationRequiredError occurs when a user with unverified email attempts authentication
func (EmailVerificationRequiredError) Error ¶
func (e EmailVerificationRequiredError) Error() string
type ErrorWithMessage ¶
type ErrorWithMessage struct {
Message string `json:"message"`
}
ErrorWithMessage struct to hold a single error with a message
type FactorType ¶
type FactorType string
FactorType represents the type of Authentication Factor
const ( SMS FactorType = "sms" TOTP FactorType = "totp" )
Constants that enumerate the available Types (matching mfa.FactorType)
type FieldError ¶
type HTTPError ¶
type HTTPError struct {
Code int
Status string
RequestID string
Message string
ErrorCode string
Errors []string
FieldErrors []FieldError
ErrorDescription string
RawBody string
PendingAuthenticationToken string
EmailVerificationID string
// Authentication error specific fields
AuthenticationFactors []AuthenticationFactor `json:"authentication_factors,omitempty"`
Organizations []PendingAuthenticationOrganizationInfo `json:"organizations,omitempty"`
ConnectionIDs []string `json:"connection_ids,omitempty"`
SSOConnectionIDs []string `json:"sso_connection_ids,omitempty"`
AuthMethods map[string]bool `json:"auth_methods,omitempty"`
User *common.User `json:"user,omitempty"`
}
HTTPError represents an http error.
type MFAChallengeError ¶
type MFAChallengeError struct {
HTTPError
Code string `json:"code"`
Message string `json:"message"`
User User `json:"user"`
AuthenticationFactors []AuthenticationFactor `json:"authentication_factors"`
PendingAuthenticationToken string `json:"pending_authentication_token"`
}
MFAChallengeError occurs when a user needs to complete MFA challenge
func (MFAChallengeError) Error ¶
func (e MFAChallengeError) Error() string
type MFAEnrollmentError ¶
type MFAEnrollmentError struct {
HTTPError
Code string `json:"code"`
Message string `json:"message"`
User User `json:"user"`
PendingAuthenticationToken string `json:"pending_authentication_token"`
}
MFAEnrollmentError occurs when a user needs to enroll in MFA
func (MFAEnrollmentError) Error ¶
func (e MFAEnrollmentError) Error() string
type OrganizationAuthenticationMethodsRequiredError ¶
type OrganizationAuthenticationMethodsRequiredError struct {
HTTPError
ErrorCode string `json:"error"`
ErrorDescription string `json:"error_description"`
Email string `json:"email"`
SSOConnectionIDs []string `json:"sso_connection_ids"`
AuthMethods map[string]bool `json:"auth_methods"`
PendingAuthenticationToken string `json:"pending_authentication_token"`
}
OrganizationAuthenticationMethodsRequiredError occurs when org restricts auth methods
func (OrganizationAuthenticationMethodsRequiredError) Error ¶
func (e OrganizationAuthenticationMethodsRequiredError) Error() string
type OrganizationSelectionRequiredError ¶
type OrganizationSelectionRequiredError struct {
HTTPError
Code string `json:"code"`
Message string `json:"message"`
User User `json:"user"`
Organizations []PendingAuthenticationOrganizationInfo `json:"organizations"`
PendingAuthenticationToken string `json:"pending_authentication_token"`
}
OrganizationSelectionRequiredError occurs when user must choose an organization
func (OrganizationSelectionRequiredError) Error ¶
func (e OrganizationSelectionRequiredError) Error() string
type PendingAuthenticationOrganizationInfo ¶
type PendingAuthenticationOrganizationInfo struct {
ID string `json:"id"`
Name string `json:"name"`
}
PendingAuthenticationOrganizationInfo represents an organization in selection error
type ResponseErrors ¶
type ResponseErrors []string
ResponseErrors is a custom type that can handle unmarshaling []string or []ErrorWithMessage
func (*ResponseErrors) UnmarshalJSON ¶
func (e *ResponseErrors) UnmarshalJSON(data []byte) error
type SSORequiredError ¶
type SSORequiredError struct {
HTTPError
ErrorCode string `json:"error"`
ErrorDescription string `json:"error_description"`
Email string `json:"email"`
ConnectionIDs []string `json:"connection_ids"`
PendingAuthenticationToken string `json:"pending_authentication_token"`
}
SSORequiredError occurs when user must authenticate via SSO
func (SSORequiredError) Error ¶
func (e SSORequiredError) Error() string