This implementation requires HttpContextAccessor, and DistributedMemoryCache (In memory distributed cache can cause strange behavior unless the web server has sticky sessions).
According to the Asp.Net documentation the session data is considered ephemeral data—the site should continue to function without the session data. Critical application data should be stored in the user database and cached in session only as a performance optimization.
The session data is by default reset after 20 minutes of inactivity. Sessions states are maintained by a cookies with a session id, these are not shared across browsers and they are deleted when the browser sessions end. However, the authentication cookie can last longer causing unfortunate issues as the token is only configured at OnAuthorizationCodeReceivedAsync. This will make the user unable to use the services without logging out and back inn again.
I can continue, but in short the implementation is bad and should be replaced.
This implementation requires HttpContextAccessor, and DistributedMemoryCache (In memory distributed cache can cause strange behavior unless the web server has sticky sessions).
According to the Asp.Net documentation the session data is considered ephemeral data—the site should continue to function without the session data. Critical application data should be stored in the user database and cached in session only as a performance optimization.
The session data is by default reset after 20 minutes of inactivity. Sessions states are maintained by a cookies with a session id, these are not shared across browsers and they are deleted when the browser sessions end. However, the authentication cookie can last longer causing unfortunate issues as the token is only configured at OnAuthorizationCodeReceivedAsync. This will make the user unable to use the services without logging out and back inn again.
I can continue, but in short the implementation is bad and should be replaced.