tbs
This commit is contained in:
@@ -28,6 +28,15 @@ func Authenticate(service service.Auth) func(http.Handler) http.Handler {
|
||||
}
|
||||
}
|
||||
|
||||
func GetSession(r *http.Request) *service.Session {
|
||||
obj := r.Context().Value(SessionKey)
|
||||
if obj == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
return obj.(*service.Session)
|
||||
}
|
||||
|
||||
func getSessionID(r *http.Request) string {
|
||||
cookie, err := r.Cookie("id")
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user