Skip to main content

JwtAuthProviderReader

Enable access to protected Services using JWT Tokens

Assembly: ServiceStack.dll​
View Source​
Declaration
public class JwtAuthProviderReader : AuthProvider, IAuthProvider, IAuthWithRequest, IAuthPlugin

Properties​

Type​

View Source​
Declaration
public override string Type { get; }

RequireSecureConnection​

Whether to only allow access via API Key from a secure connection. (default true)

View Source​
Declaration
public bool RequireSecureConnection { get; set; }

CreateHeaderFilter​

Run custom filter after JWT Header is created

View Source​
Declaration
public Action<JsonObject, IAuthSession> CreateHeaderFilter { get; set; }

CreatePayloadFilter​

Run custom filter after JWT Payload is created

View Source​
Declaration
public Action<JsonObject, IAuthSession> CreatePayloadFilter { get; set; }

PopulateSessionFilter​

Run custom filter after session is restored from a JWT Token

View Source​
Declaration
public Action<IAuthSession, JsonObject, IRequest> PopulateSessionFilter { get; set; }

EncryptPayload​

Whether to encrypt JWE Payload (default false). Uses RSA-OAEP for Key Encryption and AES/128/CBC HMAC SHA256 for Content Encryption

View Source​
Declaration
public bool EncryptPayload { get; set; }

HashAlgorithm​

Which Hash Algorithm should be used to sign the JWT Token. (default HS256)

View Source​
Declaration
public string HashAlgorithm { get; set; }

RequireHashAlgorithm​

Whether to only allow processing of JWT Tokens using the configured HashAlgorithm. (default true)

View Source​
Declaration
public bool RequireHashAlgorithm { get; set; }

Issuer​

The Issuer to embed in the token. (default ssjwt)

View Source​
Declaration
public string Issuer { get; set; }

Audience​

The Audience to embed in the token. (default null)

View Source​
Declaration
public string Audience { get; set; }

Audiences​

Embed Multiple Audiences in the token. (default none) A JWT is valid if it contains ANY audience in this List

View Source​
Declaration
public List<string> Audiences { get; set; }

RequiresAudience​

Tokens must contain aud which is validated

View Source​
Declaration
public bool RequiresAudience { get; set; }

KeyId​

What Id to use to identify the Key used to sign the token. (default First 3 chars of Base64 Key)

View Source​
Declaration
public string KeyId { get; set; }

AuthKey​

The AuthKey used to sign the JWT Token

View Source​
Declaration
public byte[] AuthKey { get; set; }

AuthKeyBase64​

View Source​
Declaration
public string AuthKeyBase64 { set; }

FallbackAuthKeys​

Allow verification using multiple Auth keys

View Source​
Declaration
public List<byte[]> FallbackAuthKeys { get; set; }

PrivateKey​

View Source​
Declaration
public RSAParameters? PrivateKey { get; set; }

PrivateKeyXml​

Convenient overload to initialize the Private Key via exported XML

View Source​
Declaration
public string PrivateKeyXml { get; set; }

PublicKey​

The RSA Public Key used to Verify the JWT Token when RSA is used

View Source​
Declaration
public RSAParameters? PublicKey { get; set; }

PublicKeyXml​

Convenient overload to initialize the Public Key via exported XML

View Source​
Declaration
public string PublicKeyXml { get; set; }

FallbackPublicKeys​

Allow verification using multiple public keys

View Source​
Declaration
public List<RSAParameters> FallbackPublicKeys { get; set; }

FallbackPrivateKeys​

Allow verification using multiple private keys for JWE tokens

View Source​
Declaration
public List<RSAParameters> FallbackPrivateKeys { get; set; }

ExpireTokensIn​

How long should JWT Tokens be valid for. (default 14 days)

View Source​
Declaration
public TimeSpan ExpireTokensIn { get; set; }

ExpireRefreshTokensIn​

How long should JWT Refresh Tokens be valid for. (default 365 days)

View Source​
Declaration
public TimeSpan ExpireRefreshTokensIn { get; set; }

ExpireTokensInDays​

Convenient overload to initialize ExpireTokensIn with an Integer

View Source​
Declaration
public int ExpireTokensInDays { set; }

ValidateToken​

Allow custom logic to invalidate JWT Tokens

View Source​
Declaration
public Func<JsonObject, IRequest, bool> ValidateToken { get; set; }

ValidateRefreshToken​

Allow custom logic to invalidate Refresh Tokens

View Source​
Declaration
public Func<JsonObject, IRequest, bool> ValidateRefreshToken { get; set; }

InvalidateTokensIssuedBefore​

Whether to invalidate all JWT Access Tokens issued before a specified date.

View Source​
Declaration
public DateTime? InvalidateTokensIssuedBefore { get; set; }

InvalidateRefreshTokensIssuedBefore​

Whether to invalidate all JWT Refresh Tokens issued before a specified date.

View Source​
Declaration
public DateTime? InvalidateRefreshTokensIssuedBefore { get; set; }

ServiceRoutes​

Modify the registration of ConvertSessionToToken Service

View Source​
Declaration
public Dictionary<Type, string[]> ServiceRoutes { get; set; }

AllowInQueryString​

Allow JWT in ?ss-tok=jwt QueryString. (default false)

View Source​
Declaration
public bool AllowInQueryString { get; set; }

AllowInFormData​

Allow JWT in ss-tok=jwt HTML POST FormData. (default false)

View Source​
Declaration
public bool AllowInFormData { get; set; }

RemoveInvalidTokenCookie​

Whether to automatically remove expired or invalid cookies

View Source​
Declaration
public bool RemoveInvalidTokenCookie { get; set; }

IncludeJwtInConvertSessionToTokenResponse​

Whether to also Include Token in ConvertSessionToTokenResponse

View Source​
Declaration
public bool IncludeJwtInConvertSessionToTokenResponse { get; set; }

UseTokenCookie​

Whether to store JWTs in Cookies (ss-tok) for successful Authentications (default true)

View Source​
Declaration
public bool UseTokenCookie { get; set; }

ResolveUnixTime​

Override conversion to Unix Time used in issuing JWTs and validation

View Source​
Declaration
public Func<DateTime, long> ResolveUnixTime { get; set; }

PreValidateJwtPayloadFilter​

Inspect or modify JWT Payload before validation, return error message if invalid else null

View Source​
Declaration
public Func<Dictionary<string, string>, string> PreValidateJwtPayloadFilter { get; set; }

ResolveJwtId​

Change resolution for resolving unique jti id for Access Tokens

View Source​
Declaration
public Func<IRequest, string> ResolveJwtId { get; set; }

ResolveRefreshJwtId​

Change resolution for resolving unique jti id for Refresh Tokens

View Source​
Declaration
public Func<IRequest, string> ResolveRefreshJwtId { get; set; }

InvalidateJwtIds​

Invalidate JWTs with ids

View Source​
Declaration
public HashSet<string> InvalidateJwtIds { get; set; }

Inherited Properties​

AccountLockedValidator​

View Source​
Declaration
public Func<IAuthRepository, IUserAuth, IAuthTokens, bool> AccountLockedValidator { get; set; }

AuthEvents​

View Source​
Declaration
public IAuthEvents AuthEvents { get; }

AuthRealm​

View Source​
Declaration
public string AuthRealm { get; set; }

CallbackUrl​

View Source​
Declaration
public string CallbackUrl { get; set; }

CustomValidationFilter​

View Source​
Declaration
public Func<AuthContext, IHttpResult> CustomValidationFilter { get; set; }

ExcludeAuthInfoItems​

View Source​
Declaration
public HashSet<string> ExcludeAuthInfoItems { get; set; }

FormLayout​

View Source​
Declaration
public List<InputInfo> FormLayout { get; set; }

Icon​

View Source​
Declaration
public ImageInfo Icon { get; set; }

Label​

View Source​
Declaration
public string Label { get; set; }

LoadUserAuthFilter​

View Source​
Declaration
public Action<AuthUserSession, IAuthTokens, Dictionary<string, string>> LoadUserAuthFilter { get; set; }

LoadUserAuthInfoFilterAsync​

View Source​
Declaration
public Func<AuthUserSession, IAuthTokens, Dictionary<string, string>, CancellationToken, Task> LoadUserAuthInfoFilterAsync { get; set; }

Meta​

View Source​
Declaration
public virtual Dictionary<string, string> Meta { get; }

NavItem​

View Source​
Declaration
public NavItem NavItem { get; set; }

PersistSession​

View Source​
Declaration
public bool PersistSession { get; set; }

Provider​

View Source​
Declaration
public string Provider { get; set; }

RedirectUrl​

View Source​
Declaration
public string RedirectUrl { get; set; }

RestoreSessionFromState​

