Documentation ¶
Index ¶
Constants ¶
View Source
const ( // Inactive state means the auth model is not active. Inactive State = "inactive" // Active state means the auth model is active. Active = "active" // Banned state means the auth model is Banned. Banned = "banned" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Auth ¶
type Auth struct { ID pr.ObjectID State State `validate:"required"` UserName string `validate:"required,dbunique"` Email string `validate:"required,dbunique,email"` PWHash []byte `validate:"required"` PWAlgo string `validate:"required"` OTPSecret string `validate:"base36"` Recaptcha string `bson:"-" validate:"required,recaptcha=IPAddr"` IPAddr string `bson:"-" validate:"required,ip"` }
Auth denoates the authentication model.
type EmailMessage ¶
EmailMessage represents a structure of email message template.
type PublicServer ¶
type PublicServer struct { Adapter adapter.IAdapter PWHashAlgo []crypto.PasswordHasher Logger *zap.Logger Templates *TemplateMap TokenCli tokenRPC.TokenClient RenderCli renderRPC.TemplateServiceClient EmailCli emailRPC.EmailClient WaitGroup sync.WaitGroup // # of asynchronous jobs. // contains filtered or unexported fields }
PublicServer represents an auth server. Note that this server depedns on token and render services.
func NewPublicServer ¶
func NewPublicServer( adapter adapter.IAdapter, hashAlgo []crypto.PasswordHasher, logger *zap.Logger, templates *TemplateMap, emailClient emailRPC.EmailClient, tokenClient tokenRPC.TokenClient, renderClient renderRPC.TemplateServiceClient, recaptchaSecret string, ) *PublicServer
NewPublicServer creates a new isntance of Server
func (*PublicServer) SignUp ¶
func (me *PublicServer) SignUp( ctx context.Context, req *rpc.RegistRequest, ) (*empty.Empty, error)
SignUp implements Signup RPC to register the user. Note that registering the user doesn't mean activate the user. Activation process should be required by end-user.
type State ¶
type State string
State means the state of the authmodel such as "inactive", "active", or "banned".
type TemplateMap ¶
type TemplateMap struct { Signup *EmailMessage // Renders with token when the user signed up. Activate *EmailMessage // Renders when the user activated his/her account. Auth *EmailMessage // Renders when the user is logged in. Suspend *EmailMessage // Renders when the user is banned. }
TemplateMap represents a structure that has template names corresponding to the templates
Click to show internal directories.
Click to hide internal directories.