AuthProvider
Assembly: ServiceStack.dll
View Source
public abstract class AuthProvider : IAuthProvider, IAuthPlugin
Properties
Type
View Source
public virtual string Type { get; }
Meta
View Source
public virtual Dictionary<string, string> Meta { get; }
SessionExpiry
View Source
public TimeSpan? SessionExpiry { get; set; }
AuthRealm
View Source
public string AuthRealm { get; set; }
Provider
View Source
public string Provider { get; set; }
CallbackUrl
View Source
public string CallbackUrl { get; set; }
RedirectUrl
View Source
public string RedirectUrl { get; set; }
PersistSession
View Source
public bool PersistSession { get; set; }
SaveExtendedUserInfo
View Source
public bool SaveExtendedUserInfo { get; set; }
RestoreSessionFromState
View Source
public bool? RestoreSessionFromState { 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; }
CustomValidationFilter
View Source
public Func<AuthContext, IHttpResult> CustomValidationFilter { get; set; }
AccountLockedValidator
View Source
public Func<IAuthRepository, IUserAuth, IAuthTokens, bool> AccountLockedValidator { get; set; }
NavItem
View Source
public NavItem NavItem { get; set; }
Sort
View Source
public int Sort { get; set; }
Label
View Source
public string Label { get; set; }
Icon
View Source
public ImageInfo Icon { get; set; }
FormLayout
View Source
public List<InputInfo> FormLayout { get; set; }
ExcludeAuthInfoItems
View Source
public HashSet<string> ExcludeAuthInfoItems { get; set; }
AuthEvents
View Source
public IAuthEvents AuthEvents { get; }
Fields
Log
View Source
protected ILog Log
PreAuthUrlFilter
View Source
public Func<AuthContext, string, string> PreAuthUrlFilter
AccessTokenUrlFilter
View Source
public Func<AuthContext, string, string> AccessTokenUrlFilter
SuccessRedirectUrlFilter
View Source
public Func<AuthContext, string, string> SuccessRedirectUrlFilter
FailedRedirectUrlFilter
View Source
public Func<AuthContext, string, string> FailedRedirectUrlFilter
LogoutUrlFilter
View Source
public Func<AuthContext, string, string> LogoutUrlFilter
Methods
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
Register(IAppHost, AuthFeature)
View Source
public virtual void Register(IAppHost appHost, AuthFeature feature)
Parameters
Type | Name |
---|---|
ServiceStack.IAppHost | appHost |
ServiceStack.AuthFeature | feature |
GetUserAuthRepositoryAsync(IRequest)
View Source
public IUserAuthRepositoryAsync GetUserAuthRepositoryAsync(IRequest request)
Returns
ServiceStack.Auth.IUserAuthRepositoryAsync
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | request |