셀프 업데이트 작업 추가 by script

This commit is contained in:
2024-11-12 11:53:18 +09:00
parent 92432fcd83
commit 592e00b98b
5 changed files with 44 additions and 86 deletions

View File

@ -14,7 +14,6 @@ import (
"strings"
"repositories.action2quare.com/ayo/gocommon"
"repositories.action2quare.com/ayo/gocommon/flagx"
"repositories.action2quare.com/ayo/gocommon/logger"
)
@ -159,9 +158,6 @@ func (h *houstonHandler) RegisterHandlers(serveMux gocommon.ServerMuxInterface,
return nil
}
var noauth = flagx.Bool("noauth", false, "")
var authtype = flagx.String("auth", "on", "on|off|both")
func (h *houstonHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
defer func() {
s := recover()
@ -176,39 +172,6 @@ func (h *houstonHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
r.Body.Close()
}()
// TODO : 구글 인증까지 붙인 후에 주석 제거
// var userinfo map[string]any
// if !*noauth && (*authtype == "on" || *authtype == "both") {
// authheader := r.Header.Get("Authorization")
// if len(authheader) == 0 {
// logger.Println("Authorization header is not valid :", authheader)
// w.WriteHeader(http.StatusBadRequest)
// return
// }
// req, _ := http.NewRequest("GET", "https://graph.microsoft.com/oidc/userinfo", nil)
// req.Header.Add("Authorization", authheader)
// client := &http.Client{}
// resp, err := client.Do(req)
// if err != nil {
// logger.Println("graph microsoft api call failed :", err)
// w.WriteHeader(http.StatusBadRequest)
// return
// }
// defer resp.Body.Close()
// raw, _ := io.ReadAll(resp.Body)
// if err = json.Unmarshal(raw, &userinfo); err != nil {
// return
// }
// if _, expired := userinfo["error"]; expired {
// w.WriteHeader(http.StatusUnauthorized)
// return
// }
// }
var operation string
if r.Method == "POST" {
operation = r.FormValue("operation")