View Source​
Declaration
public bool? RestoreSessionFromState { get; set; }

SaveExtendedUserInfo​

View Source​
Declaration
public bool SaveExtendedUserInfo { get; set; }

SessionExpiry​

View Source​
Declaration
public TimeSpan? SessionExpiry { get; set; }

Sort​

View Source​
Declaration
public int Sort { get; set; }

Type​

View Source​
Declaration
public virtual string Type { get; }

Fields​

UseRsaKeyLength​

View Source​
Declaration
public static RsaKeyLengths UseRsaKeyLength

Name​

View Source​
Declaration
public const string Name = "jwt"

Realm​

View Source​
Declaration
public const string Realm = "/auth/jwt"

IgnoreForOperationTypes​

View Source​
Declaration
public static readonly HashSet<string> IgnoreForOperationTypes

HmacAlgorithms​

Different HMAC Algorithms supported

View Source​
Declaration
public static readonly Dictionary<string, Func<byte[], byte[], byte[]>> HmacAlgorithms

RsaSignAlgorithms​

Different RSA Signing Algorithms supported

View Source​
Declaration
public static readonly Dictionary<string, Func<RSAParameters, byte[], byte[]>> RsaSignAlgorithms

RsaVerifyAlgorithms​

View Source​
Declaration
public static readonly Dictionary<string, Func<RSAParameters, byte[], byte[], bool>> RsaVerifyAlgorithms

Methods​

GetAuthKey(IRequest)​

View Source​
Declaration
public byte[] GetAuthKey(IRequest req = null)
Returns​

System.Byte[]

Parameters​
TypeName
ServiceStack.Web.IRequestreq

GetFallbackAuthKeys(IRequest)​

View Source​
Declaration
public List<byte[]> GetFallbackAuthKeys(IRequest req = null)
Returns​

System.Collections.Generic.List<System.Byte[]>

Parameters​
TypeName
ServiceStack.Web.IRequestreq

GetPrivateKey(IRequest)​

View Source​
Declaration
public RSAParameters? GetPrivateKey(IRequest req = null)
Returns​

System.Nullable<System.Security.Cryptography.RSAParameters>

Parameters​
TypeName
ServiceStack.Web.IRequestreq

GetPublicKey(IRequest)​

View Source​
Declaration
public RSAParameters? GetPublicKey(IRequest req = null)
Returns​

System.Nullable<System.Security.Cryptography.RSAParameters>

Parameters​
TypeName
ServiceStack.Web.IRequestreq

GetFallbackPublicKeys(IRequest)​

View Source​
Declaration
public List<RSAParameters> GetFallbackPublicKeys(IRequest req = null)
Returns​

System.Collections.Generic.List<System.Security.Cryptography.RSAParameters>

Parameters​
TypeName
ServiceStack.Web.IRequestreq

GetFallbackPrivateKeys(IRequest)​

View Source​
Declaration
public List<RSAParameters> GetFallbackPrivateKeys(IRequest req = null)
Returns​

System.Collections.Generic.List<System.Security.Cryptography.RSAParameters>

Parameters​
TypeName
ServiceStack.Web.IRequestreq

DefaultResolveUnixTime(DateTime)​

View Source​
Declaration
public static long DefaultResolveUnixTime(DateTime dateTime)
Returns​

System.Int64

Parameters​
TypeName
System.DateTimedateTime

NextJwtId()​

Get the next AutoId for usage in jti JWT Access Tokens

View Source​
Declaration
public string NextJwtId()
Returns​

System.String

LastJwtId()​

Get the last jti AutoId generated

View Source​
Declaration
public string LastJwtId()
Returns​

System.String

NextRefreshJwtId()​

Get the next AutoId for usage in jti JWT Refresh Tokens

View Source​
Declaration
public string NextRefreshJwtId()
Returns​

System.String

LastRefreshJwtId()​

View Source​
Declaration
public string LastRefreshJwtId()
Returns​

System.String

Init(IAppSettings)​

View Source​
Declaration
public virtual void Init(IAppSettings appSettings = null)
Parameters​
TypeName
ServiceStack.Configuration.IAppSettingsappSettings

GetKeyId(IRequest)​

View Source​
Declaration
public virtual string GetKeyId(IRequest req)
Returns​

System.String

Parameters​
TypeName
ServiceStack.Web.IRequestreq

IsAuthorized(IAuthSession, IAuthTokens, Authenticate)​

