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