noauth대신 authtype 파라미터 사용

This commit is contained in:
2024-07-10 14:54:13 +09:00
parent 938f80b460
commit ec3edbd8d5
4 changed files with 16 additions and 25 deletions

View File

@ -653,7 +653,7 @@ func (sh *serviceDescription) authorize(w http.ResponseWriter, r *http.Request)
}
queryvals := r.URL.Query()
authtype := queryvals.Get("type")
reqauthtype := queryvals.Get("type")
uid := queryvals.Get("id")
sk := queryvals.Get("sk")
@ -692,9 +692,8 @@ func (sh *serviceDescription) authorize(w http.ResponseWriter, r *http.Request)
}
var email string
if !*noauth {
if len(authtype) > 0 {
if !*noauth && (*authtype == "on" || *authtype == "both") {
if len(reqauthtype) > 0 {
//email, err := sh.readProfile(authtype, uid, accesstoken)
bfinfo, err := sh.getUserBrowserInfo(r)
if err != nil {
@ -703,25 +702,25 @@ func (sh *serviceDescription) authorize(w http.ResponseWriter, r *http.Request)
return
}
email, err = sh.readProfile(authtype, uid, bfinfo)
email, err = sh.readProfile(reqauthtype, uid, bfinfo)
if err != nil {
logger.Error("readProfile failed :", err)
w.WriteHeader(http.StatusBadRequest)
return
}
newType, newId, err := sh.getProviderInfo(authtype, uid)
newType, newId, err := sh.getProviderInfo(reqauthtype, uid)
if err != nil {
logger.Error("getProviderInfo failed :", err)
w.WriteHeader(http.StatusBadRequest)
return
}
if authtype != newType || uid != newId {
authtype = newType
if reqauthtype != newType || uid != newId {
reqauthtype = newType
uid = newId
}
} else if *devflag {
} else if *authtype == "both" {
email = fmt.Sprintf("%s@guest.flag", uid)
} else {
// authtype이 없으면 입장 불가
@ -780,7 +779,7 @@ func (sh *serviceDescription) authorize(w http.ResponseWriter, r *http.Request)
sk, err = sh.sessionProvider.New(&session.Authorization{
Account: accid,
Platform: authtype,
Platform: reqauthtype,
Uid: uid,
Email: email,
})
@ -796,7 +795,7 @@ func (sh *serviceDescription) authorize(w http.ResponseWriter, r *http.Request)
"newAccount": newaccount,
"accid": accid.Hex(),
}
if *noauth {
if len(reqauthtype) == 0 {
output["noauth"] = true
}