AuthFeature
Enable the authentication feature and configure the AuthService.
Assembly: ServiceStack.dll
View Source
public class AuthFeature : IPlugin, IPostInitPlugin, IHasStringId, IHasId<string>
Properties
Id
View Source
public string Id { get; set; }
IsValidUsernameFn
View Source
public Func<string, bool> IsValidUsernameFn { get; set; }
OnAuthenticateValidate
Fired before any [Authenticate] or [Required*] Auth Attribute is validated. Return non-null IHttpResult to write to response and short-circuit request.
View Source
public Func<IRequest, IHttpResult> OnAuthenticateValidate { get; set; }
ValidateFn
Custom Validation Function in AuthenticateService
View Source
public ValidateFn ValidateFn { get; set; }
ValidateRedirectLinks
View Source
public Action<IRequest, string> ValidateRedirectLinks { get; set; }
SessionFactory
View Source
public Func<IAuthSession> SessionFactory { get; set; }
SessionType
View Source
public Type SessionType { get; }
AuthProviders
View Source
public IAuthProvider[] AuthProviders { get; }
ServiceRoutes
View Source
public Dictionary<Type, string[]> ServiceRoutes { get; set; }
RegisterPlugins
View Source
public List<IPlugin> RegisterPlugins { get; set; }
AuthEvents
View Source
public List<IAuthEvents> AuthEvents { get; set; }
OnBeforeInit
Invoked before AuthFeature is registered
View Source
public List<Action<AuthFeature>> OnBeforeInit { get; set; }
OnAfterInit
Invoked after AuthFeature is registered
View Source
public List<Action<AuthFeature>> OnAfterInit { get; set; }
HtmlRedirect
Login path to redirect to
View Source
public string HtmlRedirect { get; set; }
HtmlRedirectAccessDenied
Redirect path to when Access by Authenticated User is Denied
View Source
public string HtmlRedirectAccessDenied { get; set; }
HtmlRedirectReturnParam
What queryString param to capture redirect param on
View Source
public string HtmlRedirectReturnParam { get; set; }
HtmlRedirectLoginWith2Fa
Redirect path to when Authenticated User requires 2FA
View Source
public string HtmlRedirectLoginWith2Fa { get; set; }
HtmlRedirectLockout
Redirect path to when User is Locked out
View Source
public string HtmlRedirectLockout { get; set; }
HtmlRedirectReturnPathOnly
Whether to only capture return path or absolute URL (default)
View Source
public bool HtmlRedirectReturnPathOnly { get; set; }
HtmlLogoutRedirect
View Source
public string HtmlLogoutRedirect { get; set; }
IncludeAuthMetadataProvider
View Source
public bool IncludeAuthMetadataProvider { get; set; }
ValidateUniqueEmails
View Source
public bool ValidateUniqueEmails { get; set; }
ValidateUniqueUserNames
View Source
public bool ValidateUniqueUserNames { get; set; }
DeleteSessionCookiesOnLogout
View Source
public bool DeleteSessionCookiesOnLogout { get; set; }
GenerateNewSessionCookiesOnAuthentication
View Source
public bool GenerateNewSessionCookiesOnAuthentication { get; set; }
CreateDigestAuthHashes
Whether to Create Digest Auth MD5 Hash when Creating/Updating Users. Defaults to only creating Digest Auth when DigestAuthProvider is registered.
View Source
public bool CreateDigestAuthHashes { get; set; }
SaveUserNamesInLowerCase
Should UserName or Emails be saved in AuthRepository in LowerCase
View Source
public bool SaveUserNamesInLowerCase { get; set; }
SessionExpiry
View Source
public TimeSpan? SessionExpiry { get; set; }
PermanentSessionExpiry
View Source
public TimeSpan? PermanentSessionExpiry { get; set; }
MaxLoginAttempts
View Source
public int? MaxLoginAttempts { get; set; }
IncludeRolesInAuthenticateResponse
View Source
public bool IncludeRolesInAuthenticateResponse { get; set; }
IncludeOAuthTokensInAuthenticateResponse
View Source
public bool IncludeOAuthTokensInAuthenticateResponse { get; set; }
IncludeDefaultLogin
View Source
public bool IncludeDefaultLogin { get; set; }
ProfileImages
View Source
public ImagesHandler ProfileImages { get; set; }
FormLayout
UI Layout for Authentication
View Source
public List<InputInfo> FormLayout { get; set; }
AdminAuthSecretInfo
View Source
public MetaAuthProvider AdminAuthSecretInfo { get; set; }
AllowGetAuthenticateRequests
Allow or deny all GET Authenticate Requests
View Source
public Func<IRequest, bool> AllowGetAuthenticateRequests { get; set; }
AuthResponseDecorator
View Source
public Func<AuthFilterContext, object> AuthResponseDecorator { get; set; }
RegisterResponseDecorator
View Source
public Func<RegisterFilterContext, object> RegisterResponseDecorator { get; set; }
IncludeAssignRoleServices
View Source
public bool IncludeAssignRoleServices { set; }
IncludeRegistrationService
View Source
public bool IncludeRegistrationService { set; }
AuthSecretSession
The Session to return for AuthSecret
View Source
public IAuthSession AuthSecretSession { get; set; }
Fields
ValidUserNameRegEx
View Source
public Regex ValidUserNameRegEx
Methods
AllowAllRedirects(IRequest, String)
View Source
public static void AllowAllRedirects(IRequest req, string redirect)
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
System.String | redirect |
NoExternalRedirects(IRequest, String)
View Source
public static void NoExternalRedirects(IRequest req, string redirect)
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
System.String | redirect |
DefaultAllowGetAuthenticateRequests(IRequest)
View Source
public static bool DefaultAllowGetAuthenticateRequests(IRequest req)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
RemoveAuthenticateAliasRoutes()
View Source
[Obsolete("The /authenticate alias routes are no longer added by default")]
public AuthFeature RemoveAuthenticateAliasRoutes()
Returns
AddAuthenticateAliasRoutes()
Add /authenticate and /authenticate/{provider} alias routes
View Source
public AuthFeature AddAuthenticateAliasRoutes()
Returns
RegisterAuthProvider(IAuthProvider)
Use a plugin or OnBeforeInit delegate to register authProvider dynamically. Your plugin can implement IPreInitPlugin
interface
to call appHost.GetPlugin<AuthFeature>().RegisterAuthProvider()
before the AuthFeature is registered.
View Source
public void RegisterAuthProvider(IAuthProvider authProvider)
Parameters
Type | Name |
---|---|
ServiceStack.Auth.IAuthProvider | authProvider |
RegisterAuthProviders(IEnumerable<IAuthProvider>)
Use a plugin or OnBeforeInit delegate to register authProvider dynamically. Your plugin can implement IPreInitPlugin
interface
to call appHost.GetPlugin<AuthFeature>().RegisterAuthProvider()
before the AuthFeature is registered.
View Source
public void RegisterAuthProviders(IEnumerable<IAuthProvider> providers)
Parameters
Type | Name |
---|---|
System.Collections.Generic.IEnumerable<ServiceStack.Auth.IAuthProvider> | providers |
Register(IAppHost)
View Source
public void Register(IAppHost appHost)
Parameters
Type | Name |
---|---|
ServiceStack.IAppHost | appHost |
AfterPluginsLoaded(IAppHost)
View Source
public void AfterPluginsLoaded(IAppHost appHost)
Parameters
Type | Name |
---|---|
ServiceStack.IAppHost | appHost |
GetAuthProvider(String)
View Source
public IAuthProvider GetAuthProvider(string provider)
Returns
ServiceStack.Auth.IAuthProvider
Parameters
Type | Name |
---|---|
System.String | provider |
GetJwtAuthProviderReader()
View Source
public JwtAuthProviderReader GetJwtAuthProviderReader()
Returns
ServiceStack.Auth.JwtAuthProviderReader
GetRequiredJwtAuthProvider()
View Source
public JwtAuthProvider GetRequiredJwtAuthProvider()
Returns
ServiceStack.Auth.JwtAuthProvider