20 lines
459 B
Go
Executable File
20 lines
459 B
Go
Executable File
package auth
|
|
|
|
// import "net/http"
|
|
|
|
// func IsAuthenticated(w http.ResponseWriter, r *http.Request, next http.HandlerFunc) {
|
|
|
|
// session, err := Store.Get(r, SessionName)
|
|
// if err != nil {
|
|
// http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
// return
|
|
// }
|
|
|
|
// if _, ok := session.Values["profile"]; !ok {
|
|
// //TODO allow customization of redirect
|
|
// http.Redirect(w, r, "/", http.StatusSeeOther)
|
|
// } else {
|
|
// next(w, r)
|
|
// }
|
|
// }
|