View Source​
Declaration
public override bool IsAuthorized(IAuthSession session, IAuthTokens tokens, Authenticate request = null)
Returns​

System.Boolean

Parameters​
TypeName
ServiceStack.Auth.IAuthSessionsession
ServiceStack.Auth.IAuthTokenstokens
ServiceStack.Authenticaterequest

AuthenticateAsync(IServiceBase, IAuthSession, Authenticate, CancellationToken)​

View Source​
Declaration
public override Task<object> AuthenticateAsync(IServiceBase authService, IAuthSession session, Authenticate request, CancellationToken token = default(CancellationToken))
Returns​

System.Threading.Tasks.Task<System.Object>

Parameters​
TypeName
ServiceStack.IServiceBaseauthService
ServiceStack.Auth.IAuthSessionsession
ServiceStack.Authenticaterequest
System.Threading.CancellationTokentoken

PreAuthenticateAsync(IRequest, IResponse)​

View Source​
Declaration
public async Task PreAuthenticateAsync(IRequest req, IResponse res)
Returns​

System.Threading.Tasks.Task

Parameters​
TypeName
ServiceStack.Web.IRequestreq
ServiceStack.Web.IResponseres

AuthenticateBearerToken(IRequest, IResponse, String)​

View Source​
Declaration
protected virtual bool AuthenticateBearerToken(IRequest req, IResponse res, string bearerToken)
Returns​

System.Boolean

Parameters​
TypeName
ServiceStack.Web.IRequestreq
ServiceStack.Web.IResponseres
System.StringbearerToken

AuthenticateRefreshToken(IRequest, IResponse, String)​

View Source​
Declaration
protected virtual async Task<bool> AuthenticateRefreshToken(IRequest req, IResponse res, string refreshToken)
Returns​

System.Threading.Tasks.Task<System.Boolean>

Parameters​
TypeName
ServiceStack.Web.IRequestreq
ServiceStack.Web.IResponseres
System.StringrefreshToken

CreateAccessTokenFromRefreshToken(String, IRequest)​

View Source​
Declaration
public virtual Task<string> CreateAccessTokenFromRefreshToken(string refreshToken, IRequest req)
Returns​

System.Threading.Tasks.Task<System.String>

Parameters​
TypeName
System.StringrefreshToken
ServiceStack.Web.IRequestreq

IsJwtValid(String)​

View Source​
Declaration
public bool IsJwtValid(string jwt)
Returns​

System.Boolean

Parameters​
TypeName
System.Stringjwt

IsJwtValid(IRequest, String)​

View Source​
Declaration
public bool IsJwtValid(IRequest req, string jwt)
Returns​

System.Boolean

Parameters​
TypeName
ServiceStack.Web.IRequestreq
System.Stringjwt

IsJwtValid(IRequest)​

View Source​
Declaration
public bool IsJwtValid(IRequest req)
Returns​

System.Boolean

Parameters​
TypeName
ServiceStack.Web.IRequestreq

GetValidJwtPayload(String)​

View Source​
Declaration
public JsonObject GetValidJwtPayload(string jwt)
Returns​

ServiceStack.Text.JsonObject

Parameters​
TypeName
System.Stringjwt

GetValidJwtPayload(IRequest)​

Return token payload which is both verified and still valid

View Source​
Declaration
public virtual JsonObject GetValidJwtPayload(IRequest req)
Returns​

ServiceStack.Text.JsonObject

Parameters​
TypeName
ServiceStack.Web.IRequestreq

GetValidJwtPayload(IRequest, String)​

Return token payload which is both verified and still valid

View Source​
Declaration
public virtual JsonObject GetValidJwtPayload(IRequest req, string jwt)
Returns​

ServiceStack.Text.JsonObject

Parameters​
TypeName
ServiceStack.Web.IRequestreq
System.Stringjwt

ExtractHeader(String)​

View Source​
Declaration
public static Dictionary<string, object> ExtractHeader(string jwt)
Returns​

System.Collections.Generic.Dictionary<System.String,System.Object>

Parameters​
TypeName
System.Stringjwt

ExtractPayload(String)​

View Source​
Declaration
public static Dictionary<string, object> ExtractPayload(string jwt)
Returns​

System.Collections.Generic.Dictionary<System.String,System.Object>

Parameters​
TypeName
System.Stringjwt

Dump(String)​

View Source​
Declaration
public static string Dump(string jwt)
Returns​

System.String

Parameters​
TypeName
System.Stringjwt

GetVerifiedJwtPayload(String)​

