Examples of PasswordCredentials


Examples of com.adito.security.PasswordCredentials

       
        // Now check to see if the password has been added to the authentication scheme
        AuthenticationScheme scheme = (AuthenticationScheme) getSessionInfo(request).getHttpSession().getAttribute(Constants.AUTH_SESSION);
        if(LogonControllerFactory.getInstance().getPasswordFromCredentials(scheme)==null) {
          // No so lets add it
          scheme.addCredentials(new PasswordCredentials(getSessionInfo(request).getUser().getPrincipalName(), f.getPassphrase().toCharArray()));
        }
       
        try {
            PublicKeyStore.getInstance().verifyPrivateKey(getSessionInfo(request).getUser().getPrincipalName(), f.getPassphrase().toCharArray());
        }
View Full Code Here

Examples of com.adito.security.PasswordCredentials

            UserDatabase udb = UserDatabaseManager.getInstance().getUserDatabase(session.getUser().getRealm());
            String username = session.getUser().getPrincipalName();
            if (!udb.checkPassword(username, pfspf.getPassword())) {
                throw new Exception("Incorrect password.");
            }
            scheme.addCredentials(new PasswordCredentials(username, pfspf.getPassword().toCharArray()));
            request.setAttribute(Constants.REQ_ATTR_FORWARD_TO, ((PromptForSessionPasswordForm)form).getForwardTo());
            request.setAttribute(Constants.REQ_ATTR_TARGET, ((PromptForSessionPasswordForm)form).getTarget());
            request.setAttribute(Constants.REQ_ATTR_FOLDER, ((PromptForSessionPasswordForm)form).getFolder());
            return mapping.findForward("redirect");
        } catch (InvalidLoginCredentialsException e) {
View Full Code Here

Examples of com.adito.security.PasswordCredentials

        if (logonStateMachine == null) {
            logonStateMachine = new LogonStateAndCache(LogonStateAndCache.STATE_STARTED, request.getSession());
        }

        if (logonStateMachine.getState() == LogonStateAndCache.STATE_KNOWN_USERNAME_NO_SCHEME_SPOOF_PASSWORD_ENTRY) {
            scheme.addCredentials(new PasswordCredentials("", "".toCharArray()));
        } else if (logonStateMachine.getState() == LogonStateAndCache.STATE_UNKNOWN_USERNAME_PROMPT_FOR_PASSWORD) {
            Credentials creds = module.authenticate(request, params);
            if(creds!=null)
              scheme.addCredentials(creds);
        } else {
View Full Code Here

Examples of com.adito.security.PasswordCredentials

    // 3 = Current users credentials
    // 4 = Guest
    // 5 = Prompt
    int type = 0;
    DAVAuthenticationRequiredException dave = null;
    PasswordCredentials credentials = null;
    boolean hasCachedCredentials = false;

    if (log.isDebugEnabled())
      log.debug("Trying all available credentials for " + getMountString() + path);

    while (true) {

      // If no credentials are currently set, try those in the cache
      // first

      if (type == 0) {
        credentials = getStore().getRepository().getCredentialsCache().getDAVCredentials(getStore().getName(),
          getMountString());
        if (credentials == null) {
          type++;
        } else {
          if (log.isDebugEnabled())
            log.debug("Trying cached credentials for " + getMountString() + path);

          hasCachedCredentials = true;
        }
      }

      // User info from URI
      if (type == 1) {
        URI uri = getRootVFSURI(store.getEncoding());
        String userInfo = uri.getUserinfo();
        if (userInfo == null || userInfo.equals("")) {
          type++;
        } else {
          String username = null;
          char[] pw = null;
          userInfo = Util.urlDecode(userInfo);
          int idx = userInfo.indexOf(":");
          username = userInfo;
          if (idx != -1) {
            username = userInfo.substring(0, idx);
            pw = userInfo.substring(idx + 1).toCharArray();
          }
          credentials = new PasswordCredentials(username, pw);

          if (log.isDebugEnabled()) {
            log.debug("Trying URI credentials for " + getMountString() + path);
          }
        }
View Full Code Here

Examples of com.adito.security.PasswordCredentials

        // Get the user credentials
        String username = credentials.substring(0, idx);
        String password = credentials.substring(idx + 1);

        return new PasswordCredentials(username, password.toCharArray());
    }
View Full Code Here

Examples of com.adito.security.PasswordCredentials

    // 3 = Current users credentials
    // 4 = Guest
    // 5 = Prompt
    int type = 0;
    DAVAuthenticationRequiredException dave = null;
    PasswordCredentials credentials = null;
    boolean hasCachedCredentials = false;

    if (log.isDebugEnabled())
      log.debug("Trying all available credentials for " + getMountString() + path);

    while (true) {

      // If no credentials are currently set, try those in the cache
      // first

      if (type == 0) {
        credentials = getStore().getRepository().getCredentialsCache().getDAVCredentials(getStore().getName(),
          getMountString());
        if (credentials == null) {
          type++;
        } else {
          if (log.isDebugEnabled())
            log.debug("Trying cached credentials for " + getMountString() + path);

          hasCachedCredentials = true;
        }
      }

      // User info from URI
      if (type == 1) {
        URI uri = getRootVFSURI(store.getEncoding());
        String userInfo = uri.getUserinfo();
        if (userInfo == null || userInfo.equals("")) {
          type++;
        } else {
          String username = null;
          char[] pw = null;
          userInfo = Util.urlDecode(userInfo);
          int idx = userInfo.indexOf(":");
          username = userInfo;
          if (idx != -1) {
            username = userInfo.substring(0, idx);
            pw = userInfo.substring(idx + 1).toCharArray();
          }
          credentials = new PasswordCredentials(username, pw);

          if (log.isDebugEnabled()) {
            log.debug("Trying URI credentials for " + getMountString() + path);
          }
        }
      }

      // HTTP authentication response

      if (type == 2) {
        credentials = requestCredentials;
        if (credentials == null) {
          type++;
        } else if (log.isDebugEnabled()) {
          log.debug("Trying Request credentials for " + getMountString() + path);
        }
      }

      // Current user creds
      if (type == 3) {
        if (!tryCurrentUser) {
          type++;
        } else {

          SessionInfo inf = getStore().getRepository().getSession();

          char[] pw = LogonControllerFactory.getInstance()
                  .getPasswordFromCredentials((AuthenticationScheme) inf.getHttpSession()
                          .getAttribute(Constants.AUTH_SESSION));

          if (pw == null) {
            if (log.isDebugEnabled())
              log.debug("No password available from current session");
            type++;
          } else {
            credentials = new PasswordCredentials(inf.getUser().getPrincipalName(), pw);

            if (log.isDebugEnabled()) {
              log.debug("Trying current session credentials for " + "/" + getMountString() + path);
            }
          }
        }
      }

      // Guest creds

      if (type == 4) {
        if (!tryGuest) {
          type++;
        } else {
          String guestAccount = getStore().getGuestUsername();
          if (guestAccount == null) {
            type++;
          } else {
            credentials = new PasswordCredentials(guestAccount, getStore().getGuestPassword());

            if (log.isDebugEnabled()) {
              log.debug("Trying guest credentials for " + getMountString() + path);
            }
          }
View Full Code Here

Examples of com.caucho.security.PasswordCredentials

    }
    else if (credentials instanceof String) {
      String password = (String) credentials;
   
      Principal user = new BasicPrincipal(to);
      PasswordCredentials pwdCred = new PasswordCredentials(password);
   
      if (auth.authenticate(user, pwdCred, null) == null) {
        throw new NotAuthorizedException(L.l("'{0}' has invalid password credentials",
                                             to));
      }
View Full Code Here

Examples of com.caucho.security.PasswordCredentials

    }
    else if (credentials instanceof String) {
      String password = (String) credentials;
   
      Principal user = new BasicPrincipal(uid);
      PasswordCredentials pwdCred = new PasswordCredentials(password);
   
      if (auth.authenticate(user, pwdCred, null) == null) {
        throw new NotAuthorizedException(L.l("'{0}' has invalid credentials",
                                             uid));
      }
View Full Code Here

Examples of com.maverick.http.PasswordCredentials

      int port = localProxyURL.getPort();
      setDefaultProxyType(localProxyURL.getScheme().equals("https") ? HttpClient.PROXY_HTTPS : HttpClient.PROXY_HTTP); //$NON-NLS-1$
      setDefaultProxyHost(localProxyURL.getHost());
      setDefaultProxyPort(port == -1 ? 80 : port);
      if (!user.equals("")) { //$NON-NLS-1$
        setDefaultProxyCredentials(new PasswordCredentials(user,
            password));
      }
      if (localProxyURL.getQueryString() != null) {
        setDefaultProxyPreferredAuthentication(localProxyURL
            .getQueryString());
View Full Code Here

Examples of com.maverick.http.PasswordCredentials

           
      for (int i = 0; i < 3; i++) {

              HttpClient client = getHttpClient();
              if (doPreemptive) {
                  client.setCredentials(new PasswordCredentials(username,
                          ticket));
                  client.setPreferredAuthentication("Basic");
              }
              else {
                  client.setCredentials(null);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.