mirror of
https://github.com/m1k1o/neko.git
synced 2025-06-05 12:22:52 +02:00
change authorization methods request priorities.
This commit is contained in:
parent
900ae006b8
commit
edfe9adde0
1 changed files with 6 additions and 6 deletions
|
@ -27,12 +27,6 @@ func (manager *SessionManagerCtx) Authenticate(r *http.Request) (types.Session,
|
|||
}
|
||||
|
||||
func getToken(r *http.Request) (string, bool) {
|
||||
// get from Cookie
|
||||
cookie, err := r.Cookie("NEKO_SESSION")
|
||||
if err == nil {
|
||||
return cookie.Value, true
|
||||
}
|
||||
|
||||
// get from Header
|
||||
reqToken := r.Header.Get("Authorization")
|
||||
splitToken := strings.Split(reqToken, "Bearer ")
|
||||
|
@ -40,6 +34,12 @@ func getToken(r *http.Request) (string, bool) {
|
|||
return strings.TrimSpace(splitToken[1]), true
|
||||
}
|
||||
|
||||
// get from Cookie
|
||||
cookie, err := r.Cookie("NEKO_SESSION")
|
||||
if err == nil {
|
||||
return cookie.Value, true
|
||||
}
|
||||
|
||||
// get from URL
|
||||
token := r.URL.Query().Get("token")
|
||||
if token != "" {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue