Newer
Older
log.Error("Failed to delete session with err: ", err.Error())
_ = authSvc.metricStore.SetSessionMetric(met.SesMetTypeLogout, metric)
if sandboxDeleted {
metricSessionActive.Dec()
metricSessionDuration.Observe(time.Since(session.StartTime).Minutes())
}
w.Header().Set("Content-Type", "application/json; charset=UTF-8")
w.WriteHeader(http.StatusOK)
}
Kevin Di Lallo
committed
Kevin Di Lallo
committed
func asTriggerWatchdog(w http.ResponseWriter, r *http.Request) {
Kevin Di Lallo
committed
// Refresh session
Kevin Di Lallo
committed
sessionStore := authSvc.sessionMgr.GetSessionStore()
Kevin Di Lallo
committed
if err != nil {
log.Error("Failed to refresh session with err: ", err.Error())
Kevin Di Lallo
committed
return
}
w.Header().Set("Content-Type", "application/json; charset=UTF-8")
w.WriteHeader(http.StatusOK)
}
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
/*
* Response Code 200: Login is Supported and Session exists
* Response Code 401: Login is Supported and Session doesn't exists
* Response Code 404: Login is not Supported
*/
func asLoginSupported(w http.ResponseWriter, r *http.Request) {
log.Info("----- LOGIN SUPPORTED-----")
w.Header().Set("Content-Type", "application/json; charset=UTF-8")
// Check if Github is enabled
githubEnabledStr := strings.TrimSpace(os.Getenv("MEEP_OAUTH_GITHUB_ENABLED"))
githubEnabled, err := strconv.ParseBool(githubEnabledStr)
if err != nil || !githubEnabled {
w.WriteHeader(http.StatusNotFound)
} else {
// Retrieve user session, if any
session, err := authSvc.sessionMgr.GetSessionStore().Get(r)
if err != nil || session == nil {
http.Error(w, "Unauthorized", http.StatusUnauthorized)
} else {
w.WriteHeader(http.StatusOK)
}
}
}