Top 1.2% dependent packages on proxy.golang.org
Top 1.2% dependent repos on proxy.golang.org
Top 5.2% forks on proxy.golang.org
proxy.golang.org : github.com/icza/session
Package session provides an easy-to-use, extensible and secure HTTP session implementation and management. This is "just" an HTTP session implementation and management, you can use it as-is, or with any existing Go web toolkits and frameworks. Package documentation can be found and godoc.org: https://godoc.org/github.com/icza/session There are 3 key players in the package: - Session is the (HTTP) session interface. We can use it to store and retrieve constant and variable attributes from it. - Store is a session store interface which is responsible to store sessions and make them retrievable by their IDs at the server side. - Manager is a session manager interface which is responsible to acquire a Session from an (incoming) HTTP request, and to add a Session to an HTTP response to let the client know about the session. A Manager has a backing Store which is responsible to manage Session values at server side. Players of this package are represented by interfaces, and various implementations are provided for all these players. You are not bound by the provided implementations, feel free to provide your own implementations for any of the players. Usage can't be simpler than this. To get the current session associated with the http.Request: To create a new session (e.g. on a successful login) and add it to an http.ResponseWriter (to let the client know about the session): Let's see a more advanced session creation: let's provide a constant attribute (for the lifetime of the session) and an initial, variable attribute: And to access these attributes and change value of "Count": (Of course variable attributes can be added later on too with Session.SetAttr(), not just at session creation.) To remove a session (e.g. on logout): Check out the session demo application which shows all these in action: https://github.com/icza/session/blob/master/session_demo/session_demo.go The package github.com/icza/gaesession provides support for Google App Engine (GAE) platform. The gaesession implementation stores sessions in the Memcache and also saves sessions in the Datastore as a backup in case data would be removed from the Memcache. This behaviour is optional, Datastore can be disabled completely. You can also choose whether saving to Datastore happens synchronously (in the same goroutine) or asynchronously (in another goroutine), resulting in faster response times. For details and examples, please visit https://github.com/icza/gaesession.
Registry
-
Source
- Documentation
- JSON
purl: pkg:golang/github.com/icza/session
Keywords:
gae
, http-session
, session-management
License: Apache-2.0
Latest release: 9 months ago
First release: about 8 years ago
Namespace: github.com/icza
Dependent packages: 16
Dependent repositories: 21
Stars: 116 on GitHub
Forks: 15 on GitHub
See more repository details: repos.ecosyste.ms
Funding links: https://github.com/sponsors/icza
Last synced: 26 days ago