Class BaseSession
Implements base ISession functionality
Inheritance
System.Object
BaseSession
Implements
System.Security.Principal.IPrincipal
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)
System.Object.ToString()
Assembly: Azos.dll
Syntax
[Serializable]
public class BaseSession : ISession, IPrincipal
Constructors
BaseSession()
Declaration
BaseSession(Guid, UInt64)
Declaration
public BaseSession(Guid id, ulong secret)
Parameters
| Type |
Name |
Description |
| System.Guid |
id |
|
| System.UInt64 |
secret |
|
Properties
ID
Declaration
Property Value
| Type |
Description |
| System.Guid |
|
IDSecret
Returns Session ID secret - the ulong that identifies this session.
This property is needed for cross-check upon GUID id lookup, so that
Session ID GUID can not be forged by the client - a form of a "password"
Declaration
public ulong IDSecret { get; }
Property Value
| Type |
Description |
| System.UInt64 |
|
IsEnded
Indicates whether this session was ended and will be destroyed after current request processing cycle
Declaration
public bool IsEnded { get; }
Property Value
| Type |
Description |
| System.Boolean |
|
IsJustLoggedIn
Indicates that user login happened in current request processing cycle. This flag is
useful for long term token assignment on release
Declaration
public bool IsJustLoggedIn { get; }
Property Value
| Type |
Description |
| System.Boolean |
|
IsNew
Indicates that session object was just created with current request processing cycle
Declaration
public bool IsNew { get; }
Property Value
| Type |
Description |
| System.Boolean |
|
Item[Object]
Shortcut to .Items. Getter return null instead of throwing if key is not found
Declaration
public object this[object key] { get; set; }
Parameters
| Type |
Name |
Description |
| System.Object |
key |
|
Property Value
| Type |
Description |
| System.Object |
|
Items
Provides a thread-safe dictionary of items
Declaration
public IDictionary<object, object> Items { get; }
Property Value
| Type |
Description |
| System.Collections.Generic.IDictionary<System.Object, System.Object> |
|
LanguageISOCode
Returns user language preference or null
Declaration
public virtual string LanguageISOCode { get; }
Property Value
| Type |
Description |
| System.String |
|
LastLoginType
Returns the last login type
Declaration
public SessionLoginType LastLoginType { get; }
Property Value
LastLoginUTC
Returns the UTC DateTime of the last login/when HasJustLoggedIn() was called for the last time within the lifetime of this session object or NULL
Declaration
public DateTime? LastLoginUTC { get; }
Property Value
| Type |
Description |
| System.Nullable<System.DateTime> |
|
OldID
When this parameter is not null then RegenerateID() was called and session provider may need to re-stow session object under a new ID
Declaration
public Guid? OldID { get; }
Property Value
| Type |
Description |
| System.Nullable<System.Guid> |
|
User
Declaration
public User User { get; set; }
Property Value
Methods
Acquire()
Declaration
public virtual void Acquire()
End()
Declaration
public virtual void End()
HasJustLoggedIn(SessionLoginType, DateTime)
Called from business code when user supplies login credentials and/or performs another action
that can be qualified as a reliable user identity proof
Declaration
public virtual void HasJustLoggedIn(SessionLoginType loginType, DateTime utcNow)
Parameters
RegenerateID()
Generates new GUID and stores it in ID storing old ID value in OldID property which is not serializable.
The implementations may elect to re-stow the existing session under the new ID.
This method is useful for security, i.e. when user logs-in we may want to re-generate ID
Declaration
public void RegenerateID()
Release()
Declaration
public virtual void Release()
Explicit Interface Implementations
IPrincipal.Identity
Declaration
IIdentity IPrincipal.Identity { get; }
Returns
| Type |
Description |
| System.Security.Principal.IIdentity |
|
IPrincipal.IsInRole(String)
Declaration
bool IPrincipal.IsInRole(string role)
Parameters
| Type |
Name |
Description |
| System.String |
role |
|
Returns
| Type |
Description |
| System.Boolean |
|
Implements
System.Security.Principal.IPrincipal
Extension Methods