org.omus.ext
Interface LoginExtension


public interface LoginExtension

This interface is useful if you want to modify the way users are registered or logged in. You must specify the name of the class that implements this interface in the <extensions>-node in config.xml.


Method Summary
 void finishLogin(User user)
          Invoked after the user has been logged in.
 void finishRegister(User user)
          Invoked after the user has been registered.
 boolean prepareLogin(AuthenticationData data, java.net.InetAddress clientAddress, int clientPort)
          Invoked before a registered user is logged in.
 boolean prepareRegister(RegistrationData data, java.net.InetAddress clientAddress, int clientPort)
          Invoked before a new user is registered.
 

Method Detail

prepareLogin

public boolean prepareLogin(AuthenticationData data,
                            java.net.InetAddress clientAddress,
                            int clientPort)
Invoked before a registered user is logged in. The AuthenticationData object contains methods to read or set the name and password of the user. If this method returns false, the login will be aborted. This way you can implement some kind of error checking on the server or load some additional data before the user will be logged in. You can even use this method to authenticate the user with a different server application if Oregano Server is tied to a legacy system. You can use the setErrorCode method of the AuthenticationData object to send customized error codes to the clients. Otherwise a default error code will be sent.

prepareRegister

public boolean prepareRegister(RegistrationData data,
                               java.net.InetAddress clientAddress,
                               int clientPort)
Invoked before a new user is registered. The RegistrationData object contains methods to read or set the name, password or email address of the user. If this method returns false, the registration will be aborted. This way you can implement some kind of error checking on the server or load some additional data before the user will be registered. It is a good idea to generate the password on the server and not to use the one sent from the client. You can use the finishRegister method of this extension to send the generated password in an email to the new user and thus verify the email address that she entered. To send customized error codes to the clients, you can use the setErrorCode method of the AuthenticationData object. Otherwise a default error code will be sent.

finishLogin

public void finishLogin(User user)
Invoked after the user has been logged in.

finishRegister

public void finishRegister(User user)
Invoked after the user has been registered. If the password for the new user was generated by this LoginExtension, this is the right place to send an email to the new user containing a registration confirmation and her password.