Return token payload which has been verified to be created using the configured encryption key. Use GetValidJwtPayload() instead if you also want the payload validated.

View Source​
Declaration
public virtual JsonObject GetVerifiedJwtPayload(string jwt)
Returns​

ServiceStack.Text.JsonObject

Parameters​
TypeName
System.Stringjwt

GetVerifiedJwtPayload(IRequest, String[])​

Return token payload which has been verified to be created using the configured encryption key. Use GetValidJwtPayload() instead if you also want the payload validated.

View Source​
Declaration
public virtual JsonObject GetVerifiedJwtPayload(IRequest req, string[] parts)
Returns​

ServiceStack.Text.JsonObject

Parameters​
TypeName
ServiceStack.Web.IRequestreq
System.String[]parts

GetVerifiedJwePayload(String)​

Return token payload which has been verified to be created using the configured encryption key. Use GetValidJwtPayload() instead if you also want the payload validated.

View Source​
Declaration
public virtual JsonObject GetVerifiedJwePayload(string jwt)
Returns​

ServiceStack.Text.JsonObject

Parameters​
TypeName
System.Stringjwt

GetVerifiedJwePayload(IRequest, String[])​

Return token payload which has been verified to be created using the configured encryption key. Use GetValidJwePayload() instead if you also want the payload validated.

View Source​
Declaration
public virtual JsonObject GetVerifiedJwePayload(IRequest req, string[] parts)
Returns​

ServiceStack.Text.JsonObject

Parameters​
TypeName
ServiceStack.Web.IRequestreq
System.String[]parts

VerifyJwePayload(IRequest, String[], out Byte[], out Byte[], out Byte[])​

View Source​
Declaration
public virtual bool VerifyJwePayload(IRequest req, string[] parts, out byte[] iv, out byte[] cipherText, out byte[] cryptKey)
Returns​

System.Boolean

Parameters​
TypeName
ServiceStack.Web.IRequestreq
System.String[]parts
System.Byte[]iv
System.Byte[]cipherText
System.Byte[]cryptKey

ConvertJwtToSession(IRequest, String)​

View Source​
Declaration
public virtual IAuthSession ConvertJwtToSession(IRequest req, string jwt)
Returns​

ServiceStack.Auth.IAuthSession

Parameters​
TypeName
ServiceStack.Web.IRequestreq
System.Stringjwt

CreateSessionFromPayload(IRequest, JsonObject)​

View Source​
Declaration
public virtual IAuthSession CreateSessionFromPayload(IRequest req, JsonObject jwtPayload)
Returns​

ServiceStack.Auth.IAuthSession

Parameters​
TypeName
ServiceStack.Web.IRequestreq
ServiceStack.Text.JsonObjectjwtPayload

CreateSessionFromJwt(IRequest)​

View Source​
Declaration
public static IAuthSession CreateSessionFromJwt(IRequest req)
Returns​

ServiceStack.Auth.IAuthSession

Parameters​
TypeName
ServiceStack.Web.IRequestreq

AssertJwtPayloadIsValid(JsonObject)​

View Source​
Declaration
public void AssertJwtPayloadIsValid(JsonObject jwtPayload)
Parameters​
TypeName
ServiceStack.Text.JsonObjectjwtPayload

GetInvalidJwtPayloadError(JsonObject)​

View Source​
Declaration
public virtual string GetInvalidJwtPayloadError(JsonObject jwtPayload)
Returns​

System.String

Parameters​
TypeName
ServiceStack.Text.JsonObjectjwtPayload

AssertRefreshJwtPayloadIsValid(JsonObject)​

View Source​
Declaration
public void AssertRefreshJwtPayloadIsValid(JsonObject jwtPayload)
Parameters​
TypeName
ServiceStack.Text.JsonObjectjwtPayload

GetInvalidRefreshJwtPayloadError(JsonObject)​

View Source​
Declaration
public virtual string GetInvalidRefreshJwtPayloadError(JsonObject jwtPayload)
Returns​

System.String

Parameters​
TypeName
ServiceStack.Text.JsonObjectjwtPayload

HasInvalidatedId(JsonObject)​

View Source​
Declaration
public virtual bool HasInvalidatedId(JsonObject jwtPayload)
Returns​

System.Boolean

Parameters​
TypeName
ServiceStack.Text.JsonObjectjwtPayload

HasExpired(JsonObject)​

View Source​
Declaration
public virtual bool HasExpired(JsonObject jwtPayload)
Returns​

