SessionExtensions
Configure ServiceStack to have ISession support
Assembly: ServiceStack.dll
Declaration
public static class SessionExtensions
Methods
GetOrCreateSessionId(IRequest)
Declaration
public static string GetOrCreateSessionId(this IRequest httpReq)
Returns
System.String
Parameters
SetSessionId(IRequest, String)
Declaration
public static void SetSessionId(this IRequest req, string sessionId)
Parameters
GetSessionId(IRequest)
Declaration
public static string GetSessionId(this IRequest req)
Returns
System.String
Parameters
GetPermanentSessionId(IRequest)
Declaration
public static string GetPermanentSessionId(this IRequest httpReq)
Returns
System.String
Parameters
GetTemporarySessionId(IRequest)
Declaration
public static string GetTemporarySessionId(this IRequest httpReq)
Returns
System.String
Parameters
GetSessionParam(IRequest, String)
Declaration
public static string GetSessionParam(this IRequest httpReq, string sessionKey)
Returns
System.String
Parameters
CreateSessionId(IResponse, IRequest)
Create the active Session or Permanent Session Id cookie.
Declaration
public static string CreateSessionId(this IResponse res, IRequest req)
Returns
System.String
Parameters
CreateSessionIds(IResponse, IRequest)
Create both Permanent and Session Id cookies and return the active sessionId
Declaration
public static string CreateSessionIds(this IResponse res, IRequest req)
Returns
System.String
Parameters
CreateRandomSessionId()
Declaration
public static string CreateRandomSessionId()
Returns
System.String
PopulateWithSecureRandomBytes(Byte[])
Declaration
public static void PopulateWithSecureRandomBytes(byte[] bytes)
Parameters
Type | Name |
---|
System.Byte[] | bytes |
CreateRandomBase64Id(Int32)
Declaration
public static string CreateRandomBase64Id(int size = 15)
Returns
System.String
Parameters
CreateRandomBase62Id(Int32)
Declaration
public static string CreateRandomBase62Id(int size)
Returns
System.String
Parameters
Declaration
public static bool Base64StringContainsUrlUnfriendlyChars(string base64)
Returns
System.Boolean
Parameters
Type | Name |
---|
System.String | base64 |
CreatePermanentSessionId(IResponse, IRequest)
Declaration
public static string CreatePermanentSessionId(this IResponse res, IRequest req)
Returns
System.String
Parameters
CreateTemporarySessionId(IResponse, IRequest)
Declaration
public static string CreateTemporarySessionId(this IResponse res, IRequest req)
Returns
System.String
Parameters
CreateSessionId(IRequest, IResponse, String, String)
Declaration
public static string CreateSessionId(this IRequest req, IResponse res, string sessionKey, string sessionId)
Returns
System.String
Parameters
CreateTemporarySessionId(IRequest, String)
Declaration
public static string CreateTemporarySessionId(this IRequest req, string sessionId)
Returns
System.String
Parameters
CreatePermanentSessionId(IRequest, String)
Declaration
public static string CreatePermanentSessionId(this IRequest req, string sessionId)
Returns
System.String
Parameters
IsPermanentSession(IRequest)
Declaration
public static bool IsPermanentSession(this IRequest req)
Returns
System.Boolean
Parameters
GetSessionOptions(IRequest)
Declaration
public static HashSet<string> GetSessionOptions(this IRequest httpReq)
Returns
System.Collections.Generic.HashSet<System.String>
Parameters
GetUserAuthName(IAuthSession)
Declaration
public static string GetUserAuthName(this IAuthSession session)
Returns
System.String
Parameters
GetUserAuthIdOrName(IAuthSession)
Declaration
public static string GetUserAuthIdOrName(this IAuthSession session)
Returns
System.String
Parameters
UpdateSession(IAuthSession, IUserAuth)
Declaration
public static void UpdateSession(this IAuthSession session, IUserAuth userAuth)
Parameters
AddSessionOptions(IRequest, String[])
Declaration
public static HashSet<string> AddSessionOptions(this IRequest req, params string[] options)
Returns
System.Collections.Generic.HashSet<System.String>
Parameters
GetSessionKey(IRequest)
Declaration
public static string GetSessionKey(IRequest httpReq = null)
Returns
System.String
Parameters
SessionAs<TUserSession>(ICacheClient, IRequest, IResponse)
Declaration
public static TUserSession SessionAs<TUserSession>(this ICacheClient cache, IRequest httpReq = null, IResponse httpRes = null)
Returns
<TUserSession>
Parameters
Type Parameters
SessionAsAsync<TUserSession>(ICacheClientAsync, IRequest, IResponse, CancellationToken)
Declaration
public static Task<TUserSession> SessionAsAsync<TUserSession>(this ICacheClientAsync cache, IRequest httpReq = null, IResponse httpRes = null, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task<<TUserSession>>
Parameters
Type Parameters
GetUntypedSession(ICacheClient, IRequest, IResponse)
Declaration
public static IAuthSession GetUntypedSession(this ICacheClient cache, IRequest httpReq = null, IResponse httpRes = null)
Returns
ServiceStack.Auth.IAuthSession
Parameters
GetUntypedSessionAsync(ICacheClientAsync, IRequest, IResponse, CancellationToken)
Declaration
public static async Task<IAuthSession> GetUntypedSessionAsync(this ICacheClientAsync cache, IRequest httpReq = null, IResponse httpRes = null, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task<ServiceStack.Auth.IAuthSession>
Parameters
ClearSession(ICacheClient, IRequest)
Declaration
public static void ClearSession(this ICacheClient cache, IRequest httpReq = null)
Parameters
ClearSessionAsync(ICacheClientAsync, IRequest, CancellationToken)
Declaration
public static Task ClearSessionAsync(this ICacheClientAsync cache, IRequest httpReq = null, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task
Parameters
GetSessionBag(IRequest)
Declaration
public static ISession GetSessionBag(this IRequest request)
Returns
ServiceStack.Caching.ISession
Parameters
GetSessionBagAsync(IRequest, CancellationToken)
Declaration
public static ISessionAsync GetSessionBagAsync(this IRequest request, CancellationToken token = default(CancellationToken))
Returns
ServiceStack.Caching.ISessionAsync
Parameters
GetSessionBag(IServiceBase)
Declaration
public static ISession GetSessionBag(this IServiceBase service)
Returns
ServiceStack.Caching.ISession
Parameters
GetSessionBagAsync(IServiceBase, CancellationToken)
Declaration
public static ISessionAsync GetSessionBagAsync(this IServiceBase service, CancellationToken token = default(CancellationToken))
Returns
ServiceStack.Caching.ISessionAsync
Parameters
Get<T>(ISession)
Declaration
public static T Get<T>(this ISession session)
Returns
<T>
Parameters
Type Parameters
GetAsync<T>(ISessionAsync, CancellationToken)
Declaration
public static Task<T> GetAsync<T>(this ISessionAsync session, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task<<T>>
Parameters
Type Parameters
Set<T>(ISession, T)
Declaration
public static void Set<T>(this ISession session, T value)
Parameters
Type Parameters
SetAsync<T>(ISessionAsync, T, CancellationToken)
Declaration
public static Task SetAsync<T>(this ISessionAsync session, T value, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task
Parameters
Type Parameters
Remove<T>(ISession)
Declaration
public static void Remove<T>(this ISession session)
Parameters
Type Parameters
RemoveAsync<T>(ISessionAsync, CancellationToken)
Declaration
public static Task RemoveAsync<T>(this ISessionAsync session, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task
Parameters
Type Parameters
DeleteSessionCookies(IResponse)
Declaration
public static void DeleteSessionCookies(this IResponse response)
Parameters
DeleteJwtCookie(IResponse)
Declaration
public static void DeleteJwtCookie(this IResponse response)
Parameters
GenerateNewSessionCookiesAsync(IRequest, IAuthSession, CancellationToken)
Declaration
public static async Task GenerateNewSessionCookiesAsync(this IRequest req, IAuthSession session, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task
Parameters
ToAuthUserSession(IAuthSession)
Declaration
public static AuthUserSession ToAuthUserSession(this IAuthSession session)
Returns
ServiceStack.AuthUserSession
Parameters
FromAuthUserSession(AuthUserSession)
Declaration
public static IAuthSession FromAuthUserSession(this AuthUserSession session)
Returns
ServiceStack.Auth.IAuthSession
Parameters