Java Code Examples for javax.security.auth.callback.PasswordCallback#clearPassword()

The following examples show how to use javax.security.auth.callback.PasswordCallback#clearPassword() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: KeyStoreLoginModule.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private void saveStorePass(PasswordCallback c) {
    keyStorePassword = c.getPassword();
    if (keyStorePassword == null) {
        /* Treat a NULL password as an empty password */
        keyStorePassword = new char[0];
    }
    c.clearPassword();
}
 
Example 2
Source File: KeyStoreLoginModule.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private void saveKeyPass(PasswordCallback c) {
    privateKeyPassword = c.getPassword();
    if (privateKeyPassword == null || privateKeyPassword.length == 0) {
        /*
         * Use keystore password if no private key password is
         * specified.
         */
        privateKeyPassword = keyStorePassword;
    }
    c.clearPassword();
}
 
Example 3
Source File: KeyStoreLoginModule.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private void saveStorePass(PasswordCallback c) {
    keyStorePassword = c.getPassword();
    if (keyStorePassword == null) {
        /* Treat a NULL password as an empty password */
        keyStorePassword = new char[0];
    }
    c.clearPassword();
}
 
Example 4
Source File: KeyStoreLoginModule.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private void saveKeyPass(PasswordCallback c) {
    privateKeyPassword = c.getPassword();
    if (privateKeyPassword == null || privateKeyPassword.length == 0) {
        /*
         * Use keystore password if no private key password is
         * specified.
         */
        privateKeyPassword = keyStorePassword;
    }
    c.clearPassword();
}
 
Example 5
Source File: KeyStoreLoginModule.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private void saveStorePass(PasswordCallback c) {
    keyStorePassword = c.getPassword();
    if (keyStorePassword == null) {
        /* Treat a NULL password as an empty password */
        keyStorePassword = new char[0];
    }
    c.clearPassword();
}
 
Example 6
Source File: KeyStoreLoginModule.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private void saveKeyPass(PasswordCallback c) {
    privateKeyPassword = c.getPassword();
    if (privateKeyPassword == null || privateKeyPassword.length == 0) {
        /*
         * Use keystore password if no private key password is
         * specified.
         */
        privateKeyPassword = keyStorePassword;
    }
    c.clearPassword();
}
 
Example 7
Source File: KeyStoreLoginModule.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private void saveStorePass(PasswordCallback c) {
    keyStorePassword = c.getPassword();
    if (keyStorePassword == null) {
        /* Treat a NULL password as an empty password */
        keyStorePassword = new char[0];
    }
    c.clearPassword();
}
 
Example 8
Source File: UniversalLoginModule.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
    * Called by login() to acquire the username and password strings for authentication. This method does no validation
    * of either.
    *
    * @return String[], [0] = username, [1] = password
    */
   private String[] getUsernameAndPassword() throws LoginException {
if (callbackHandler == null) {
    throw new LoginException("No CallbackHandler available to collect authentication information");
}
NameCallback nc = new NameCallback("User name: ", "guest");
PasswordCallback pc = new PasswordCallback("Password: ", false);
Callback[] callbacks = { nc, pc };
String username = null;
String password = null;
try {
    callbackHandler.handle(callbacks);
    username = nc.getName();
    char[] tmpPassword = pc.getPassword();
    if (tmpPassword != null) {
	credential = new char[tmpPassword.length];
	System.arraycopy(tmpPassword, 0, credential, 0, tmpPassword.length);
	pc.clearPassword();
	password = new String(credential);
    }
} catch (IOException ioe) {
    throw new LoginException(ioe.toString());
} catch (UnsupportedCallbackException uce) {
    throw new LoginException("CallbackHandler does not support: " + uce.getCallback());
}
return new String[] { username, password };
   }
 
Example 9
Source File: KeyStoreLoginModule.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private void saveKeyPass(PasswordCallback c) {
    privateKeyPassword = c.getPassword();
    if (privateKeyPassword == null || privateKeyPassword.length == 0) {
        /*
         * Use keystore password if no private key password is
         * specified.
         */
        privateKeyPassword = keyStorePassword;
    }
    c.clearPassword();
}
 
Example 10
Source File: KeyStoreLoginModule.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
private void saveStorePass(PasswordCallback c) {
    keyStorePassword = c.getPassword();
    if (keyStorePassword == null) {
        /* Treat a NULL password as an empty password */
        keyStorePassword = new char[0];
    }
    c.clearPassword();
}
 