System.Boolean

Parameters​
TypeName
ServiceStack.Text.JsonObjectjwtPayload

HasInvalidNotBefore(JsonObject)​

View Source​
Declaration
public virtual bool HasInvalidNotBefore(JsonObject jwtPayload)
Returns​

System.Boolean

Parameters​
TypeName
ServiceStack.Text.JsonObjectjwtPayload

HasBeenInvalidated(JsonObject, Int64)​

View Source​
Declaration
public virtual bool HasBeenInvalidated(JsonObject jwtPayload, long unixTime)
Returns​

System.Boolean

Parameters​
TypeName
ServiceStack.Text.JsonObjectjwtPayload
System.Int64unixTime

HasInvalidAudience(JsonObject, out String)​

View Source​
Declaration
public virtual bool HasInvalidAudience(JsonObject jwtPayload, out string audience)
Returns​

System.Boolean

Parameters​
TypeName
ServiceStack.Text.JsonObjectjwtPayload
System.Stringaudience

VerifyPayload(IRequest, String, Byte[], Byte[])​

View Source​
Declaration
public virtual bool VerifyPayload(IRequest req, string algorithm, byte[] bytesToSign, byte[] sentSignatureBytes)
Returns​

System.Boolean

Parameters​
TypeName
ServiceStack.Web.IRequestreq
System.Stringalgorithm
System.Byte[]bytesToSign
System.Byte[]sentSignatureBytes

GetUnixTime(Dictionary<String, String>, String)​

View Source​
Declaration
public static long? GetUnixTime(Dictionary<string, string> jwtPayload, string key)
Returns​

System.Nullable<System.Int64>

Parameters​
TypeName
System.Collections.Generic.Dictionary<System.String,System.String>jwtPayload
System.Stringkey

Register(IAppHost, AuthFeature)​

View Source​
Declaration
public override void Register(IAppHost appHost, AuthFeature feature)
Parameters​
TypeName
ServiceStack.IAppHostappHost
ServiceStack.AuthFeaturefeature

AuthenticateResponseDecorator(AuthFilterContext)​

View Source​
Declaration
public object AuthenticateResponseDecorator(AuthFilterContext ctx)
Returns​

System.Object

Parameters​
TypeName
ServiceStack.Auth.AuthFilterContextctx

RegisterResponseDecorator(RegisterFilterContext)​

View Source​
Declaration
public object RegisterResponseDecorator(RegisterFilterContext ctx)
Returns​

System.Object

Parameters​
TypeName
ServiceStack.Auth.RegisterFilterContextctx

Inherited Methods​

AuthenticateAsync(IServiceBase, IAuthSession, Authenticate, CancellationToken)​

View Source​
Declaration
public abstract Task<object> AuthenticateAsync(IServiceBase authService, IAuthSession session, Authenticate request, CancellationToken token = default(CancellationToken))
Returns​

System.Threading.Tasks.Task<System.Object>

Parameters​
TypeName
ServiceStack.IServiceBaseauthService
ServiceStack.Auth.IAuthSessionsession
ServiceStack.Authenticaterequest
System.Threading.CancellationTokentoken

ConvertToClientError(Object, Boolean)​

View Source​
Declaration
protected virtual object ConvertToClientError(object failedResult, bool isHtml)
Returns​

System.Object

Parameters​
TypeName
System.ObjectfailedResult
System.BooleanisHtml

CreateAuthContext(IServiceBase, IAuthSession, IAuthTokens)​

View Source​
Declaration
protected virtual AuthContext CreateAuthContext(IServiceBase authService = null, IAuthSession session = null, IAuthTokens tokens = null)
Returns​

ServiceStack.Auth.AuthContext

Parameters​
TypeName
ServiceStack.IServiceBaseauthService
ServiceStack.Auth.IAuthSessionsession
ServiceStack.Auth.IAuthTokenstokens

CreateOrMergeAuthSession(IAuthSession, IAuthTokens)​

View Source​
Declaration
public virtual string CreateOrMergeAuthSession(IAuthSession session, IAuthTokens tokens)
Returns​

System.String

Parameters​
TypeName
ServiceStack.Auth.IAuthSessionsession
ServiceStack.Auth.IAuthTokenstokens

EmailAlreadyExistsAsync(IAuthRepositoryAsync, IUserAuth, IAuthTokens, CancellationToken)​

View Source​
Declaration
protected virtual async Task<bool> EmailAlreadyExistsAsync(IAuthRepositoryAsync authRepo, IUserAuth userAuth, IAuthTokens tokens = null, CancellationToken token = default(CancellationToken))
Returns​

System.Threading.Tasks.Task<System.Boolean>

Parameters​
TypeName
ServiceStack.Auth.IAuthRepositoryAsyncauthRepo
ServiceStack.Auth.IUserAuthuserAuth
ServiceStack.Auth.IAuthTokenstokens
System.Threading.CancellationTokentoken

FallbackConfig(String)​

Allows specifying a global fallback config that if exists is formatted with the Provider as the first arg. E.g. this appSetting with the TwitterAuthProvider: oauth.CallbackUrl="http://localhost:11001/auth/{0}" Would result in: oauth.CallbackUrl="http://localhost:11001/auth/twitter"

View Source​
Declaration
protected string FallbackConfig(string fallback)
Returns​

System.String

Parameters​
TypeName
System.Stringfallback

GetAuthRedirectUrl(IServiceBase, IAuthSession)​

View Source​
Declaration
protected virtual string GetAuthRedirectUrl(IServiceBase authService, IAuthSession session)
Returns​

System.String

Parameters​
TypeName
ServiceStack.IServiceBaseauthService
ServiceStack.Auth.IAuthSessionsession

GetAuthRepository(IRequest)​

View Source​
Declaration
protected virtual IAuthRepository GetAuthRepository(IRequest req)
Returns​

ServiceStack.Auth.IAuthRepository

Parameters​
TypeName
ServiceStack.Web.IRequestreq

GetAuthRepositoryAsync(IRequest)​

View Source​
Declaration
protected virtual IAuthRepositoryAsync GetAuthRepositoryAsync(IRequest req)
Returns​

ServiceStack.Auth.IAuthRepositoryAsync

Parameters​
TypeName
ServiceStack.Web.IRequestreq

GetReferrerUrl(IServiceBase, IAuthSession, Authenticate)​

View Source​
Declaration
protected virtual string GetReferrerUrl(IServiceBase authService, IAuthSession session, Authenticate request = null)
Returns​

System.String

Parameters​
TypeName
ServiceStack.IServiceBaseauthService
ServiceStack.Auth.IAuthSessionsession
ServiceStack.Authenticaterequest

GetUserAuthRepositoryAsync(IRequest)​

View Source​
Declaration
public IUserAuthRepositoryAsync GetUserAuthRepositoryAsync(IRequest request)
Returns​

ServiceStack.Auth.IUserAuthRepositoryAsync

Parameters​
TypeName
ServiceStack.Web.IRequestrequest

IsAccountLockedAsync(IAuthRepositoryAsync, IUserAuth, IAuthTokens, CancellationToken)​

View Source​
Declaration
public virtual Task<bool> IsAccountLockedAsync(IAuthRepositoryAsync authRepoAsync, IUserAuth userAuth, IAuthTokens tokens = null, CancellationToken token = default(CancellationToken))
Returns​

System.Threading.Tasks.Task<System.Boolean>

Parameters​
TypeName
ServiceStack.Auth.IAuthRepositoryAsyncauthRepoAsync
ServiceStack.Auth.IUserAuthuserAuth
ServiceStack.Auth.IAuthTokenstokens
System.Threading.CancellationTokentoken

IsAuthorized(IAuthSession, IAuthTokens, Authenticate)​

View Source​
Declaration
public abstract bool IsAuthorized(IAuthSession session, IAuthTokens tokens, Authenticate request = null)
Returns​

System.Boolean

Parameters​
TypeName
ServiceStack.Auth.IAuthSessionsession
ServiceStack.Auth.IAuthTokenstokens
ServiceStack.Authenticaterequest

LoadUserAuthInfo(AuthUserSession, IAuthTokens, Dictionary<String, String>)​

View Source​
Declaration
[Obsolete("Use LoadUserAuthInfoAsync")]
protected void LoadUserAuthInfo(AuthUserSession userSession, IAuthTokens tokens, Dictionary<string, string> authInfo)
Parameters​
TypeName
ServiceStack.AuthUserSessionuserSession
ServiceStack.Auth.IAuthTokenstokens
System.Collections.Generic.Dictionary<System.String,System.String>authInfo

LoadUserAuthInfoAsync(AuthUserSession, IAuthTokens, Dictionary<String, String>, CancellationToken)​

