-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#27: apply cookie name prefix by options [broken tests]
- Loading branch information
Showing
7 changed files
with
111 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,25 @@ | ||
package passkey | ||
|
||
import "net/http" | ||
import ( | ||
"net/http" | ||
"time" | ||
) | ||
|
||
// Logout deletes session from session store and deletes session cookie | ||
// TODO: put it somewhere else | ||
func (p *Passkey) Logout(w http.ResponseWriter, r *http.Request) { | ||
sid, err := r.Cookie(p.cookieSettings.Name) | ||
sid, err := r.Cookie(p.cookieSettings.userSessionName) | ||
if err != nil { | ||
p.log.Errorf("can't get session cookie: %s", err.Error()) | ||
|
||
return | ||
} | ||
|
||
p.authSessionStore.Delete(sid.Value) | ||
p.deleteSessionCookie(w) | ||
http.SetCookie(w, &http.Cookie{ | ||
Name: p.cookieSettings.userSessionName, | ||
Value: "", | ||
Expires: time.Unix(0, 0), | ||
MaxAge: -1, | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters