Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## jChatBox.Service
Class UserLogin

    java.lang.Object
      |
      +--jChatBox.Service.Login
            |
            +--jChatBox.Service.UserLogin

public class UserLogin
extends Login

This class implements features to login user.

Constructor Summary
`UserLogin()`

Method Summary
`protected void` | `boundUser(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpSession session, int chatroomID, UserParams uParams, java.lang.String nickname)` Bounds ChatroomUser to selected chatroom (and its HttpSession). It also notify users' Monitor.
`java.lang.String` | `doLogin(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpSession session)` Login (name, chatrooms) from JSP form.
`protected void` | `trace(int level, java.lang.String msg)` Sends trace to debug.

Methods inherited from class jChatBox.Service.Login
`getSysMessage, setSysMessage`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### UserLogin

    public UserLogin()

Method Detail

### doLogin

    public java.lang.String doLogin(javax.servlet.http.HttpServletRequest request,
                                    javax.servlet.http.HttpSession session)

  Login (name, chatrooms) from JSP form.
  You can overide this method to implement your own authentification scheme as :
  X509 Certificates, LDAP, Database ...
  ChatroomUser is logged in once he's attached to its HttpSession.
  To do so you have 3 steps to implement :
  Step 1 : Get user's info and the chatroom that he wants to log in
  String login = request.getParameter("name");
  String chatroomIDstr = request.getParameter("chatrooms");
  ...
  ...
  Step 2 : Do controls (authentication/authorization) and instantiate UserParams
  // Your authentication : returns null if it fails.
  ..
  ..
  UserParams uParams = new UserParams();
  uParams.setEmail(email);
  ...
  ...
  Step 3 : Bound ChatroomUser to chatroom and HttpSession
  // Join Chatroom.
  try
  {
  boundUser(request,session,chatroomID,uParams,login);
  // Logged.
  return Conf.JSPROOM;
  } catch (ChatException e)
  {
  setSysMessage(e.getMessage());
  // Fail.
  return null;
  }
  Overrides:
    doLogin in class Login

### boundUser

    protected void boundUser(javax.servlet.http.HttpServletRequest request,
                             javax.servlet.http.HttpSession session,
                             int chatroomID,
                             UserParams uParams,
                             java.lang.String nickname)
                      throws ChatException

  Bounds ChatroomUser to selected chatroom (and its HttpSession).
  It also notify users' Monitor.

### trace

    protected void trace(int level,
                         java.lang.String msg)

  Sends trace to debug.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD