Documentation ¶
Index ¶
- Constants
- func DefaultSelector(c *gin.Context, t Type) string
- type AuthMethod
- type AuthMethods
- func (a *AuthMethods) Add(cfg AuthMethod) *AuthMethods
- func (a *AuthMethods) CheckFieldsDefine(u user.User) (ok bool, badFields map[string][]string)
- func (a *AuthMethods) CheckMergeModuleSupport() (ok bool, badAuthMethods map[string]string)
- func (a *AuthMethods) IsEmpty() bool
- func (a *AuthMethods) Select(c *gin.Context, t Type) *AuthMethod
- type AuthRequest
- type AuthRequestFieldable
- type CheckLoginFieldRequestByEmail
- type CheckUserExistsRequest
- type MergeConfirmRequest
- type Selector
- type SignUpRequestByEmail
- type SocialAuthRequest
- type SocialSignInRequest
- type Type
Constants ¶
const ( SocialAuthTypeGoogle = auth.AuthTypeGoogle SocialAuthTypeApple = auth.AuthTypeApple SocialAuthTypeFacebook = auth.AuthTypeFacebook SocialAuthTypeVK = auth.AuthTypeVK )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AuthMethod ¶
type AuthMethod struct { Type Type Key string Sender sender.Sender SignUpRequest AuthRequest SignInRequest AuthRequest CheckUserExistsRequest CheckUserExistsRequest SocialSignInRequest SocialAuthRequest SocialAuthType auth.Type CodeGenerator code.Generator CodeLength int DisableLink bool }
AuthMethod stores request structures, key and sender that use to send confirmation/recovery codes.
type AuthMethods ¶
AuthMethods is list of AuthType by key and selector for select AuthType
func New ¶
func New(selector Selector) *AuthMethods
New create AuthMethods (list of AuthMethod). If selector is nil - used default selector
func (*AuthMethods) Add ¶
func (a *AuthMethods) Add(cfg AuthMethod) *AuthMethods
Add new AuthType in AuthTypes list
func (*AuthMethods) CheckFieldsDefine ¶
CheckFieldsDefine checks whether all fields required for queries defined in models
func (*AuthMethods) CheckMergeModuleSupport ¶ added in v1.3.0
func (a *AuthMethods) CheckMergeModuleSupport() (ok bool, badAuthMethods map[string]string)
func (*AuthMethods) IsEmpty ¶
func (a *AuthMethods) IsEmpty() bool
func (*AuthMethods) Select ¶
func (a *AuthMethods) Select(c *gin.Context, t Type) *AuthMethod
Select uses the selector and returns the found method of authorization
if selector returned the empty key and in auth list only one method - use first method as default and return it if selector returned the empty key and in auth list only one method of t Type - return this method
type AuthRequest ¶
AuthRequest is basic sign-up/sign-in interface
type AuthRequestFieldable ¶
type AuthRequestFieldable interface {
Fields() map[string]interface{}
}
AuthRequestFieldable is additional sign-up/sign-in interface for use additional fields
type CheckLoginFieldRequestByEmail ¶
type CheckLoginFieldRequestByEmail struct {
Email string `json:"email" form:"email" binding:"required"`
}
func (CheckLoginFieldRequestByEmail) GetUID ¶
func (r CheckLoginFieldRequestByEmail) GetUID() (uid string)
type CheckUserExistsRequest ¶
type CheckUserExistsRequest interface {
GetUID() (uid string)
}
type MergeConfirmRequest ¶ added in v1.3.0
type MergeConfirmRequest interface {
GetConfirmMerge() bool
}
type SignUpRequestByEmail ¶
type SignUpRequestByEmail struct { Email string `json:"email" form:"email" binding:"required"` Password string `json:"password" form:"password" binding:"required"` ConfirmMerge bool `json:"confirmMerge" form:"confirmMerge"` }
func (SignUpRequestByEmail) GetConfirmMerge ¶ added in v1.3.0
func (r SignUpRequestByEmail) GetConfirmMerge() bool
func (SignUpRequestByEmail) GetPassword ¶
func (r SignUpRequestByEmail) GetPassword() (password string)
func (SignUpRequestByEmail) GetUID ¶
func (r SignUpRequestByEmail) GetUID() (uid string)
type SocialAuthRequest ¶
type SocialAuthRequest interface {
GetToken() string
}
type SocialSignInRequest ¶
type SocialSignInRequest struct { Token string `json:"token" binding:"required"` ConfirmMerge bool `json:"confirmMerge"` }
func (*SocialSignInRequest) GetConfirmMerge ¶ added in v1.3.0
func (r *SocialSignInRequest) GetConfirmMerge() bool
func (*SocialSignInRequest) GetToken ¶
func (r *SocialSignInRequest) GetToken() string