mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
refactor authenticate to use Token.
This commit is contained in:
@ -59,7 +59,7 @@ func (api *ApiManagerCtx) Route(r chi.Router) {
|
||||
|
||||
func (api *ApiManagerCtx) Authenticate(next http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
session, err := api.sessions.AuthenticateRequest(r)
|
||||
session, err := api.sessions.Authenticate(r)
|
||||
if err != nil {
|
||||
utils.HttpUnauthorized(w, err)
|
||||
} else {
|
||||
|
@ -30,11 +30,12 @@ func (api *ApiManagerCtx) Login(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
session, err := api.sessions.Authenticate(data.ID, data.Secret)
|
||||
if err != nil {
|
||||
utils.HttpUnauthorized(w, err)
|
||||
// TODO: Proper login.
|
||||
//session, err := api.sessions.Authenticate(data.ID, data.Secret)
|
||||
//if err != nil {
|
||||
utils.HttpUnauthorized(w, "no authentication implemented")
|
||||
return
|
||||
}
|
||||
//}
|
||||
|
||||
sameSite := http.SameSiteNoneMode
|
||||
if UnsecureCookies {
|
||||
|
Reference in New Issue
Block a user