Class CookieSsoSessionStore
The single sign-on session store implemented using a cookie.
Implements
Inherited Members
Namespace: ComponentSpace.Saml2.Session
Assembly: ComponentSpace.Saml2.dll
Syntax
public class CookieSsoSessionStore : ISsoSessionStore
Constructors
CookieSsoSessionStore(IOptionsMonitor<CookieSsoSessionStoreOptions>, IDataProtectionProvider, IHttpRequest, IHttpResponse, ILoggerFactory)
Initializes a new instance of the CookieSsoSessionStore
class.
Declaration
public CookieSsoSessionStore(IOptionsMonitor<CookieSsoSessionStoreOptions> cookieSsoSessionStoreOptions, IDataProtectionProvider dataProtectionProvider, IHttpRequest request, IHttpResponse response, ILoggerFactory loggerFactory)
Parameters
Type | Name | Description |
---|---|---|
IOptionsMonitor<CookieSsoSessionStoreOptions> | cookieSsoSessionStoreOptions | The cookie SSO session store options. |
IDataProtectionProvider | dataProtectionProvider | The data protection provider used to secure the cookie value. |
IHttpRequest | request | The HTTP request. |
IHttpResponse | response | The HTTP response. |
ILoggerFactory | loggerFactory | The logger factory. |
Properties
SessionID
Gets the unique SSO session identifier.
Declaration
public virtual string SessionID { get; }
Property Value
Type | Description |
---|---|
string | The unique SSO session identifier. |
Methods
AddCookie(string, string, CookieOptions)
Adds the SAML session cookie to the HTTP response.
Declaration
protected virtual void AddCookie(string cookieName, string cookieValue, CookieOptions cookieOptions)
Parameters
Type | Name | Description |
---|---|---|
string | cookieName | The cookie name. |
string | cookieValue | The cookie value. |
CookieOptions | cookieOptions | The cookie options. |
Compress(string)
Compresses the string.
Declaration
protected virtual string Compress(string stringToCompress)
Parameters
Type | Name | Description |
---|---|---|
string | stringToCompress | The string to compress. |
Returns
Type | Description |
---|---|
string | The compressed string. |
DecodeCookieValue<T>(string)
Decodes the cookie value.
Declaration
protected virtual T DecodeCookieValue<T>(string encodedCookieValue)
Parameters
Type | Name | Description |
---|---|---|
string | encodedCookieValue | The encoded cookie value. |
Returns
Type | Description |
---|---|
T | The cookie value. |
Type Parameters
Name | Description |
---|---|
T | The cookie value type. |
Decompress(string)
Decompresses the string.
Declaration
protected virtual string Decompress(string compressedString)
Parameters
Type | Name | Description |
---|---|---|
string | compressedString | The compressed string. |
Returns
Type | Description |
---|---|
string | The decompressed string. |
Deserialize<T>(string)
Deserialize the object from a string.
Declaration
protected virtual T Deserialize<T>(string serializedObject)
Parameters
Type | Name | Description |
---|---|---|
string | serializedObject | The object serialized as a string. |
Returns
Type | Description |
---|---|
T | The object. |
Type Parameters
Name | Description |
---|---|
T | The object type. |
EncodeCookieValue(object)
Encodes the cookie value.
Declaration
protected virtual string EncodeCookieValue(object cookieValue)
Parameters
Type | Name | Description |
---|---|---|
object | cookieValue | The cookie value. |
Returns
Type | Description |
---|---|
string | The encoded cookie value. |
LoadAsync<T>()
Loads the SSO session object.
Declaration
public virtual Task<T> LoadAsync<T>()
Returns
Type | Description |
---|---|
Task<T> | A task that represents the operation and returns the SSO session object or |
Type Parameters
Name | Description |
---|---|
T |
Protect(string)
Protects the data.
Declaration
protected virtual string Protect(string dataToProtect)
Parameters
Type | Name | Description |
---|---|---|
string | dataToProtect | The data to protect. |
Returns
Type | Description |
---|---|
string | The protected data. |
RefreshAsync<T>()
Refreshes the SSO session object so the sliding expiration is reset.
Declaration
public virtual Task RefreshAsync<T>()
Returns
Type | Description |
---|---|
Task | A task that represents the operation. |
Type Parameters
Name | Description |
---|---|
T |
RemoveAsync<T>()
Removes the SSO session object.
Declaration
public virtual Task RemoveAsync<T>()
Returns
Type | Description |
---|---|
Task | A task that represents the operation. |
Type Parameters
Name | Description |
---|---|
T |
SaveAsync(object)
Saves the SSO session object.
Declaration
public virtual Task SaveAsync(object ssoSession)
Parameters
Type | Name | Description |
---|---|---|
object | ssoSession | The SSO session object. |
Returns
Type | Description |
---|---|
Task | A task that represents the operation. |
Serialize(object)
Serialize the object to a string.
Declaration
protected virtual string Serialize(object objectToSerialize)
Parameters
Type | Name | Description |
---|---|---|
object | objectToSerialize | The object to serialize. |
Returns
Type | Description |
---|---|
string | The object serialized as a string. |
Unprotect(string)
Unprotects the data.
Declaration
protected virtual string Unprotect(string protectedData)
Parameters
Type | Name | Description |
---|---|---|
string | protectedData | The protected data. |
Returns
Type | Description |
---|---|
string | The unprotected data. |