refactor
This commit is contained in:
parent
850d0af0bb
commit
04fb803330
2 changed files with 5 additions and 16 deletions
|
@ -129,11 +129,6 @@ func main() {
|
|||
http.Redirect(writer, request, redirectURL, http.StatusSeeOther)
|
||||
})
|
||||
|
||||
// for tests, can access only with valid token (when logged in)
|
||||
http.HandleFunc("/protected", logic.ValidateToken(func(w http.ResponseWriter, r *http.Request) {
|
||||
w.Write([]byte("Hello, I'm protected"))
|
||||
}, srv))
|
||||
|
||||
// can access only with valid token (when logged in), deletes client
|
||||
http.HandleFunc("/delete", logic.ValidateToken(func(w http.ResponseWriter, r *http.Request) {
|
||||
id := r.Header.Get("client_id")
|
||||
|
@ -203,6 +198,11 @@ func main() {
|
|||
outputHTML(w, r, "static/register.html")
|
||||
})
|
||||
|
||||
// can access only with valid token (when logged in)
|
||||
http.HandleFunc("/verify", logic.ValidateToken(func(w http.ResponseWriter, r *http.Request) {
|
||||
w.WriteHeader(http.StatusOK)
|
||||
}, srv))
|
||||
|
||||
log.Fatal(http.ListenAndServe(":"+strconv.Itoa(config.AuthServerPort), nil))
|
||||
}
|
||||
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Redirect</title>
|
||||
<meta http-equiv="refresh" content="0;url=http://localhost:9096/login.html">
|
||||
</head>
|
||||
<body>
|
||||
<p>If you are not redirected, <a href="http://localhost:9096/login.html">click here</a>.</p>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in a new issue