Documentation
¶
Index ¶
- Constants
- Variables
- func MakeBadRequest(err error) *goa.ServiceError
- func MakeForbidden(err error) *goa.ServiceError
- func MakeInternalServerError(err error) *goa.ServiceError
- func MakeNotFound(err error) *goa.ServiceError
- func MakeUnauthorized(err error) *goa.ServiceError
- func NewChangePasswordEndpoint(s Service, authJWTFn security.AuthJWTFunc, ...) goa.Endpoint
- func NewCheckEmailAvailableEndpoint(s Service, authAPIKeyFn security.AuthAPIKeyFunc) goa.Endpoint
- func NewCheckPhoneAvailableEndpoint(s Service, authAPIKeyFn security.AuthAPIKeyFunc) goa.Endpoint
- func NewConfirmResetEndpoint(s Service, authAPIKeyFn security.AuthAPIKeyFunc) goa.Endpoint
- func NewLoginEndpoint(s Service, authAPIKeyFn security.AuthAPIKeyFunc) goa.Endpoint
- func NewRegisterEndpoint(s Service, authAPIKeyFn security.AuthAPIKeyFunc) goa.Endpoint
- func NewRemoveEndpoint(s Service, authJWTFn security.AuthJWTFunc, ...) goa.Endpoint
- func NewResetEndpoint(s Service, authAPIKeyFn security.AuthAPIKeyFunc) goa.Endpoint
- func NewViewedUserMedia(res *UserMedia, view string) *passwordauthviews.UserMedia
- type Auther
- type ChangePasswordParams
- type CheckEmailAvailablePayload
- type CheckPhoneAvailablePayload
- type Client
- func (c *Client) ChangePassword(ctx context.Context, p *ChangePasswordParams) (err error)
- func (c *Client) CheckEmailAvailable(ctx context.Context, p *CheckEmailAvailablePayload) (res bool, err error)
- func (c *Client) CheckPhoneAvailable(ctx context.Context, p *CheckPhoneAvailablePayload) (res bool, err error)
- func (c *Client) ConfirmReset(ctx context.Context, p *ResetPasswordParams) (err error)
- func (c *Client) Login(ctx context.Context, p *LoginParams) (res *UserMedia, err error)
- func (c *Client) Register(ctx context.Context, p *RegisterParams) (res *UserMedia, err error)
- func (c *Client) Remove(ctx context.Context, p *RemovePayload) (err error)
- func (c *Client) Reset(ctx context.Context, p *ResetPayload) (err error)
- type Endpoints
- type LoginParams
- type RegisterParams
- type RemovePayload
- type ResetPasswordParams
- type ResetPayload
- type Service
- type UserMedia
Constants ¶
const ServiceName = "password-auth"
ServiceName is the name of the service as defined in the design. This is the same value that is set in the endpoint request contexts under the ServiceKey key.
Variables ¶
var MethodNames = [8]string{"register", "login", "remove", "change-password", "reset", "confirm-reset", "check-email-available", "check-phone-available"}
MethodNames lists the service method names as defined in the design. These are the same values that are set in the endpoint request contexts under the MethodKey key.
Functions ¶
func MakeBadRequest ¶
func MakeBadRequest(err error) *goa.ServiceError
MakeBadRequest builds a goa.ServiceError from an error.
func MakeForbidden ¶
func MakeForbidden(err error) *goa.ServiceError
MakeForbidden builds a goa.ServiceError from an error.
func MakeInternalServerError ¶
func MakeInternalServerError(err error) *goa.ServiceError
MakeInternalServerError builds a goa.ServiceError from an error.
func MakeNotFound ¶
func MakeNotFound(err error) *goa.ServiceError
MakeNotFound builds a goa.ServiceError from an error.
func MakeUnauthorized ¶
func MakeUnauthorized(err error) *goa.ServiceError
MakeUnauthorized builds a goa.ServiceError from an error.
func NewChangePasswordEndpoint ¶
func NewChangePasswordEndpoint(s Service, authJWTFn security.AuthJWTFunc, authAPIKeyFn security.AuthAPIKeyFunc) goa.Endpoint
NewChangePasswordEndpoint returns an endpoint function that calls the method "change-password" of service "password-auth".
func NewCheckEmailAvailableEndpoint ¶
func NewCheckEmailAvailableEndpoint(s Service, authAPIKeyFn security.AuthAPIKeyFunc) goa.Endpoint
NewCheckEmailAvailableEndpoint returns an endpoint function that calls the method "check-email-available" of service "password-auth".
func NewCheckPhoneAvailableEndpoint ¶
func NewCheckPhoneAvailableEndpoint(s Service, authAPIKeyFn security.AuthAPIKeyFunc) goa.Endpoint
NewCheckPhoneAvailableEndpoint returns an endpoint function that calls the method "check-phone-available" of service "password-auth".
func NewConfirmResetEndpoint ¶
func NewConfirmResetEndpoint(s Service, authAPIKeyFn security.AuthAPIKeyFunc) goa.Endpoint
NewConfirmResetEndpoint returns an endpoint function that calls the method "confirm-reset" of service "password-auth".
func NewLoginEndpoint ¶
func NewLoginEndpoint(s Service, authAPIKeyFn security.AuthAPIKeyFunc) goa.Endpoint
NewLoginEndpoint returns an endpoint function that calls the method "login" of service "password-auth".
func NewRegisterEndpoint ¶
func NewRegisterEndpoint(s Service, authAPIKeyFn security.AuthAPIKeyFunc) goa.Endpoint
NewRegisterEndpoint returns an endpoint function that calls the method "register" of service "password-auth".
func NewRemoveEndpoint ¶
func NewRemoveEndpoint(s Service, authJWTFn security.AuthJWTFunc, authAPIKeyFn security.AuthAPIKeyFunc) goa.Endpoint
NewRemoveEndpoint returns an endpoint function that calls the method "remove" of service "password-auth".
func NewResetEndpoint ¶
func NewResetEndpoint(s Service, authAPIKeyFn security.AuthAPIKeyFunc) goa.Endpoint
NewResetEndpoint returns an endpoint function that calls the method "reset" of service "password-auth".
func NewViewedUserMedia ¶
func NewViewedUserMedia(res *UserMedia, view string) *passwordauthviews.UserMedia
NewViewedUserMedia initializes viewed result type UserMedia from result type UserMedia using the given view.
Types ¶
type Auther ¶
type Auther interface {
// APIKeyAuth implements the authorization logic for the APIKey security scheme.
APIKeyAuth(ctx context.Context, key string, schema *security.APIKeyScheme) (context.Context, error)
// JWTAuth implements the authorization logic for the JWT security scheme.
JWTAuth(ctx context.Context, token string, schema *security.JWTScheme) (context.Context, error)
}
Auther defines the authorization functions to be implemented by the service.
type ChangePasswordParams ¶
type ChangePasswordParams struct {
// The old password for the current user account
OldPassword *string
// The new password for the current user account
NewPassword string
Authorization string
XSession string
APIKey *string
}
ChangePasswordParams is the payload type of the password-auth service change-password method.
type CheckEmailAvailablePayload ¶
CheckEmailAvailablePayload is the payload type of the password-auth service check-email-available method.
type CheckPhoneAvailablePayload ¶
CheckPhoneAvailablePayload is the payload type of the password-auth service check-phone-available method.
type Client ¶
type Client struct {
RegisterEndpoint goa.Endpoint
LoginEndpoint goa.Endpoint
RemoveEndpoint goa.Endpoint
ChangePasswordEndpoint goa.Endpoint
ResetEndpoint goa.Endpoint
ConfirmResetEndpoint goa.Endpoint
CheckEmailAvailableEndpoint goa.Endpoint
CheckPhoneAvailableEndpoint goa.Endpoint
}
Client is the "password-auth" service client.
func NewClient ¶
func NewClient(register, login, remove, changePassword, reset, confirmReset, checkEmailAvailable, checkPhoneAvailable goa.Endpoint) *Client
NewClient initializes a "password-auth" service client given the endpoints.
func (*Client) ChangePassword ¶
func (c *Client) ChangePassword(ctx context.Context, p *ChangePasswordParams) (err error)
ChangePassword calls the "change-password" endpoint of the "password-auth" service. ChangePassword may return the following errors:
- "BadRequest" (type *goa.ServiceError)
- "InternalServerError" (type *goa.ServiceError)
- error: internal error
func (*Client) CheckEmailAvailable ¶
func (c *Client) CheckEmailAvailable(ctx context.Context, p *CheckEmailAvailablePayload) (res bool, err error)
CheckEmailAvailable calls the "check-email-available" endpoint of the "password-auth" service. CheckEmailAvailable may return the following errors:
- "InternalServerError" (type *goa.ServiceError)
- error: internal error
func (*Client) CheckPhoneAvailable ¶
func (c *Client) CheckPhoneAvailable(ctx context.Context, p *CheckPhoneAvailablePayload) (res bool, err error)
CheckPhoneAvailable calls the "check-phone-available" endpoint of the "password-auth" service. CheckPhoneAvailable may return the following errors:
- "InternalServerError" (type *goa.ServiceError)
- error: internal error
func (*Client) ConfirmReset ¶
func (c *Client) ConfirmReset(ctx context.Context, p *ResetPasswordParams) (err error)
ConfirmReset calls the "confirm-reset" endpoint of the "password-auth" service. ConfirmReset may return the following errors:
- "Forbidden" (type *goa.ServiceError)
- "InternalServerError" (type *goa.ServiceError)
- error: internal error
func (*Client) Login ¶
Login calls the "login" endpoint of the "password-auth" service. Login may return the following errors:
- "Unauthorized" (type *goa.ServiceError)
- "BadRequest" (type *goa.ServiceError)
- "InternalServerError" (type *goa.ServiceError)
- error: internal error
func (*Client) Register ¶
Register calls the "register" endpoint of the "password-auth" service. Register may return the following errors:
- "BadRequest" (type *goa.ServiceError)
- "Forbidden" (type *goa.ServiceError)
- "InternalServerError" (type *goa.ServiceError)
- error: internal error
func (*Client) Remove ¶
func (c *Client) Remove(ctx context.Context, p *RemovePayload) (err error)
Remove calls the "remove" endpoint of the "password-auth" service. Remove may return the following errors:
- "NotFound" (type *goa.ServiceError)
- "Forbidden" (type *goa.ServiceError)
- "InternalServerError" (type *goa.ServiceError)
- error: internal error
type Endpoints ¶
type Endpoints struct {
Register goa.Endpoint
Login goa.Endpoint
Remove goa.Endpoint
ChangePassword goa.Endpoint
Reset goa.Endpoint
ConfirmReset goa.Endpoint
CheckEmailAvailable goa.Endpoint
CheckPhoneAvailable goa.Endpoint
}
Endpoints wraps the "password-auth" service endpoints.
func NewEndpoints ¶
NewEndpoints wraps the methods of the "password-auth" service with endpoints.
type LoginParams ¶
type LoginParams struct {
// The email address of the account to login to
Email string
// The password of the account to login to
Password string
// 2 Factor Auth if user has enabled the feature
TwoFactor *string
Token *string
APIKey *string
}
LoginParams is the payload type of the password-auth service login method.
type RegisterParams ¶
type RegisterParams struct {
// The email that will be attached to the account
Email string
// The user's given name
FirstName string
// The user's family name
LastName string
// The password associated with the new account
Password string
// The user's phone number
Phone *string
// The recaptcha response code
GRecaptchaResponse string
Authorization *string
XSession *string
APIKey *string
}
RegisterParams is the payload type of the password-auth service register method.
type RemovePayload ¶
RemovePayload is the payload type of the password-auth service remove method.
type ResetPasswordParams ¶
type ResetPasswordParams struct {
// The UUID of the password reset, send from the user's email
ResetCode string
// The ID of the user to reset the password of
UserID string
// The new password that will be used to login to the account
NewPassword string
APIKey *string
}
ResetPasswordParams is the payload type of the password-auth service confirm-reset method.
type ResetPayload ¶
ResetPayload is the payload type of the password-auth service reset method.
type Service ¶
type Service interface {
// Register a new user with an email and password
Register(context.Context, *RegisterParams) (res *UserMedia, err error)
// Login a user using an email and password
Login(context.Context, *LoginParams) (res *UserMedia, err error)
// Removes using a password as a login method
Remove(context.Context, *RemovePayload) (err error)
// Changes the user's current password to a new one, also adds a password to
// the account if there is none
ChangePassword(context.Context, *ChangePasswordParams) (err error)
// Send an email to user to get a password reset, responds with no content even
// if the email is not on any user account
Reset(context.Context, *ResetPayload) (err error)
// Confirms that a reset has been completed and changes the password to the new
// one passed in
ConfirmReset(context.Context, *ResetPasswordParams) (err error)
// Checks if an email is available for signup
CheckEmailAvailable(context.Context, *CheckEmailAvailablePayload) (res bool, err error)
// Checks if an phone is available for signup
CheckPhoneAvailable(context.Context, *CheckPhoneAvailablePayload) (res bool, err error)
}
Service is the password-auth service interface.
type UserMedia ¶
type UserMedia struct {
// Unique unchanging user ID
ID string
// Given name for the user
FirstName string
// Family name for the user
LastName string
// Email attached to the account of the user
Email string
// Phone Number Of the user
Phone string
// When the user attempts to change their email, this is what they will change
// it to after they verify that it belongs to them
ChangingEmail *string
// Whether the user has verified their email
VerifiedEmail bool
// Whether the user is an administrator on the site
IsAdmin *bool
UpdatedAt *string
IsActive *bool
CreatedAt *string
CountryPhoneCode *string
Authorization string
XSession string
}
UserMedia is the result type of the password-auth service register method.
func NewUserMedia ¶
func NewUserMedia(vres *passwordauthviews.UserMedia) *UserMedia
NewUserMedia initializes result type UserMedia from viewed result type UserMedia.