Interface ISessionStorage
- Namespace
- DuetWebServer.Singletons
- Assembly
- DuetWebServer.dll
Interface for accessing the session storage singleton
public interface ISessionStorage
Methods
CacheMessage(string)
Cache an incoming generic message
void CacheMessage(string message)
Parameters
messagestringMessage to cache
CheckSessionKey(string, bool)
Check if the given session key provides the requested access to the given policy
bool CheckSessionKey(string key, bool readWrite)
Parameters
Returns
- bool
True if access is granted
GetCachedMessages(ClaimsPrincipal)
Retrieve the cached messages of a given user
string GetCachedMessages(ClaimsPrincipal user)
Parameters
userClaimsPrincipal
Returns
- string
Cached messages
GetSessionId(string)
Get a session ID from the given key
int GetSessionId(string key)
Parameters
keystringKey to query
Returns
- int
Session ID or -1
GetTicketFromIpAddress(string)
Get a ticket from the given IP address
AuthenticationTicket? GetTicketFromIpAddress(string ipAddress)
Parameters
ipAddressstringIP address to query
Returns
- AuthenticationTicket
Authentication ticket or null
GetTicketFromKey(string)
Get a ticket from the given key
AuthenticationTicket? GetTicketFromKey(string key)
Parameters
keystringKey to query
Returns
- AuthenticationTicket
Authentication ticket or null
MaintainSessions(TimeSpan, string)
Remove sessions that are no longer active
void MaintainSessions(TimeSpan sessionTimeout, string socketPath)
Parameters
MakeSessionKey(int, string, bool)
Make a new session key and register it if the session ID is valid
string MakeSessionKey(int sessionId, string ipAddress, bool readWrite)
Parameters
sessionIdintDSF session ID
ipAddressstringOptional IP address to store for IP address-based authentification
readWriteboolWhether the client has read-write or read-only access
Returns
- string
Authentication ticket
MakeSessionTicket(int, string, bool)
Make a new session ticket and register it if the session ID is valid
AuthenticationTicket MakeSessionTicket(int sessionId, string ipAddress, bool readWrite)
Parameters
sessionIdintDSF session ID
ipAddressstringOptional IP address to store for IP address-based authentification
readWriteboolWhether the client has read-write or read-only access
Returns
- AuthenticationTicket
Authentication ticket
RemoveTicket(ClaimsPrincipal)
Remove a session ticket returning the corresponding session ID
int RemoveTicket(ClaimsPrincipal user)
Parameters
userClaimsPrincipal
Returns
- int
Session ID or 0 if none was found
SetLongRunningHttpRequest(ClaimsPrincipal, bool)
Set whether a potentially long-running HTTP request has started or finished
void SetLongRunningHttpRequest(ClaimsPrincipal user, bool requestStarted)
Parameters
userClaimsPrincipalPrincipal user
requestStartedboolWhether a WebSocket is connected
SetWebSocketState(string, bool)
Set whether a given socket is connected over WebSocket
void SetWebSocketState(string key, bool webSocketConnected)