View Source​
Declaration
protected virtual Task LoadUserAuthInfoAsync(AuthUserSession userSession, IAuthTokens tokens, Dictionary<string, string> authInfo, CancellationToken token = default(CancellationToken))
Returns​

System.Threading.Tasks.Task

Parameters​
TypeName
ServiceStack.AuthUserSessionuserSession
ServiceStack.Auth.IAuthTokenstokens
System.Collections.Generic.Dictionary<System.String,System.String>authInfo
System.Threading.CancellationTokentoken

LoginMatchesSession(IAuthSession, String)​

View Source​
Declaration
protected static bool LoginMatchesSession(IAuthSession session, string userName)
Returns​

System.Boolean

Parameters​
TypeName
ServiceStack.Auth.IAuthSessionsession
System.StringuserName

LogoutAsync(IServiceBase, Authenticate, CancellationToken)​

Remove the Users Session

View Source​
Declaration
public virtual async Task<object> LogoutAsync(IServiceBase service, Authenticate request, CancellationToken token = default(CancellationToken))
Returns​

System.Threading.Tasks.Task<System.Object>

Parameters​
TypeName
ServiceStack.IServiceBaseservice
ServiceStack.Authenticaterequest
System.Threading.CancellationTokentoken

OnAuthenticatedAsync(IServiceBase, IAuthSession, IAuthTokens, Dictionary<String, String>, CancellationToken)​

View Source​
Declaration
public virtual async Task<IHttpResult> OnAuthenticatedAsync(IServiceBase authService, IAuthSession session, IAuthTokens tokens, Dictionary<string, string> authInfo, CancellationToken token = default(CancellationToken))
Returns​

System.Threading.Tasks.Task<ServiceStack.Web.IHttpResult>

Parameters​
TypeName
ServiceStack.IServiceBaseauthService
ServiceStack.Auth.IAuthSessionsession
ServiceStack.Auth.IAuthTokenstokens
System.Collections.Generic.Dictionary<System.String,System.String>authInfo
System.Threading.CancellationTokentoken

OnFailedAuthentication(IAuthSession, IRequest, IResponse)​

View Source​
Declaration
public virtual Task OnFailedAuthentication(IAuthSession session, IRequest httpReq, IResponse httpRes)
Returns​

System.Threading.Tasks.Task

Parameters​
TypeName
ServiceStack.Auth.IAuthSessionsession
ServiceStack.Web.IRequesthttpReq
ServiceStack.Web.IResponsehttpRes

Register(IAppHost, AuthFeature)​

View Source​
Declaration
public virtual void Register(IAppHost appHost, AuthFeature feature)
Parameters​
TypeName
ServiceStack.IAppHostappHost
ServiceStack.AuthFeaturefeature

UrlFilter(AuthContext, String)​

View Source​
Declaration
public static string UrlFilter(AuthContext provider, string url)
Returns​

System.String

Parameters​
TypeName
ServiceStack.Auth.AuthContextprovider
System.Stringurl

UserNameAlreadyExistsAsync(IAuthRepositoryAsync, IUserAuth, IAuthTokens, CancellationToken)​

View Source​
Declaration
protected virtual async Task<bool> UserNameAlreadyExistsAsync(IAuthRepositoryAsync authRepo, IUserAuth userAuth, IAuthTokens tokens = null, CancellationToken token = default(CancellationToken))
Returns​

System.Threading.Tasks.Task<System.Boolean>

Parameters​
TypeName
ServiceStack.Auth.IAuthRepositoryAsyncauthRepo
ServiceStack.Auth.IUserAuthuserAuth
ServiceStack.Auth.IAuthTokenstokens
System.Threading.CancellationTokentoken

ValidateAccountAsync(IServiceBase, IAuthRepositoryAsync, IAuthSession, IAuthTokens, CancellationToken)​

View Source​
Declaration
protected virtual async Task<IHttpResult> ValidateAccountAsync(IServiceBase authService, IAuthRepositoryAsync authRepo, IAuthSession session, IAuthTokens tokens, CancellationToken token = default(CancellationToken))
Returns​

System.Threading.Tasks.Task<ServiceStack.Web.IHttpResult>

Parameters​
TypeName
ServiceStack.IServiceBaseauthService
ServiceStack.Auth.IAuthRepositoryAsyncauthRepo
ServiceStack.Auth.IAuthSessionsession
ServiceStack.Auth.IAuthTokenstokens
System.Threading.CancellationTokentoken

Implements​