Class LoginAssistantComponent
java.lang.Object
com.smartfoxserver.components.login.LoginAssistantComponent
Overview
The Login Assistant component is a helper class that assist developers in creating a solid database-driven login system without the hassle of writing your own database access code.In a nutshell this is how it works:
- Configure the DBManager in your application's Zone
- Instantiate the component in the init() method of your Extension
- Configure the component
Simple example of usage
Supposing we have a database table called muppets containing a name and pword fields we can use this code:
public class MuppetsExtension extends SFSExtension
{
private LoginAssistantComponent lac;
public void init()
{
lac = new LoginAssistantComponent(this);
// Configure the component
lac.getConfig().loginTable = "muppets";
lac.getConfig().userNameField = "name";
lac.getConfig().passwordField = "pword";
}
public void destroy()
{
lac.destroy();
}
}
NOTE: Always make sure to call the component's destroy() method inside your Extension's destroy()
in order to release the component's resources.- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddestroy()Releases the Component's resources.Obtain the configuration object that allows to setup all the parameters of the Login process.
-
Constructor Details
-
LoginAssistantComponent
-
-
Method Details
-
destroy
public void destroy()Releases the Component's resources.NOTE: Always make sure to call the component's destroy() method inside your Extension's destroy() in order to release the component's resources.
-
getConfig
Obtain the configuration object that allows to setup all the parameters of the Login process.- Returns:
- the LoginAssistant's current configuration
-