Git Product home page Git Product logo

session's Introduction

Welcome!

This package is used to manage user sessions in generic web applications, where managing access control is a desirable feature.

Example flow

  1. You've already established the various kinds of sessions you're interested in tracking, by making calls to yourSession := session.NewSession.
  2. User has successfully logged in, by jumping over whatever hurdles you've constructed.
  3. You create a corresponding session entry, with yourSession.Begin(uname), which gives you back the token's time to live duration, and the token itself.
  4. The user tries to do some activity with controlled access.
  5. You call yourSession.Validate(uname, providedToken) to validate a token.
  6. Your user's browser, realizing that their token's time is coming up, requests a renewal.
  7. You call yourSession.Renew(uname, providedToken), which will return a brand new token and time-to-live.

Roadmap of Features

Done

  1. Allow for custom token parameters
  • Tokens that expire at different times, are different lengths, etc.
  1. Allow for custom tokens
  • Tokens that grant access to X activity or Y activity.
    • We can encode this information in a couple of ways. For example by making separate DB indices, or by hashing the activity name into the token.
  • Allow users to possess more than 1 token.

Yet to come

  1. SecureSession, which only stores hashes of usernames/ids.

Interesting issue...

What if we want to make two different kinds of token for the same username?

We would need separate redis DBs, one for each user. Or, we could just use username_tokenName as the index. Way better idea.

session's People

Contributors

adamsanghera 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.