Class SessionFilter
Manages session state in work context
Inheritance
System.Object
SessionFilter
Implements
System.IDisposable
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
Assembly: Azos.Wave.dll
Syntax
public class SessionFilter : WorkFilter, IDisposable, IApplicationComponent, INamed, IOrdered
Constructors
SessionFilter(WorkDispatcher, IConfigSectionNode)
Declaration
public SessionFilter(WorkDispatcher dispatcher, IConfigSectionNode confNode)
Parameters
SessionFilter(WorkDispatcher, String, Int32)
Declaration
public SessionFilter(WorkDispatcher dispatcher, string name, int order)
Parameters
Type |
Name |
Description |
WorkDispatcher |
dispatcher |
|
System.String |
name |
|
System.Int32 |
order |
|
SessionFilter(WorkHandler, IConfigSectionNode)
Declaration
public SessionFilter(WorkHandler handler, IConfigSectionNode confNode)
Parameters
SessionFilter(WorkHandler, String, Int32)
Declaration
public SessionFilter(WorkHandler handler, string name, int order)
Parameters
Type |
Name |
Description |
WorkHandler |
handler |
|
System.String |
name |
|
System.Int32 |
order |
|
Fields
CONF_COOKIE_NAME_ATTR
Declaration
public const string CONF_COOKIE_NAME_ATTR = "session-cookie-name"
Field Value
Type |
Description |
System.String |
|
CONF_SESSION_TIMEOUT_MS_ATTR
Declaration
public const string CONF_SESSION_TIMEOUT_MS_ATTR = "session-timeout-ms"
Field Value
Type |
Description |
System.String |
|
DEFAULT_COOKIE_NAME
Declaration
public const string DEFAULT_COOKIE_NAME = "SID"
Field Value
Type |
Description |
System.String |
|
DEFAULT_SESSION_TIMEOUT_MS
Declaration
public const int DEFAULT_SESSION_TIMEOUT_MS = 300000
Field Value
Type |
Description |
System.Int32 |
|
NETGATE_NEWSESSION_VAR_NAME
Use this name in access deny rule in NetGate setup to block user who create too many sessions
Declaration
public const string NETGATE_NEWSESSION_VAR_NAME = "newSession"
Field Value
Type |
Description |
System.String |
|
Properties
CookieName
Specifies session cookie name
Declaration
public string CookieName { get; set; }
Property Value
Type |
Description |
System.String |
|
SessionTimeoutMs
Specifies session inactivity timeout in milliseconds.
For default implementation: assign 0 to use App.ObjectStore default object timeout value
Declaration
public int SessionTimeoutMs { get; set; }
Property Value
Type |
Description |
System.Int32 |
|
Methods
DecodeSessionID(WorkContext, String, Boolean, out UInt64)
Override to decode session ID GUID from string representation. Return null if conversion not possible
Declaration
protected virtual Guid? DecodeSessionID(WorkContext work, string id, bool hasApiHeaders, out ulong idSecret)
Parameters
Type |
Name |
Description |
WorkContext |
work |
|
System.String |
id |
|
System.Boolean |
hasApiHeaders |
|
System.UInt64 |
idSecret |
|
Returns
Type |
Description |
System.Nullable<System.Guid> |
|
DoFilterWork(WorkContext, IList<WorkFilter>, Int32)
Declaration
protected override sealed void DoFilterWork(WorkContext work, IList<WorkFilter> filters, int thisFilterIndex)
Parameters
Type |
Name |
Description |
WorkContext |
work |
|
System.Collections.Generic.IList<WorkFilter> |
filters |
|
System.Int32 |
thisFilterIndex |
|
Overrides
EncodeSessionID(WorkContext, WaveSession, Boolean)
Override to encode session ID GUID into string representation
Declaration
protected virtual string EncodeSessionID(WorkContext work, WaveSession session, bool hasApiHeaders)
Parameters
Returns
Type |
Description |
System.String |
|
Extracts session ID from work request. The default implementation uses cookie
Declaration
protected virtual Guid? ExtractSessionID(WorkContext work, out ulong idSecret)
Parameters
Type |
Name |
Description |
WorkContext |
work |
|
System.UInt64 |
idSecret |
|
Returns
Type |
Description |
System.Nullable<System.Guid> |
|
FetchExistingOrMakeNewSession(WorkContext, Boolean)
Override to get session object using whatever parameters are available in response context (i.e. a cookie),
or create a new one if 'onlyExisting'=false(default)
Declaration
protected virtual void FetchExistingOrMakeNewSession(WorkContext work, bool onlyExisting = false)
Parameters
Type |
Name |
Description |
WorkContext |
work |
|
System.Boolean |
onlyExisting |
|
MakeNewSession(WorkContext)
Called to create a new session
Declaration
protected WaveSession MakeNewSession(WorkContext work)
Parameters
Returns
MakeNewSessionInstance(WorkContext)
Override to create a new session instance
Declaration
protected virtual WaveSession MakeNewSessionInstance(WorkContext work)
Parameters
Returns
StowSession(WorkContext)
Override to put session object back into whatever storage medium is provided (i.e. DB) and
respond with appropriate session identifying token(i.e. a cookie)
Declaration
protected virtual void StowSession(WorkContext work)
Parameters
TryMakeSessionFromExistingLongTermToken(WorkContext)
Override in session filters that support long-term tokens.
This method tries to re-create "existing" session from a valid long-term token, otherwise
null should be returned (the base implementation)
Declaration
protected virtual WaveSession TryMakeSessionFromExistingLongTermToken(WorkContext work)
Parameters
Returns
Implements
System.IDisposable
Extension Methods