Coder Social home page Coder Social logo

Comments (6)

brockallen avatar brockallen commented on May 24, 2024

"Session" in this repo means session state -- a cookie-based server-side state management mechanism for UI apps. This is unrelated to authentication.

from session.

ankitbko avatar ankitbko commented on May 24, 2024

I get that. I wanted to know in case the session is established by another service, is there is a way to pass session Id as token in header?
@brockallen We have Identity server 3 for authentication and authorization with angular being client. I was just thinking, is it a good practise to use auth token as session token for the user?

from session.

brockallen avatar brockallen commented on May 24, 2024

Well, in general I think session state is a bad idea: http://brockallen.com/2012/04/07/think-twice-about-using-session-state/. And even more so for Web APIs. So I'd not design a web app or a web api to use session state.

from session.

Tratcher avatar Tratcher commented on May 24, 2024

The use of cookies is baked into the middleware: https://github.com/aspnet/Session/blob/dev/src/Microsoft.AspNet.Session/SessionMiddleware.cs#L77.

from session.

ankitbko avatar ankitbko commented on May 24, 2024

@brockallen I had read your blog long ago :). I completely agree with you about avoiding session state and maintaining user specific data in relational/NoSQL database. We are using Redis as NoSQL and caching solution. ASP.NET 5 session also uses RedisCache as IDistributedCache for session management. Moreover now the sessions are non-locking which essentially solves one of the biggest performance issues with ASP Sessions. This basically means that whatever I store in Session gets stored as cache objects in Redis.

I still avoid Session as much as possible, but it looks to be fine to be used for non critical short lived user data, as you get out of the box way to store and retrieve objects with expiration built in. All long lived user data will be stored in more reliable manner in database.
My current thought is to use token returned by Ids3 as session token. There is really no need to maintain another token in cookie just for accessing session.

@Tratcher Thanks. I had gone through the code yesterday itself. It seems with small modification I can just switch to get session key from token. Still an option to switch to custom key or overridable method would have been better. Thanks for pointing me to right direction.

from session.

John0King avatar John0King commented on May 24, 2024

@Tratcher Session ID use cookie is not a good idea. specifically when a browser disable cookies or not support httponly

from session.

Related Issues (20)

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.