Package com.adito.security

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


            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

        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

    // 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

        // 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

    // 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

TOP

Related Classes of com.adito.security.PasswordCredentials

Copyright © 2018 www.massapicom. 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.