세션 touch 리퀘스트 처리
This commit is contained in:
@ -553,6 +553,25 @@ func (sh *serviceDescription) authorize(w http.ResponseWriter, r *http.Request)
|
|||||||
queryvals := r.URL.Query()
|
queryvals := r.URL.Query()
|
||||||
authtype := queryvals.Get("type")
|
authtype := queryvals.Get("type")
|
||||||
uid := queryvals.Get("id")
|
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
|
var email string
|
||||||
|
|
||||||
|
|||||||
2
go.mod
2
go.mod
@ -7,7 +7,7 @@ require (
|
|||||||
github.com/golang-jwt/jwt v3.2.2+incompatible
|
github.com/golang-jwt/jwt v3.2.2+incompatible
|
||||||
go.mongodb.org/mongo-driver v1.11.7
|
go.mongodb.org/mongo-driver v1.11.7
|
||||||
google.golang.org/api v0.128.0
|
google.golang.org/api v0.128.0
|
||||||
repositories.action2quare.com/ayo/gocommon v0.0.0-20230904005440-d396a35713ad
|
repositories.action2quare.com/ayo/gocommon v0.0.0-20230904025656-0eefb438a6d3
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
|
|||||||
2
go.sum
2
go.sum
@ -357,3 +357,5 @@ repositories.action2quare.com/ayo/gocommon v0.0.0-20230901014215-68e40d580f7c h1
|
|||||||
repositories.action2quare.com/ayo/gocommon v0.0.0-20230901014215-68e40d580f7c/go.mod h1:PdpZ16O1czKKxCxn+0AFNaEX/0kssYwC3G8jR0V7ybw=
|
repositories.action2quare.com/ayo/gocommon v0.0.0-20230901014215-68e40d580f7c/go.mod h1:PdpZ16O1czKKxCxn+0AFNaEX/0kssYwC3G8jR0V7ybw=
|
||||||
repositories.action2quare.com/ayo/gocommon v0.0.0-20230904005440-d396a35713ad h1:/hwmPT3hKm/eSqvZ9LjamlvptygWZ87fg09OujRu5xo=
|
repositories.action2quare.com/ayo/gocommon v0.0.0-20230904005440-d396a35713ad h1:/hwmPT3hKm/eSqvZ9LjamlvptygWZ87fg09OujRu5xo=
|
||||||
repositories.action2quare.com/ayo/gocommon v0.0.0-20230904005440-d396a35713ad/go.mod h1:PdpZ16O1czKKxCxn+0AFNaEX/0kssYwC3G8jR0V7ybw=
|
repositories.action2quare.com/ayo/gocommon v0.0.0-20230904005440-d396a35713ad/go.mod h1:PdpZ16O1czKKxCxn+0AFNaEX/0kssYwC3G8jR0V7ybw=
|
||||||
|
repositories.action2quare.com/ayo/gocommon v0.0.0-20230904025656-0eefb438a6d3 h1:6IBLAxab5ntTG+TGjvd7+Pm+QHipQMS7GKg+XrXjn88=
|
||||||
|
repositories.action2quare.com/ayo/gocommon v0.0.0-20230904025656-0eefb438a6d3/go.mod h1:PdpZ16O1czKKxCxn+0AFNaEX/0kssYwC3G8jR0V7ybw=
|
||||||
|
|||||||
Reference in New Issue
Block a user