jaguar_session 0.9.1

jaguar_session

Session management interceptors and utilities for Jaguar web framework

Session

Session provides a way to store data about a particular set of requests and share that data across those requests. Typical use cases are:

  1. Store items added to shopping cart in retail application
  2. Store information about user logged-in to the application

Session data consists of key-value string pairs.

Session storage

On HTTP request

The session data can either be stored in request cookies or headers itself. This is simpler to get going and doesn't need any backend database.

On the server

Alternatively, session identifier can be stored on request cookies or headers, while the actual session data is stored in Dart Map or a database (ex: MongoDb, PostgreSQL, Reddis, etc).

SessionManager

SessionManager is responsible for:

  1. Parsing session identifier & information from the HTTP request
  2. Writing session identifier & information to HTTP response
  3. Loading and storing session data from session store

Parsing and writing response

Parsing

parseRequest parses the request and obtains the session information provided the Request object. Usually called before route handler execution, authenticator and authorizer, so that parsed data is available for further use.

Writing response

writeResponse writes session information to the provided Response object. Usually called at the end of the route chain.

Managing session

This section explains how to create, update and delete a session.

Creating session

createSession creates a new session with given session data. Might delete the existing session if it had any.

Update session

updateSession updates the existing session by adding the provided key-value pair to the output session information.

Delete session

deleteSession deletes the existing session.

Accessing session values

InValue

InValues are read-only key-value session data that are parsed from the request. InValues can be accessed using getInValue method or inValues member.

Out value

OutValues is the new session data that will be written to the response. OutValues can be accessed using outValues member.

Session managers

CookieSession

Cookie based session manager. This session manager stores all session data on a Cookie.

  1. cookieName Name of the Cookie on which the session data is stored.

JwtCookieSession

JWT based session manager with Cookie as transport mechanism. This session manager stores all session as JWT token on a Cookie.

  1. cookieName Name of the Cookie on which the session data is stored.
  2. authenticationConf Authentication configuration to issue JWT token
  3. authorizationConf Authorization configuration to authorize and decode JWT token

JwtAuthHeaderSession

JWT based session manager with authorization header as transport mechanism. This session manager stores all session as JWT token on authorization header.

  1. authenticationConf Authentication configuration to issue JWT token
  2. authorizationConf Authorization configuration to authorize and decode JWT token

Changelog

0.6.0

  • Introduced createSession
  • Better session management chain with createSession, updateSession and deleteSession
  • Renamed updateResponse to writeResponse

0.0.1

  • Initial version, created by Stagehand

1. Depend on it

Add this to your package's pubspec.yaml file:

dependencies:
  jaguar_session: "^0.9.1"

2. Install it

You can install packages from the command line:

$ pub get

Alternatively, your editor might support 'pub get'. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:jaguar_session/jaguar_session.dart';

Platforms

Server

About

Session management interceptors and utilities for Jaguar web framework

Author

Email tejainece@gmail.com Ravi Teja Gudapati
Email segaud.kevin@gmail.com Kevin Segaud

Homepage

github.com/Jaguar-dart/jaguar_session

Documentation

www.dartdocs.org/documentation/jaguar_session/0.9.1/

Uploader

segaud.kevin@gmail.com
tejainece@gmail.com

License

BSD

Published

Jul 21, 2017

Share