认证支持同一类型多绑定
This commit is contained in:
@@ -82,7 +82,7 @@ type IAuther interface {
|
||||
// 负责验证secret,并找到相应的用户返回(password,email,mobile类型的不负责用户查找)如果找不到用户UserID为空
|
||||
VerifySecret(authID, authSecret string) (authBindEx *AuthBindEx, err error)
|
||||
AddAuthBind(authBindEx *AuthBindEx, userName string) (err error)
|
||||
UnbindAuth(userID, authType, userName string) (err error)
|
||||
UnbindAuth(userID, authType, authTypeID, userName string) (err error)
|
||||
Logout(authInfo *AuthInfo) (err error)
|
||||
GetUserType() (userType int8)
|
||||
}
|
||||
@@ -314,7 +314,7 @@ func AddAuthBind(user IUser, newAuthInfo *AuthInfo) (err error) {
|
||||
} else {
|
||||
if handler := authers[newAuthInfo.AuthBindInfo.Type]; handler != nil {
|
||||
newAuthInfo.AuthBindInfo.UserID = user.GetID()
|
||||
handler.UnbindAuth(user.GetID(), newAuthInfo.GetAuthType(), user.GetName())
|
||||
handler.UnbindAuth(user.GetID(), newAuthInfo.GetAuthType(), newAuthInfo.GetAuthTypeID(), user.GetName())
|
||||
err = handler.AddAuthBind(newAuthInfo.AuthBindInfo, user.GetName())
|
||||
} else {
|
||||
err = ErrIllegalAuthType
|
||||
@@ -323,10 +323,10 @@ func AddAuthBind(user IUser, newAuthInfo *AuthInfo) (err error) {
|
||||
return err
|
||||
}
|
||||
|
||||
func UnbindAuth(userID, authType, userName string) (err error) {
|
||||
globals.SugarLogger.Debugf("UnbindAuth userID:%s, authType:%s, userName:%s", userID, authType, userName)
|
||||
func UnbindAuth(userID, authType, authTypeID, userName string) (err error) {
|
||||
globals.SugarLogger.Debugf("UnbindAuth userID:%s, authType:%s, authTypeID:%s, userName:%s", userID, authType, authTypeID, userName)
|
||||
if handler := authers[authType]; handler != nil {
|
||||
err = handler.UnbindAuth(userID, authType, userName)
|
||||
err = handler.UnbindAuth(userID, authType, authTypeID, userName)
|
||||
} else {
|
||||
err = ErrIllegalAuthType
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user