세션 touch 리퀘스트 처리

This commit is contained in:
2023-09-04 12:17:34 +09:00
parent e18dc74dc2
commit caed2b5925
3 changed files with 22 additions and 1 deletions

View File

@ -553,6 +553,25 @@ func (sh *serviceDescription) authorize(w http.ResponseWriter, r *http.Request)
queryvals := r.URL.Query()
authtype := queryvals.Get("type")
uid := queryvals.Get("id")
if sk := queryvals.Get("sk"); len(sk) > 0 {
success, err := sh.sessionProvider.Touch(sk)
if err != nil {
logger.Error("authorize failed. sessionProvider.Touch err:", err)
w.WriteHeader(http.StatusInternalServerError)
return
}
// !success일 때 빈 body를 보내면 클라이언트는 로그아웃 된다.
if success {
output := map[string]any{
"sk": sk,
"expirein": sh.sessionTTL.Seconds(),
}
bt, _ := json.Marshal(output)
w.Write(bt)
}
return
}
var email string