Esempio n. 1
0
  private static ResponseSet readResponsesFromNovellUA(
      final PwmApplication pwmApplication, final ChaiUser theUser)
      throws PwmUnrecoverableException {
    final String novellUserAppWebServiceURL =
        pwmApplication
            .getConfig()
            .readSettingAsString(PwmSetting.EDIRECTORY_PWD_MGT_WEBSERVICE_URL);

    try {
      LOGGER.trace("establishing connection to web service at " + novellUserAppWebServiceURL);
      final PasswordManagementServiceLocator locater = new PasswordManagementServiceLocator();
      final PasswordManagement service =
          locater.getPasswordManagementPort(new URL(novellUserAppWebServiceURL));
      ((Stub) service)._setProperty(javax.xml.rpc.Stub.SESSION_MAINTAIN_PROPERTY, Boolean.TRUE);
      final ProcessUserRequest userRequest = new ProcessUserRequest(theUser.getEntryDN());
      final ForgotPasswordWSBean processUserResponse = service.processUser(userRequest);
      if (processUserResponse.isTimeout() || processUserResponse.isError()) {
        throw new Exception(
            "novell web service reports "
                + (processUserResponse.isTimeout() ? "timeout" : "error")
                + ": "
                + processUserResponse.getMessage());
      }
      if (processUserResponse.getChallengeQuestions() != null) {
        return new NovellWSResponseSet(service, processUserResponse);
      }
    } catch (Throwable e) {
      final String errorMsg =
          "error retrieving novell user responses from web service: " + e.getMessage();
      final ErrorInformation errorInformation =
          new ErrorInformation(PwmError.ERROR_SERVICE_UNREACHABLE, errorMsg);
      throw new PwmUnrecoverableException(errorInformation);
    }

    return null;
  }
Esempio n. 2
0
    public boolean test(final Map<Challenge, String> responseTest) throws ChaiUnavailableException {
      if (service == null) {
        LOGGER.error(
            localIdentifier
                + "beginning web service 'processChaRes' response test, however service bean is not in session memory, aborting response test...");
        return false;
      }
      LOGGER.trace(localIdentifier + "beginning web service 'processChaRes' response test ");
      final String[] responseArray = new String[challengeSet.getAdminDefinedChallenges().size()];
      {
        int i = 0;
        for (final Challenge loopChallenge : challengeSet.getAdminDefinedChallenges()) {
          final String loopResponse = responseTest.get(loopChallenge);
          responseArray[i] = loopResponse;
          i++;
        }
      }
      final ProcessChaResRequest request = new ProcessChaResRequest();
      request.setChaAnswers(responseArray);
      request.setUserDN(userDN);

      try {
        final ForgotPasswordWSBean response = service.processChaRes(request);
        if (response.isTimeout()) {
          LOGGER.error(localIdentifier + "web service reports timeout: " + response.getMessage());
          return false;
        }
        if (response.isError()) {
          if ("Account restrictions prevent you from logging in. See your administrator for more details."
              .equals(response.getMessage())) {
            // throw PwmUnrecoverableException.createPwmException(PwmError.ERROR_INTRUDER_USER);
          }
          LOGGER.error(localIdentifier + "web service reports error: " + response.getMessage());
          return false;
        }
        LOGGER.debug(localIdentifier + "web service has validated the users responses");
        return true;
      } catch (RemoteException e) {
        LOGGER.error(localIdentifier + "error processing web service response: " + e.getMessage());
      }

      return false; // To change body of implemented methods use File | Settings | File Templates.
    }