Package java.io

Examples of java.io.Console.readPassword()


            if (passwordPrompt == null)
                passwordPrompt = "Enter your password";

            Console console = System.console();

            char[] passwd = console.readPassword(passwordPrompt + ": ");
            char[] passwd1 = console.readPassword(passwordPrompt + " again: ");
            boolean noMatch = !Arrays.equals(passwd, passwd1);
            if (noMatch)
                System.out.println("Values entered don't match");
            else {
View Full Code Here


                passwordPrompt = "Enter your password";

            Console console = System.console();

            char[] passwd = console.readPassword(passwordPrompt + ": ");
            char[] passwd1 = console.readPassword(passwordPrompt + " again: ");
            boolean noMatch = !Arrays.equals(passwd, passwd1);
            if (noMatch)
                System.out.println("Values entered don't match");
            else {
                System.out.println("Values match");
View Full Code Here

            if ( passwd == null )
            {
                Console cons;
                char[] password;
                if ( ( cons = System.console() ) != null
                    && ( password = cons.readPassword( "Master password: " ) ) != null )
                {
                    // Cipher uses Strings
                    passwd = String.copyValueOf( password );
                   
                    // Sun/Oracle advises to empty the char array
View Full Code Here

            if ( passwd == null )
            {
                Console cons;
                char[] password;
                if ( ( cons = System.console() ) != null
                    && ( password = cons.readPassword( "Password: " ) ) != null )
                {
                    // Cipher uses Strings
                    passwd = String.copyValueOf( password );

                    // Sun/Oracle advises to empty the char array
View Full Code Here

            Console console = System.console();
            if (console == null) {
              throw new ParameterException("No console is available to get parameter " + a);
            }
            System.out.print("Value for " + a + " (" + pd.getDescription() + "):");
            char[] password = console.readPassword();
            pd.addValue(new String(password));
          } else {
            //
            // Regular option
            //
View Full Code Here

        MobClient cli;

        try {
            Console console = System.console();
            username = console.readLine("username: ");
            password = new String(console.readPassword("password: "));

            System.out.println("> Connessione al server in corso, attendere...");
            cli = authServer.login(username, password);
        }
        catch (RemoteException re){
View Full Code Here

        }

        if (must_auth) {
            if (cons != null) {
                username = cons.readLine("Management username: ");
                password = String.valueOf(cons.readPassword("Management password: "));
            }
        }
        SosInterpreter interpreter = new SosInterpreter();
        return interpreter.collect(username, password, host, port);
    }
View Full Code Here

           
        System.out.println("Password will not display on screen.");
        System.out.print("Password: ");
        System.out.flush();

        password1 = console.readPassword();
       
        System.out.print("Again to confirm: ");
        System.out.flush();
       
        password2 = console.readPassword();
View Full Code Here

        password1 = console.readPassword();
       
        System.out.print("Again to confirm: ");
        System.out.flush();
       
        password2 = console.readPassword();

            //TODO real password validation
            if (password1.length > 1 && Arrays.equals(password1, password2))
        {
          // password OK
View Full Code Here

        do
        {
          if (!StringUtils.isEmpty(getPasswordPrompt()))
             System.err.print(getPasswordPrompt() + ": ");
         
          password = console.readPassword();
         
          //User cancelled
          if (password.length == 0)
            return(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.