Esempio n. 1
0
  /**
   * ************************************* Adds the components for the user input.
   *
   * @param rBuilder The builder to create the components with
   * @param sUserName The user name preset
   * @param bReauthenticate TRUE for a re-authentication of the current user
   * @return The user input field or NULL if no user input is needed (in the case of
   *     re-authentication)
   */
  protected TextField addUserComponents(
      ContainerBuilder<?> rBuilder, String sUserName, boolean bReauthenticate) {
    TextField aUserInputField = null;

    rBuilder.addLabel(
        StyleData.DEFAULT.setFlags(StyleFlag.HORIZONTAL_ALIGN_RIGHT), "$lblLoginName", null);

    if (bReauthenticate) {
      rBuilder.addLabel(StyleData.DEFAULT, sUserName, null);
    } else {
      aUserInputField = rBuilder.addTextField(StyleData.DEFAULT, "");
      aUserInputField.setText(sUserName);
    }

    return aUserInputField;
  }
Esempio n. 2
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);
  }