Example 11
Source File: KeyStoreLoginModule.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
private void saveKeyPass(PasswordCallback c) {
    privateKeyPassword = c.getPassword();
    if (privateKeyPassword == null || privateKeyPassword.length == 0) {
        /*
         * Use keystore password if no private key password is
         * specified.
         */
        privateKeyPassword = keyStorePassword;
    }
    c.clearPassword();
}
 
Example 12
Source File: KeyStoreLoginModule.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
private void saveStorePass(PasswordCallback c) {
    keyStorePassword = c.getPassword();
    if (keyStorePassword == null) {
        /* Treat a NULL password as an empty password */
        keyStorePassword = new char[0];
    }
    c.clearPassword();
}
 
Example 13
Source File: KeyStoreLoginModule.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private void saveKeyPass(PasswordCallback c) {
    privateKeyPassword = c.getPassword();
    if (privateKeyPassword == null || privateKeyPassword.length == 0) {
        /*
         * Use keystore password if no private key password is
         * specified.
         */
        privateKeyPassword = keyStorePassword;
    }
    c.clearPassword();
}
 
Example 14
Source File: KeyStoreLoginModule.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private void saveStorePass(PasswordCallback c) {
    keyStorePassword = c.getPassword();
    if (keyStorePassword == null) {
        /* Treat a NULL password as an empty password */
        keyStorePassword = new char[0];
    }
    c.clearPassword();
}
 
Example 15
Source File: KeyStoreLoginModule.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private void saveKeyPass(PasswordCallback c) {
    privateKeyPassword = c.getPassword();
    if (privateKeyPassword == null || privateKeyPassword.length == 0) {
        /*
         * Use keystore password if no private key password is
         * specified.
         */
        privateKeyPassword = keyStorePassword;
    }
    c.clearPassword();
}
 
Example 16
Source File: KeyStoreLoginModule.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private void saveStorePass(PasswordCallback c) {
    keyStorePassword = c.getPassword();
    if (keyStorePassword == null) {
        /* Treat a NULL password as an empty password */
        keyStorePassword = new char[0];
    }
    c.clearPassword();
}
 
Example 17
Source File: KeyStoreLoginModule.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
private void saveKeyPass(PasswordCallback c) {
    privateKeyPassword = c.getPassword();
    if (privateKeyPassword == null || privateKeyPassword.length == 0) {
        /*
         * Use keystore password if no private key password is
         * specified.
         */
        privateKeyPassword = keyStorePassword;
    }
    c.clearPassword();
}
 
Example 18
Source File: KeyStoreLoginModule.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
private void saveStorePass(PasswordCallback c) {
    keyStorePassword = c.getPassword();
    if (keyStorePassword == null) {
        /* Treat a NULL password as an empty password */
        keyStorePassword = new char[0];
    }
    c.clearPassword();
}
 
Example 19
Source File: KeyStoreLoginModule.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
private void saveKeyPass(PasswordCallback c) {
    privateKeyPassword = c.getPassword();
    if (privateKeyPassword == null || privateKeyPassword.length == 0) {
        /*
         * Use keystore password if no private key password is
         * specified.
         */
        privateKeyPassword = keyStorePassword;
    }
    c.clearPassword();
}
 
Example 20
Source File: AltClientLoginModule.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Method to authenticate a Subject (phase 1).
 */
public boolean login() throws LoginException
{
   // If useFirstPass is true, look for the shared password
   if( useFirstPass == true )
   {
         return true;
   }

  /* There is no password sharing or we are the first login module. Get
      the username and password from the callback hander.
   */
   if (callbackHandler == null)
      throw PicketBoxMessages.MESSAGES.noCallbackHandlerAvailable();

   PasswordCallback pc = new PasswordCallback(PicketBoxMessages.MESSAGES.enterPasswordMessage(), false);
   NameCallback nc = new NameCallback(PicketBoxMessages.MESSAGES.enterUsernameMessage(), "guest");
   Callback[] callbacks = {nc, pc};
   try
   {
      char[] tmpPassword;
      
      callbackHandler.handle(callbacks);
      username = nc.getName();
      tmpPassword = pc.getPassword();
      if (tmpPassword != null)
      {
         password = new char[tmpPassword.length];
         System.arraycopy(tmpPassword, 0, password, 0, tmpPassword.length);
         pc.clearPassword();
      }
   }
   catch (java.io.IOException ioe)
   {
      throw new LoginException(ioe.toString());
   }
   catch (UnsupportedCallbackException uce)
   {
      LoginException le = new LoginException(uce.getLocalizedMessage());
      le.initCause(uce);
      throw le;
   }
   return true;
}