JwtAuthProviderReader
Enable access to protected Services using JWT Tokens
Assembly: ServiceStack.dll
View Source
public class JwtAuthProviderReader : AuthProvider, IAuthProvider, IAuthWithRequest, IAuthPlugin
Properties
Type
View Source
public override string Type { get; }
RequireSecureConnection
Whether to only allow access via API Key from a secure connection. (default true)
View Source
public bool RequireSecureConnection { get; set; }
CreateHeaderFilter
Run custom filter after JWT Header is created
View Source
public Action<JsonObject, IAuthSession> CreateHeaderFilter { get; set; }
CreatePayloadFilter
Run custom filter after JWT Payload is created
View Source
public Action<JsonObject, IAuthSession> CreatePayloadFilter { get; set; }
PopulateSessionFilter
Run custom filter after session is restored from a JWT Token
View Source
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
public bool EncryptPayload { get; set; }
HashAlgorithm
Which Hash Algorithm should be used to sign the JWT Token. (default HS256)
View Source
public string HashAlgorithm { get; set; }
RequireHashAlgorithm
Whether to only allow processing of JWT Tokens using the configured HashAlgorithm. (default true)
View Source
public bool RequireHashAlgorithm { get; set; }
Issuer
The Issuer to embed in the token. (default ssjwt)
View Source
public string Issuer { get; set; }
Audience
The Audience to embed in the token. (default null)
View Source
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
public List<string> Audiences { get; set; }
RequiresAudience
Tokens must contain aud which is validated
View Source
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
public string KeyId { get; set; }
AuthKey
The AuthKey used to sign the JWT Token
View Source
public byte[] AuthKey { get; set; }
AuthKeyBase64
View Source
public string AuthKeyBase64 { set; }
FallbackAuthKeys
Allow verification using multiple Auth keys
View Source
public List<byte[]> FallbackAuthKeys { get; set; }
PrivateKey
View Source
public RSAParameters? PrivateKey { get; set; }
PrivateKeyXml
Convenient overload to initialize the Private Key via exported XML
View Source
public string PrivateKeyXml { get; set; }
PublicKey
The RSA Public Key used to Verify the JWT Token when RSA is used
View Source
public RSAParameters? PublicKey { get; set; }
PublicKeyXml
Convenient overload to initialize the Public Key via exported XML
View Source
public string PublicKeyXml { get; set; }
FallbackPublicKeys
Allow verification using multiple public keys
View Source
public List<RSAParameters> FallbackPublicKeys { get; set; }
FallbackPrivateKeys
Allow verification using multiple private keys for JWE tokens
View Source
public List<RSAParameters> FallbackPrivateKeys { get; set; }
ExpireTokensIn
How long should JWT Tokens be valid for. (default 14 days)
View Source
public TimeSpan ExpireTokensIn { get; set; }
ExpireRefreshTokensIn
How long should JWT Refresh Tokens be valid for. (default 365 days)
View Source
public TimeSpan ExpireRefreshTokensIn { get; set; }
ExpireTokensInDays
Convenient overload to initialize ExpireTokensIn with an Integer
View Source
public int ExpireTokensInDays { set; }
ValidateToken
Allow custom logic to invalidate JWT Tokens
View Source
public Func<JsonObject, IRequest, bool> ValidateToken { get; set; }
ValidateRefreshToken
Allow custom logic to invalidate Refresh Tokens
View Source
public Func<JsonObject, IRequest, bool> ValidateRefreshToken { get; set; }
InvalidateTokensIssuedBefore
Whether to invalidate all JWT Access Tokens issued before a specified date.
View Source
public DateTime? InvalidateTokensIssuedBefore { get; set; }
InvalidateRefreshTokensIssuedBefore
Whether to invalidate all JWT Refresh Tokens issued before a specified date.
View Source
public DateTime? InvalidateRefreshTokensIssuedBefore { get; set; }
ServiceRoutes
Modify the registration of ConvertSessionToToken Service
View Source
public Dictionary<Type, string[]> ServiceRoutes { get; set; }
AllowInQueryString
Allow JWT in ?ss-tok=jwt QueryString. (default false)
View Source
public bool AllowInQueryString { get; set; }
AllowInFormData
Allow JWT in ss-tok=jwt HTML POST FormData. (default false)
View Source
public bool AllowInFormData { get; set; }
RemoveInvalidTokenCookie
Whether to automatically remove expired or invalid cookies
View Source
public bool RemoveInvalidTokenCookie { get; set; }
IncludeJwtInConvertSessionToTokenResponse
Whether to also Include Token in ConvertSessionToTokenResponse
View Source
public bool IncludeJwtInConvertSessionToTokenResponse { get; set; }
UseTokenCookie
Whether to store JWTs in Cookies (ss-tok) for successful Authentications (default true)
View Source
public bool UseTokenCookie { get; set; }
ResolveUnixTime
Override conversion to Unix Time used in issuing JWTs and validation
View Source
public Func<DateTime, long> ResolveUnixTime { get; set; }
PreValidateJwtPayloadFilter
Inspect or modify JWT Payload before validation, return error message if invalid else null
View Source
public Func<Dictionary<string, string>, string> PreValidateJwtPayloadFilter { get; set; }
ResolveJwtId
Change resolution for resolving unique jti id for Access Tokens
View Source
public Func<IRequest, string> ResolveJwtId { get; set; }
ResolveRefreshJwtId
Change resolution for resolving unique jti id for Refresh Tokens
View Source
public Func<IRequest, string> ResolveRefreshJwtId { get; set; }
InvalidateJwtIds
Invalidate JWTs with ids
View Source
public HashSet<string> InvalidateJwtIds { get; set; }
Inherited Properties
AccountLockedValidator
View Source
public Func<IAuthRepository, IUserAuth, IAuthTokens, bool> AccountLockedValidator { get; set; }
AuthEvents
View Source
public IAuthEvents AuthEvents { get; }
AuthRealm
View Source
public string AuthRealm { get; set; }
CallbackUrl
View Source
public string CallbackUrl { get; set; }
CustomValidationFilter
View Source
public Func<AuthContext, IHttpResult> CustomValidationFilter { get; set; }
ExcludeAuthInfoItems
View Source
public HashSet<string> ExcludeAuthInfoItems { get; set; }
FormLayout
View Source
public List<InputInfo> FormLayout { get; set; }
Icon
View Source
public ImageInfo Icon { get; set; }
Label
View Source
public string Label { get; set; }
LoadUserAuthFilter
View Source
public Action<AuthUserSession, IAuthTokens, Dictionary<string, string>> LoadUserAuthFilter { get; set; }
LoadUserAuthInfoFilterAsync
View Source
public Func<AuthUserSession, IAuthTokens, Dictionary<string, string>, CancellationToken, Task> LoadUserAuthInfoFilterAsync { get; set; }
Meta
View Source
public virtual Dictionary<string, string> Meta { get; }
NavItem
View Source
public NavItem NavItem { get; set; }
PersistSession
View Source
public bool PersistSession { get; set; }
Provider
View Source
public string Provider { get; set; }
RedirectUrl
View Source
public string RedirectUrl { get; set; }
RestoreSessionFromState
View Source
public bool? RestoreSessionFromState { get; set; }
SaveExtendedUserInfo
View Source
public bool SaveExtendedUserInfo { get; set; }
SessionExpiry
View Source
public TimeSpan? SessionExpiry { get; set; }
Sort
View Source
public int Sort { get; set; }
Type
View Source
public virtual string Type { get; }
Fields
UseRsaKeyLength
View Source
public static RsaKeyLengths UseRsaKeyLength
Name
View Source
public const string Name = "jwt"
Realm
View Source
public const string Realm = "/auth/jwt"
IgnoreForOperationTypes
View Source
public static readonly HashSet<string> IgnoreForOperationTypes
HmacAlgorithms
Different HMAC Algorithms supported
View Source
public static readonly Dictionary<string, Func<byte[], byte[], byte[]>> HmacAlgorithms
RsaSignAlgorithms
Different RSA Signing Algorithms supported
View Source
public static readonly Dictionary<string, Func<RSAParameters, byte[], byte[]>> RsaSignAlgorithms
RsaVerifyAlgorithms
View Source
public static readonly Dictionary<string, Func<RSAParameters, byte[], byte[], bool>> RsaVerifyAlgorithms
Methods
GetAuthKey(IRequest)
View Source
public byte[] GetAuthKey(IRequest req = null)
Returns
System.Byte[]
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
GetFallbackAuthKeys(IRequest)
View Source
public List<byte[]> GetFallbackAuthKeys(IRequest req = null)
Returns
System.Collections.Generic.List<System.Byte[]>
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
GetPrivateKey(IRequest)
View Source
public RSAParameters? GetPrivateKey(IRequest req = null)
Returns
System.Nullable<System.Security.Cryptography.RSAParameters>
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
GetPublicKey(IRequest)
View Source
public RSAParameters? GetPublicKey(IRequest req = null)
Returns
System.Nullable<System.Security.Cryptography.RSAParameters>
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
GetFallbackPublicKeys(IRequest)
View Source
public List<RSAParameters> GetFallbackPublicKeys(IRequest req = null)
Returns
System.Collections.Generic.List<System.Security.Cryptography.RSAParameters>
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
GetFallbackPrivateKeys(IRequest)
View Source
public List<RSAParameters> GetFallbackPrivateKeys(IRequest req = null)
Returns
System.Collections.Generic.List<System.Security.Cryptography.RSAParameters>
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
DefaultResolveUnixTime(DateTime)
View Source
public static long DefaultResolveUnixTime(DateTime dateTime)
Returns
System.Int64
Parameters
Type | Name |
---|---|
System.DateTime | dateTime |
NextJwtId()
Get the next AutoId for usage in jti JWT Access Tokens
View Source
public string NextJwtId()
Returns
System.String
LastJwtId()
Get the last jti AutoId generated
View Source
public string LastJwtId()
Returns
System.String
NextRefreshJwtId()
Get the next AutoId for usage in jti JWT Refresh Tokens
View Source
public string NextRefreshJwtId()
Returns
System.String
LastRefreshJwtId()
View Source
public string LastRefreshJwtId()
Returns
System.String
Init(IAppSettings)
View Source
public virtual void Init(IAppSettings appSettings = null)
Parameters
Type | Name |
---|---|
ServiceStack.Configuration.IAppSettings | appSettings |
GetKeyId(IRequest)
View Source
public virtual string GetKeyId(IRequest req)
Returns
System.String
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
IsAuthorized(IAuthSession, IAuthTokens, Authenticate)
View Source
public override bool IsAuthorized(IAuthSession session, IAuthTokens tokens, Authenticate request = null)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
ServiceStack.Auth.IAuthSession | session |
ServiceStack.Auth.IAuthTokens | tokens |
ServiceStack.Authenticate | request |
AuthenticateAsync(IServiceBase, IAuthSession, Authenticate, CancellationToken)
View Source
public override Task<object> AuthenticateAsync(IServiceBase authService, IAuthSession session, Authenticate request, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task<System.Object>
Parameters
Type | Name |
---|---|
ServiceStack.IServiceBase | authService |
ServiceStack.Auth.IAuthSession | session |
ServiceStack.Authenticate | request |
System.Threading.CancellationToken | token |
PreAuthenticateAsync(IRequest, IResponse)
View Source
public async Task PreAuthenticateAsync(IRequest req, IResponse res)
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
ServiceStack.Web.IResponse | res |
AuthenticateBearerToken(IRequest, IResponse, String)
View Source
protected virtual bool AuthenticateBearerToken(IRequest req, IResponse res, string bearerToken)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
ServiceStack.Web.IResponse | res |
System.String | bearerToken |
AuthenticateRefreshToken(IRequest, IResponse, String)
View Source
protected virtual async Task<bool> AuthenticateRefreshToken(IRequest req, IResponse res, string refreshToken)
Returns
System.Threading.Tasks.Task<System.Boolean>
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
ServiceStack.Web.IResponse | res |
System.String | refreshToken |
CreateAccessTokenFromRefreshToken(String, IRequest)
View Source
public virtual Task<string> CreateAccessTokenFromRefreshToken(string refreshToken, IRequest req)
Returns
System.Threading.Tasks.Task<System.String>
Parameters
Type | Name |
---|---|
System.String | refreshToken |
ServiceStack.Web.IRequest | req |
IsJwtValid(String)
View Source
public bool IsJwtValid(string jwt)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
System.String | jwt |
IsJwtValid(IRequest, String)
View Source
public bool IsJwtValid(IRequest req, string jwt)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
System.String | jwt |
IsJwtValid(IRequest)
View Source
public bool IsJwtValid(IRequest req)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
GetValidJwtPayload(String)
View Source
public JsonObject GetValidJwtPayload(string jwt)
Returns
Parameters
Type | Name |
---|---|
System.String | jwt |
GetValidJwtPayload(IRequest)
Return token payload which is both verified and still valid
View Source
public virtual JsonObject GetValidJwtPayload(IRequest req)
Returns
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
GetValidJwtPayload(IRequest, String)
Return token payload which is both verified and still valid
View Source
public virtual JsonObject GetValidJwtPayload(IRequest req, string jwt)
Returns
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
System.String | jwt |
ExtractHeader(String)
View Source
public static Dictionary<string, object> ExtractHeader(string jwt)
Returns
System.Collections.Generic.Dictionary<System.String,System.Object>
Parameters
Type | Name |
---|---|
System.String | jwt |
ExtractPayload(String)
View Source
public static Dictionary<string, object> ExtractPayload(string jwt)
Returns
System.Collections.Generic.Dictionary<System.String,System.Object>
Parameters
Type | Name |
---|---|
System.String | jwt |
Dump(String)
View Source
public static string Dump(string jwt)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | jwt |
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
public virtual JsonObject GetVerifiedJwtPayload(string jwt)
Returns
Parameters
Type | Name |
---|---|
System.String | jwt |
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
public virtual JsonObject GetVerifiedJwtPayload(IRequest req, string[] parts)
Returns
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
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
public virtual JsonObject GetVerifiedJwePayload(string jwt)
Returns
Parameters
Type | Name |
---|---|
System.String | jwt |
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
public virtual JsonObject GetVerifiedJwePayload(IRequest req, string[] parts)
Returns
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
System.String[] | parts |
VerifyJwePayload(IRequest, String[], out Byte[], out Byte[], out Byte[])
View Source
public virtual bool VerifyJwePayload(IRequest req, string[] parts, out byte[] iv, out byte[] cipherText, out byte[] cryptKey)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
System.String[] | parts |
System.Byte[] | iv |
System.Byte[] | cipherText |
System.Byte[] | cryptKey |
ConvertJwtToSession(IRequest, String)
View Source
public virtual IAuthSession ConvertJwtToSession(IRequest req, string jwt)
Returns
ServiceStack.Auth.IAuthSession
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
System.String | jwt |
CreateSessionFromPayload(IRequest, JsonObject)
View Source
public virtual IAuthSession CreateSessionFromPayload(IRequest req, JsonObject jwtPayload)
Returns
ServiceStack.Auth.IAuthSession
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
ServiceStack.Text.JsonObject | jwtPayload |
CreateSessionFromJwt(IRequest)
View Source
public static IAuthSession CreateSessionFromJwt(IRequest req)
Returns
ServiceStack.Auth.IAuthSession
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
AssertJwtPayloadIsValid(JsonObject)
View Source
public void AssertJwtPayloadIsValid(JsonObject jwtPayload)
Parameters
Type | Name |
---|---|
ServiceStack.Text.JsonObject | jwtPayload |
GetInvalidJwtPayloadError(JsonObject)
View Source
public virtual string GetInvalidJwtPayloadError(JsonObject jwtPayload)
Returns
System.String
Parameters
Type | Name |
---|---|
ServiceStack.Text.JsonObject | jwtPayload |
AssertRefreshJwtPayloadIsValid(JsonObject)
View Source
public void AssertRefreshJwtPayloadIsValid(JsonObject jwtPayload)
Parameters
Type | Name |
---|---|
ServiceStack.Text.JsonObject | jwtPayload |
GetInvalidRefreshJwtPayloadError(JsonObject)
View Source
public virtual string GetInvalidRefreshJwtPayloadError(JsonObject jwtPayload)
Returns
System.String
Parameters
Type | Name |
---|---|
ServiceStack.Text.JsonObject | jwtPayload |
HasInvalidatedId(JsonObject)
View Source
public virtual bool HasInvalidatedId(JsonObject jwtPayload)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
ServiceStack.Text.JsonObject | jwtPayload |
HasExpired(JsonObject)
View Source
public virtual bool HasExpired(JsonObject jwtPayload)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
ServiceStack.Text.JsonObject | jwtPayload |
HasInvalidNotBefore(JsonObject)
View Source
public virtual bool HasInvalidNotBefore(JsonObject jwtPayload)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
ServiceStack.Text.JsonObject | jwtPayload |
HasBeenInvalidated(JsonObject, Int64)
View Source
public virtual bool HasBeenInvalidated(JsonObject jwtPayload, long unixTime)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
ServiceStack.Text.JsonObject | jwtPayload |
System.Int64 | unixTime |
HasInvalidAudience(JsonObject, out String)
View Source
public virtual bool HasInvalidAudience(JsonObject jwtPayload, out string audience)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
ServiceStack.Text.JsonObject | jwtPayload |
System.String | audience |
VerifyPayload(IRequest, String, Byte[], Byte[])
View Source
public virtual bool VerifyPayload(IRequest req, string algorithm, byte[] bytesToSign, byte[] sentSignatureBytes)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
System.String | algorithm |
System.Byte[] | bytesToSign |
System.Byte[] | sentSignatureBytes |
GetUnixTime(Dictionary<String, String>, String)
View Source
public static long? GetUnixTime(Dictionary<string, string> jwtPayload, string key)
Returns
System.Nullable<System.Int64>
Parameters
Type | Name |
---|---|
System.Collections.Generic.Dictionary<System.String,System.String> | jwtPayload |
System.String | key |
Register(IAppHost, AuthFeature)
View Source
public override void Register(IAppHost appHost, AuthFeature feature)
Parameters
Type | Name |
---|---|
ServiceStack.IAppHost | appHost |
ServiceStack.AuthFeature | feature |
AuthenticateResponseDecorator(AuthFilterContext)
View Source
public object AuthenticateResponseDecorator(AuthFilterContext ctx)
Returns
System.Object
Parameters
Type | Name |
---|---|
ServiceStack.Auth.AuthFilterContext | ctx |
RegisterResponseDecorator(RegisterFilterContext)
View Source
public object RegisterResponseDecorator(RegisterFilterContext ctx)
Returns
System.Object
Parameters
Type | Name |
---|---|
ServiceStack.Auth.RegisterFilterContext | ctx |
Inherited Methods
AuthenticateAsync(IServiceBase, IAuthSession, Authenticate, CancellationToken)
View Source
public abstract Task<object> AuthenticateAsync(IServiceBase authService, IAuthSession session, Authenticate request, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task<System.Object>
Parameters
Type | Name |
---|---|
ServiceStack.IServiceBase | authService |
ServiceStack.Auth.IAuthSession | session |
ServiceStack.Authenticate | request |
System.Threading.CancellationToken | token |
ConvertToClientError(Object, Boolean)
View Source
protected virtual object ConvertToClientError(object failedResult, bool isHtml)
Returns
System.Object
Parameters
Type | Name |
---|---|
System.Object | failedResult |
System.Boolean | isHtml |
CreateAuthContext(IServiceBase, IAuthSession, IAuthTokens)
View Source
protected virtual AuthContext CreateAuthContext(IServiceBase authService = null, IAuthSession session = null, IAuthTokens tokens = null)
Returns
Parameters
Type | Name |
---|---|
ServiceStack.IServiceBase | authService |
ServiceStack.Auth.IAuthSession | session |
ServiceStack.Auth.IAuthTokens | tokens |
CreateOrMergeAuthSession(IAuthSession, IAuthTokens)
View Source
public virtual string CreateOrMergeAuthSession(IAuthSession session, IAuthTokens tokens)
Returns
System.String
Parameters
Type | Name |
---|---|
ServiceStack.Auth.IAuthSession | session |
ServiceStack.Auth.IAuthTokens | tokens |
EmailAlreadyExistsAsync(IAuthRepositoryAsync, IUserAuth, IAuthTokens, CancellationToken)
View Source
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
Type | Name |
---|---|
ServiceStack.Auth.IAuthRepositoryAsync | authRepo |
ServiceStack.Auth.IUserAuth | userAuth |
ServiceStack.Auth.IAuthTokens | tokens |
System.Threading.CancellationToken | token |
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
protected string FallbackConfig(string fallback)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | fallback |
GetAuthRedirectUrl(IServiceBase, IAuthSession)
View Source
protected virtual string GetAuthRedirectUrl(IServiceBase authService, IAuthSession session)
Returns
System.String
Parameters
Type | Name |
---|---|
ServiceStack.IServiceBase | authService |
ServiceStack.Auth.IAuthSession | session |
GetAuthRepository(IRequest)
View Source
protected virtual IAuthRepository GetAuthRepository(IRequest req)
Returns
ServiceStack.Auth.IAuthRepository
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
GetAuthRepositoryAsync(IRequest)
View Source
protected virtual IAuthRepositoryAsync GetAuthRepositoryAsync(IRequest req)
Returns
ServiceStack.Auth.IAuthRepositoryAsync
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
GetReferrerUrl(IServiceBase, IAuthSession, Authenticate)
View Source
protected virtual string GetReferrerUrl(IServiceBase authService, IAuthSession session, Authenticate request = null)
Returns
System.String
Parameters
Type | Name |
---|---|
ServiceStack.IServiceBase | authService |
ServiceStack.Auth.IAuthSession | session |
ServiceStack.Authenticate | request |
GetUserAuthRepositoryAsync(IRequest)
View Source
public IUserAuthRepositoryAsync GetUserAuthRepositoryAsync(IRequest request)
Returns
ServiceStack.Auth.IUserAuthRepositoryAsync
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | request |
IsAccountLockedAsync(IAuthRepositoryAsync, IUserAuth, IAuthTokens, CancellationToken)
View Source
public virtual Task<bool> IsAccountLockedAsync(IAuthRepositoryAsync authRepoAsync, IUserAuth userAuth, IAuthTokens tokens = null, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task<System.Boolean>
Parameters
Type | Name |
---|---|
ServiceStack.Auth.IAuthRepositoryAsync | authRepoAsync |
ServiceStack.Auth.IUserAuth | userAuth |
ServiceStack.Auth.IAuthTokens | tokens |
System.Threading.CancellationToken | token |
IsAuthorized(IAuthSession, IAuthTokens, Authenticate)
View Source
public abstract bool IsAuthorized(IAuthSession session, IAuthTokens tokens, Authenticate request = null)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
ServiceStack.Auth.IAuthSession | session |
ServiceStack.Auth.IAuthTokens | tokens |
ServiceStack.Authenticate | request |
LoadUserAuthInfo(AuthUserSession, IAuthTokens, Dictionary<String, String>)
View Source
[Obsolete("Use LoadUserAuthInfoAsync")]
protected void LoadUserAuthInfo(AuthUserSession userSession, IAuthTokens tokens, Dictionary<string, string> authInfo)
Parameters
Type | Name |
---|---|
ServiceStack.AuthUserSession | userSession |
ServiceStack.Auth.IAuthTokens | tokens |
System.Collections.Generic.Dictionary<System.String,System.String> | authInfo |
LoadUserAuthInfoAsync(AuthUserSession, IAuthTokens, Dictionary<String, String>, CancellationToken)
View Source
protected virtual Task LoadUserAuthInfoAsync(AuthUserSession userSession, IAuthTokens tokens, Dictionary<string, string> authInfo, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|---|
ServiceStack.AuthUserSession | userSession |
ServiceStack.Auth.IAuthTokens | tokens |
System.Collections.Generic.Dictionary<System.String,System.String> | authInfo |
System.Threading.CancellationToken | token |
LoginMatchesSession(IAuthSession, String)
View Source
protected static bool LoginMatchesSession(IAuthSession session, string userName)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
ServiceStack.Auth.IAuthSession | session |
System.String | userName |
LogoutAsync(IServiceBase, Authenticate, CancellationToken)
Remove the Users Session
View Source
public virtual async Task<object> LogoutAsync(IServiceBase service, Authenticate request, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task<System.Object>
Parameters
Type | Name |
---|---|
ServiceStack.IServiceBase | service |
ServiceStack.Authenticate | request |
System.Threading.CancellationToken | token |
OnAuthenticatedAsync(IServiceBase, IAuthSession, IAuthTokens, Dictionary<String, String>, CancellationToken)
View Source
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
Type | Name |
---|---|
ServiceStack.IServiceBase | authService |
ServiceStack.Auth.IAuthSession | session |
ServiceStack.Auth.IAuthTokens | tokens |
System.Collections.Generic.Dictionary<System.String,System.String> | authInfo |
System.Threading.CancellationToken | token |
OnFailedAuthentication(IAuthSession, IRequest, IResponse)
View Source
public virtual Task OnFailedAuthentication(IAuthSession session, IRequest httpReq, IResponse httpRes)
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|---|
ServiceStack.Auth.IAuthSession | session |
ServiceStack.Web.IRequest | httpReq |
ServiceStack.Web.IResponse | httpRes |
Register(IAppHost, AuthFeature)
View Source
public virtual void Register(IAppHost appHost, AuthFeature feature)
Parameters
Type | Name |
---|---|
ServiceStack.IAppHost | appHost |
ServiceStack.AuthFeature | feature |
UrlFilter(AuthContext, String)
View Source
public static string UrlFilter(AuthContext provider, string url)
Returns
System.String
Parameters
Type | Name |
---|---|
ServiceStack.Auth.AuthContext | provider |
System.String | url |
UserNameAlreadyExistsAsync(IAuthRepositoryAsync, IUserAuth, IAuthTokens, CancellationToken)
View Source
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
Type | Name |
---|---|
ServiceStack.Auth.IAuthRepositoryAsync | authRepo |
ServiceStack.Auth.IUserAuth | userAuth |
ServiceStack.Auth.IAuthTokens | tokens |
System.Threading.CancellationToken | token |
ValidateAccountAsync(IServiceBase, IAuthRepositoryAsync, IAuthSession, IAuthTokens, CancellationToken)
View Source
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
Type | Name |
---|---|
ServiceStack.IServiceBase | authService |
ServiceStack.Auth.IAuthRepositoryAsync | authRepo |
ServiceStack.Auth.IAuthSession | session |
ServiceStack.Auth.IAuthTokens | tokens |
System.Threading.CancellationToken | token |