Skip to main content

AuthFeature

Enable the authentication feature and configure the AuthService.

Assembly: ServiceStack.dll​
View Source​
Declaration
public class AuthFeature : IPlugin, IPostInitPlugin, IHasStringId, IHasId<string>

Properties​

Id​

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

IsValidUsernameFn​

View Source​
Declaration
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​
Declaration
public Func<IRequest, IHttpResult> OnAuthenticateValidate { get; set; }

ValidateFn​

Custom Validation Function in AuthenticateService

View Source​
Declaration
public ValidateFn ValidateFn { get; set; }
View Source​
Declaration
public Action<IRequest, string> ValidateRedirectLinks { get; set; }

SessionFactory​

View Source​
Declaration
public Func<IAuthSession> SessionFactory { get; set; }

SessionType​

View Source​
Declaration
public Type SessionType { get; }

AuthProviders​

View Source​
Declaration
public IAuthProvider[] AuthProviders { get; }

ServiceRoutes​

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

RegisterPlugins​

View Source​
Declaration
public List<IPlugin> RegisterPlugins { get; set; }

AuthEvents​

View Source​
Declaration
public List<IAuthEvents> AuthEvents { get; set; }

OnBeforeInit​

Invoked before AuthFeature is registered

View Source​
Declaration
public List<Action<AuthFeature>> OnBeforeInit { get; set; }

OnAfterInit​

Invoked after AuthFeature is registered

View Source​
Declaration
public List<Action<AuthFeature>> OnAfterInit { get; set; }

HtmlRedirect​

Login path to redirect to

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

HtmlRedirectAccessDenied​

Redirect path to when Access by Authenticated User is Denied

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

HtmlRedirectReturnParam​

What queryString param to capture redirect param on

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

HtmlRedirectLoginWith2Fa​

Redirect path to when Authenticated User requires 2FA

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

HtmlRedirectLockout​

Redirect path to when User is Locked out

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

HtmlRedirectReturnPathOnly​

Whether to only capture return path or absolute URL (default)

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

HtmlLogoutRedirect​

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

IncludeAuthMetadataProvider​

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

ValidateUniqueEmails​

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

ValidateUniqueUserNames​

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

DeleteSessionCookiesOnLogout​

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

GenerateNewSessionCookiesOnAuthentication​

View Source​
Declaration
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​
Declaration
public bool CreateDigestAuthHashes { get; set; }

SaveUserNamesInLowerCase​

Should UserName or Emails be saved in AuthRepository in LowerCase

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

SessionExpiry​

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

PermanentSessionExpiry​

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

MaxLoginAttempts​

View Source​
Declaration
public int? MaxLoginAttempts { get; set; }

IncludeRolesInAuthenticateResponse​

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

IncludeOAuthTokensInAuthenticateResponse​

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

IncludeDefaultLogin​

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

ProfileImages​

View Source​
Declaration
public ImagesHandler ProfileImages { get; set; }

FormLayout​

UI Layout for Authentication

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

AdminAuthSecretInfo​

View Source​
Declaration
public MetaAuthProvider AdminAuthSecretInfo { get; set; }

AllowGetAuthenticateRequests​

Allow or deny all GET Authenticate Requests

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

AuthResponseDecorator​

View Source​
Declaration
public Func<AuthFilterContext, object> AuthResponseDecorator { get; set; }

RegisterResponseDecorator​

View Source​
Declaration
public Func<RegisterFilterContext, object> RegisterResponseDecorator { get; set; }

IncludeAssignRoleServices​

View Source​
Declaration
public bool IncludeAssignRoleServices { set; }

IncludeRegistrationService​

View Source​
Declaration
public bool IncludeRegistrationService { set; }

AuthSecretSession​

The Session to return for AuthSecret

View Source​
Declaration
public IAuthSession AuthSecretSession { get; set; }

Fields​

ValidUserNameRegEx​

View Source​
Declaration
public Regex ValidUserNameRegEx

Methods​

AllowAllRedirects(IRequest, String)​

View Source​
Declaration
public static void AllowAllRedirects(IRequest req, string redirect)
Parameters​
TypeName
ServiceStack.Web.IRequestreq
System.Stringredirect

NoExternalRedirects(IRequest, String)​

View Source​
Declaration
public static void NoExternalRedirects(IRequest req, string redirect)
Parameters​
TypeName
ServiceStack.Web.IRequestreq
System.Stringredirect

DefaultAllowGetAuthenticateRequests(IRequest)​

View Source​
Declaration
public static bool DefaultAllowGetAuthenticateRequests(IRequest req)
Returns​

System.Boolean

Parameters​
TypeName
ServiceStack.Web.IRequestreq

RemoveAuthenticateAliasRoutes()​

View Source​
Declaration
[Obsolete("The /authenticate alias routes are no longer added by default")]
public AuthFeature RemoveAuthenticateAliasRoutes()
Returns​

ServiceStack.AuthFeature

AddAuthenticateAliasRoutes()​

Add /authenticate and /authenticate/{provider} alias routes

View Source​
Declaration
public AuthFeature AddAuthenticateAliasRoutes()
Returns​

ServiceStack.AuthFeature

RegisterAuthProvider(IAuthProvider)​

Use a plugin or OnBeforeInit delegate to register authProvider dynamically. Your plugin can implement IPreInitPlugin interface to call appHost.GetPlugin&lt;AuthFeature&gt;().RegisterAuthProvider() before the AuthFeature is registered.

View Source​
Declaration
public void RegisterAuthProvider(IAuthProvider authProvider)
Parameters​
TypeName
ServiceStack.Auth.IAuthProviderauthProvider

RegisterAuthProviders(IEnumerable<IAuthProvider>)​

Use a plugin or OnBeforeInit delegate to register authProvider dynamically. Your plugin can implement IPreInitPlugin interface to call appHost.GetPlugin&lt;AuthFeature&gt;().RegisterAuthProvider() before the AuthFeature is registered.

View Source​
Declaration
public void RegisterAuthProviders(IEnumerable<IAuthProvider> providers)
Parameters​
TypeName
System.Collections.Generic.IEnumerable<ServiceStack.Auth.IAuthProvider>providers

Register(IAppHost)​

View Source​
Declaration
public void Register(IAppHost appHost)
Parameters​
TypeName
ServiceStack.IAppHostappHost

AfterPluginsLoaded(IAppHost)​

View Source​
Declaration
public void AfterPluginsLoaded(IAppHost appHost)
Parameters​
TypeName
ServiceStack.IAppHostappHost

GetAuthProvider(String)​

View Source​
Declaration
public IAuthProvider GetAuthProvider(string provider)
Returns​

ServiceStack.Auth.IAuthProvider

Parameters​
TypeName
System.Stringprovider

GetJwtAuthProviderReader()​

View Source​
Declaration
public JwtAuthProviderReader GetJwtAuthProviderReader()
Returns​

ServiceStack.Auth.JwtAuthProviderReader

GetRequiredJwtAuthProvider()​

View Source​
Declaration
public JwtAuthProvider GetRequiredJwtAuthProvider()
Returns​

ServiceStack.Auth.JwtAuthProvider

Implements​