Class LoginAssistantComponent
- java.lang.Object
-
- com.smartfoxserver.v2.components.login.LoginAssistantComponent
-
public class LoginAssistantComponent extends java.lang.Object
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:
LoginConfiguration
-
-
Constructor Summary
Constructors Constructor Description LoginAssistantComponent(ISFSExtension ext)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
destroy()
Releases the Component's resources.LoginConfiguration
getConfig()
Obtain the configuration object that allows to setup all the parameters of the Login process.
-
-
-
Constructor Detail
-
LoginAssistantComponent
public LoginAssistantComponent(ISFSExtension ext)
-
-
Method Detail
-
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
public LoginConfiguration getConfig()
Obtain the configuration object that allows to setup all the parameters of the Login process.- Returns:
- the LoginAssistant's current configuration
-
-