Git Product home page Git Product logo

sessions's Introduction

sessions Build Status GoDoc

Package sessions provides minimalist Go sessions, backed by securecookie or database stores.

Features

  • Store provides a predicatable interface for dealing with individual sessions.
    • New returns a new named Session.
    • Get returns the named Session from the http.Request iff it was correctly verified and decoded. Otherwise the error is non-nil.
    • Save encodes and signs Session.Value data.
    • Destroy removes (expires) the session cookie of a given name.
  • Each Session provides Save and Destroy convenience methods.
  • Provides CookieStore for managing client-side secure cookies.
  • Extensible for custom session database backends.

Install

go get github.com/dghubble/sessions

Documentation

Read GoDoc

Differences from gorilla/sessions

  • Gorilla stores a context map of Requests to Sessions to abstract multiple sessions. dghubble/sessions provides individual sessions, leaving multiple sessions to a multisessions package. No Registry is needed.
  • Gorilla has a depedency on gorilla/context, a non-standard context.
  • Gorilla requires all handlers be wrapped in context.ClearHandler to avoid memory leaks.
  • Gorilla's Store interface is surprising. New and Get can both possibly return a new session, a field check is needed. Some use cases expect developers to ignore an error. Destroy isn't provided.

License

MIT License

sessions's People

Contributors

dghubble avatar ragnarlonn avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.