Merge branch 'master' of https://git.kingpenguin.tk/chteufleur/HTTPAuthentificationOverXMPP
This commit is contained in:
commit
77752651e1
|
|
@ -19,6 +19,9 @@ const (
|
||||||
DOMAIN_ACCESS = "domain"
|
DOMAIN_ACCESS = "domain"
|
||||||
TRANSACTION_ID = "transaction_id"
|
TRANSACTION_ID = "transaction_id"
|
||||||
|
|
||||||
|
ROUTE_ROOT = "/"
|
||||||
|
ROUTE_AUTH = "/toto"
|
||||||
|
|
||||||
RETURN_VALUE_OK = "OK"
|
RETURN_VALUE_OK = "OK"
|
||||||
RETURN_VALUE_NOK = "NOK"
|
RETURN_VALUE_NOK = "NOK"
|
||||||
)
|
)
|
||||||
|
|
@ -62,6 +65,7 @@ func authHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
if answer {
|
if answer {
|
||||||
ret = RETURN_VALUE_OK
|
ret = RETURN_VALUE_OK
|
||||||
}
|
}
|
||||||
|
// TODO reply with JSON format
|
||||||
fmt.Fprintf(w, ret)
|
fmt.Fprintf(w, ret)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -69,8 +73,9 @@ func authHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
func Run() {
|
func Run() {
|
||||||
log.Printf("%sRunning", LogInfo)
|
log.Printf("%sRunning", LogInfo)
|
||||||
http.HandleFunc("/", indexHandler) // set router
|
|
||||||
http.HandleFunc("/toto", authHandler)
|
http.HandleFunc(ROUTE_ROOT, indexHandler)
|
||||||
|
http.HandleFunc(ROUTE_AUTH, authHandler)
|
||||||
|
|
||||||
port := strconv.Itoa(HttpPortBind)
|
port := strconv.Itoa(HttpPortBind)
|
||||||
log.Printf("%sListenning on port %s", LogInfo, port)
|
log.Printf("%sListenning on port %s", LogInfo, port)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue