mirror of
https://github.com/m1k1o/neko.git
synced 2026-11-03 00:11:48 -06:00
feat(auth): add OIDC-only member authentication (#686)
* feat(auth): add OIDC member authentication * docs(auth): document OIDC member login * fix(auth): address OAuth review feedback * refactor(auth): move OAuth flow into member provider
This commit is contained in:
@@ -14,6 +14,7 @@ func (manager *SessionManagerCtx) CookieSetToken(w http.ResponseWriter, token st
|
||||
if manager.config.Cookie.Secure {
|
||||
sameSite = http.SameSiteNoneMode
|
||||
}
|
||||
path := manager.cookiePath()
|
||||
|
||||
http.SetCookie(w, &http.Cookie{
|
||||
Name: manager.config.Cookie.Name,
|
||||
@@ -23,7 +24,7 @@ func (manager *SessionManagerCtx) CookieSetToken(w http.ResponseWriter, token st
|
||||
SameSite: sameSite,
|
||||
HttpOnly: manager.config.Cookie.HTTPOnly,
|
||||
Domain: manager.config.Cookie.Domain,
|
||||
Path: manager.config.Cookie.Path,
|
||||
Path: path,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -35,9 +36,17 @@ func (manager *SessionManagerCtx) CookieClearToken(w http.ResponseWriter, r *htt
|
||||
|
||||
cookie.Value = ""
|
||||
cookie.Expires = time.Unix(0, 0)
|
||||
cookie.Path = manager.cookiePath()
|
||||
http.SetCookie(w, cookie)
|
||||
}
|
||||
|
||||
func (manager *SessionManagerCtx) cookiePath() string {
|
||||
if manager.config.Cookie.Path == "" {
|
||||
return "/"
|
||||
}
|
||||
return manager.config.Cookie.Path
|
||||
}
|
||||
|
||||
func (manager *SessionManagerCtx) Authenticate(r *http.Request) (types.Session, error) {
|
||||
token, ok := manager.getToken(r)
|
||||
if !ok {
|
||||
|
||||
Reference in New Issue
Block a user