Example #1
0
  /**
   * ************************************* Handles a successful authentication by invoking the login
   * method {@link LoginHandler#loginSuccessful(DataElementList)}.
   *
   * @param rUserData The user data instance returned by the service
   */
  protected void handleLoginSuccess(DataElementList rUserData) {
    String sSessionID = rUserData.getProperty(AuthenticatedService.SESSION_ID, null);

    if (sSessionID == null) {
      throw new IllegalArgumentException("No Session ID in user data");
    }

    if (aPasswordField != null) {
      aPasswordField.setText("");
      aFailureMessage.setVisible(false);

      aUserField = null;
      aPasswordField = null;
    }

    Cookies.setCookie(sSessionCookie, sSessionID);
    rLoginHandler.loginSuccessful(rUserData);
  }
Example #2
0
  /** ************************************* {@inheritDoc} */
  @Override
  protected void addComponents() {
    ContainerBuilder<Panel> aBuilder = createLoginComponentsPanel(AlignedPosition.CENTER);

    String sUserName = Cookies.getCookie(sUserCookie);

    addLoginPanelHeader(aBuilder, AlignedPosition.TOP);

    aUserField = addUserComponents(aBuilder, sUserName, bReauthenticate);
    aPasswordField = addPasswortComponents(aBuilder);
    aFailureMessage = addFailureMessageComponents(aBuilder);
    aLoginButton = addSubmitLoginComponents(aBuilder);

    if (aUserField != null) {
      aUserField.addEventListener(EventType.ACTION, this);
    }

    aPasswordField.addEventListener(EventType.ACTION, this);
    aLoginButton.addEventListener(EventType.ACTION, this);
    aFailureMessage.setVisible(false);
  }
Example #3
0
 /**
  * ************************************* Handles login failures. There are two ways this method
  * can be invoked. This class first tries to connect to the server with user name and password set
  * to NULL to check for an existing authentication. If that call fails the internal container
  * builder reference will not be NULL and will be used to create the login components to query for
  * the user login. The builder reference will then be set to NULL.
  *
  * @param rCaught The exception that occurred
  */
 protected void handleLoginFailure(Throwable rCaught) {
   aLoginButton.setEnabled(true);
   aFailureMessage.setVisible(true);
   rLoginHandler.loginFailed((Exception) rCaught);
 }