noauth 플래그 처리
This commit is contained in:
@ -16,6 +16,7 @@ import (
|
||||
|
||||
common "repositories.action2quare.com/ayo/gocommon"
|
||||
"repositories.action2quare.com/ayo/gocommon/logger"
|
||||
"repositories.action2quare.com/ayo/maingate/flag"
|
||||
|
||||
"go.mongodb.org/mongo-driver/bson"
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
@ -425,34 +426,39 @@ func (sh *serviceDescription) authorize(w http.ResponseWriter, r *http.Request)
|
||||
uid := queryvals.Get("id")
|
||||
//accesstoken := queryvals.Get("token") //-- 이거 이제 받지마라
|
||||
session := queryvals.Get("sk")
|
||||
var email string
|
||||
|
||||
//email, err := sh.readProfile(authtype, uid, accesstoken)
|
||||
bfinfo, err := sh.getUserBrowserInfo(r)
|
||||
if err != nil {
|
||||
logger.Error("getUserBrowserInfo failed :", err)
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
if !*flag.Noauth {
|
||||
//email, err := sh.readProfile(authtype, uid, accesstoken)
|
||||
bfinfo, err := sh.getUserBrowserInfo(r)
|
||||
if err != nil {
|
||||
logger.Error("getUserBrowserInfo failed :", err)
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
email, err := sh.readProfile(authtype, uid, bfinfo)
|
||||
if err != nil {
|
||||
logger.Error("readProfile failed :", err)
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
email, err = sh.readProfile(authtype, uid, bfinfo)
|
||||
if err != nil {
|
||||
logger.Error("readProfile failed :", err)
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
logger.Println("auth success :", authtype, uid, email, session)
|
||||
logger.Println("auth success :", authtype, uid, email, session)
|
||||
|
||||
newType, newId, err := sh.getProviderInfo(authtype, uid)
|
||||
if err != nil {
|
||||
logger.Error("getProviderInfo failed :", err)
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
}
|
||||
newType, newId, err := sh.getProviderInfo(authtype, uid)
|
||||
if err != nil {
|
||||
logger.Error("getProviderInfo failed :", err)
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
}
|
||||
|
||||
if authtype != newType || uid != newId {
|
||||
authtype = newType
|
||||
uid = newId
|
||||
logger.Println("auth success ( redirect ) :", authtype, uid, email, session)
|
||||
if authtype != newType || uid != newId {
|
||||
authtype = newType
|
||||
uid = newId
|
||||
logger.Println("auth success ( redirect ) :", authtype, uid, email, session)
|
||||
}
|
||||
} else {
|
||||
email = fmt.Sprintf("%s@noauth.flag", uid)
|
||||
}
|
||||
|
||||
//if len(session) == 0 && len(email) > 0 {
|
||||
|
||||
Reference in New Issue
Block a user