Class PreLoginPlugin
A plugin that is executed when the client visits the login page.
Inherited Members
Namespace: Softadmin.Api.Login
Assembly: Softadmin.Api.dll
Syntax
public abstract class PreLoginPlugin : LoginPlugin
Remarks
Subclass this plugin and override BeforeLogin() to for example control where the user is forwarded to after login or to immediately log in the user.
While a pre-login-plugin is able to set session variables those values are lost unless the user is immediately logged in, either by the plugin itself, single sign-on or a login link. For reliable behavior you should set session variables in a PostLoginPlugin instead unless your pre-login-plugin also assigns a logged in user.
Examples
public override void BeforeLogin()
{
bool isGuest;
if (this.QueryString.TryGetBool("guest", out isGuest) && isGuest)
{
this.UserState.Username = "GuestUser";
}
}
Properties
SkipMultiStepVerification
Override this property and return true
if this plugin is considered secure enough
that no multi-step verification needs to take place after successful login. This property is
only relevant when the system has multi-step verification enabled.
Declaration
public virtual bool SkipMultiStepVerification { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
Used for example when the plugin implements third-party OAuth login.
Right now the platform only has support for two-step verification by email but this property will also override any other verification method added in the future.
UserState
Gets or sets an object that controls the logged in user.
Declaration
public IUserState UserState { get; set; }
Property Value
Type | Description |
---|---|
IUserState |
Methods
BeforeLogin()
Executes the plugin.
Declaration
public abstract void BeforeLogin()
Exceptions
Type | Condition |
---|---|
System.Exception | Any exception thrown by this method will be caught and logged but will not prevent the client from logging in. |