Table of Contents

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

cookieSsoSessionStoreOptions IOptionsMonitor<CookieSsoSessionStoreOptions>

The cookie SSO session store options.

dataProtectionProvider IDataProtectionProvider

The data protection provider used to secure the cookie value.

request IHttpRequest

The HTTP request.

response IHttpResponse

The HTTP response.

loggerFactory ILoggerFactory

The 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

cookieName string

The cookie name.

cookieValue string

The cookie value.

cookieOptions CookieOptions

The cookie options.

Compress(string)

Compresses the string.

protected virtual string Compress(string stringToCompress)

Parameters

stringToCompress string

The string to compress.

Returns

string

The compressed string.

DecodeCookieValue<T>(string)

Decodes the cookie value.

protected virtual T DecodeCookieValue<T>(string encodedCookieValue)

Parameters

encodedCookieValue string

The encoded cookie value.

Returns

T

The cookie value.

Type Parameters

T

The cookie value type.

Decompress(string)

Decompresses the string.

protected virtual string Decompress(string compressedString)

Parameters

compressedString string

The compressed string.

Returns

string

The decompressed string.

Deserialize<T>(string)

Deserialize the object from a string.

protected virtual T Deserialize<T>(string serializedObject)

Parameters

serializedObject string

The object serialized as a string.

Returns

T

The object.

Type Parameters

T

The object type.

EncodeCookieValue(object)

Encodes the cookie value.

protected virtual string EncodeCookieValue(object cookieValue)

Parameters

cookieValue object

The 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 null if none.

Type Parameters

T

Protect(string)

Protects the data.

protected virtual string Protect(string dataToProtect)

Parameters

dataToProtect string

The 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

ssoSession object

The 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

objectToSerialize object

The object to serialize.

Returns

string

The object serialized as a string.

Unprotect(string)

Unprotects the data.

protected virtual string Unprotect(string protectedData)

Parameters

protectedData string

The protected data.

Returns

string

The unprotected data.