Java Code Examples for com.sun.security.auth.callback.TextCallbackHandler#handle()

The following examples show how to use com.sun.security.auth.callback.TextCallbackHandler#handle() . 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: Default.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String args[]) throws Exception {
     TextCallbackHandler h = new TextCallbackHandler();
     NameCallback nc = new NameCallback("Name: ", "charlie");
     ConfirmationCallback cc = new ConfirmationCallback
                     ("Correct?",
                     ConfirmationCallback.INFORMATION,
                     ConfirmationCallback.YES_NO_OPTION,
                     ConfirmationCallback.NO);

     Callback[] callbacks = { nc, cc };
     h.handle(callbacks);

     if (cc.getSelectedIndex() == ConfirmationCallback.YES) {
         System.out.println("yes");
     } else {
         System.out.println("no");
     }
}
 
Example 2
Source File: Default.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String args[]) throws Exception {
     TextCallbackHandler h = new TextCallbackHandler();
     NameCallback nc = new NameCallback("Name: ", "charlie");
     ConfirmationCallback cc = new ConfirmationCallback
                     ("Correct?",
                     ConfirmationCallback.INFORMATION,
                     ConfirmationCallback.YES_NO_OPTION,
                     ConfirmationCallback.NO);

     Callback[] callbacks = { nc, cc };
     h.handle(callbacks);

     if (cc.getSelectedIndex() == ConfirmationCallback.YES) {
         System.out.println("yes");
     } else {
         System.out.println("no");
     }
}
 
Example 3
Source File: Default.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String args[]) throws Exception {
     TextCallbackHandler h = new TextCallbackHandler();
     NameCallback nc = new NameCallback("Name: ", "charlie");
     ConfirmationCallback cc = new ConfirmationCallback
                     ("Correct?",
                     ConfirmationCallback.INFORMATION,
                     ConfirmationCallback.YES_NO_OPTION,
                     ConfirmationCallback.NO);

     Callback[] callbacks = { nc, cc };
     h.handle(callbacks);

     if (cc.getSelectedIndex() == ConfirmationCallback.YES) {
         System.out.println("yes");
     } else {
         System.out.println("no");
     }
}
 
Example 4
Source File: Default.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String args[]) throws Exception {
     TextCallbackHandler h = new TextCallbackHandler();
     NameCallback nc = new NameCallback("Name: ", "charlie");
     ConfirmationCallback cc = new ConfirmationCallback
                     ("Correct?",
                     ConfirmationCallback.INFORMATION,
                     ConfirmationCallback.YES_NO_OPTION,
                     ConfirmationCallback.NO);

     Callback[] callbacks = { nc, cc };
     h.handle(callbacks);

     if (cc.getSelectedIndex() == ConfirmationCallback.YES) {
         System.out.println("yes");
     } else {
         System.out.println("no");
     }
}
 
Example 5
Source File: Default.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String args[]) throws Exception {
     TextCallbackHandler h = new TextCallbackHandler();
     NameCallback nc = new NameCallback("Name: ", "charlie");
     ConfirmationCallback cc = new ConfirmationCallback
                     ("Correct?",
                     ConfirmationCallback.INFORMATION,
                     ConfirmationCallback.YES_NO_OPTION,
                     ConfirmationCallback.NO);

     Callback[] callbacks = { nc, cc };
     h.handle(callbacks);

     if (cc.getSelectedIndex() == ConfirmationCallback.YES) {
         System.out.println("yes");
     } else {
         System.out.println("no");
     }
}
 
Example 6
Source File: Default.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String args[]) throws Exception {
     TextCallbackHandler h = new TextCallbackHandler();
     NameCallback nc = new NameCallback("Name: ", "charlie");
     ConfirmationCallback cc = new ConfirmationCallback
                     ("Correct?",
                     ConfirmationCallback.INFORMATION,
                     ConfirmationCallback.YES_NO_OPTION,
                     ConfirmationCallback.NO);

     Callback[] callbacks = { nc, cc };
     h.handle(callbacks);

     if (cc.getSelectedIndex() == ConfirmationCallback.YES) {
         System.out.println("yes");
     } else {
         System.out.println("no");
     }
}
 
Example 7
Source File: Default.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String args[]) throws Exception {
     TextCallbackHandler h = new TextCallbackHandler();
     NameCallback nc = new NameCallback("Name: ", "charlie");
     ConfirmationCallback cc = new ConfirmationCallback
                     ("Correct?",
                     ConfirmationCallback.INFORMATION,
                     ConfirmationCallback.YES_NO_OPTION,
                     ConfirmationCallback.NO);

     Callback[] callbacks = { nc, cc };
     h.handle(callbacks);

     if (cc.getSelectedIndex() == ConfirmationCallback.YES) {
         System.out.println("yes");
     } else {
         System.out.println("no");
     }
}
 
Example 8
Source File: Default.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String args[]) throws Exception {
     TextCallbackHandler h = new TextCallbackHandler();
     NameCallback nc = new NameCallback("Name: ", "charlie");
     ConfirmationCallback cc = new ConfirmationCallback
                     ("Correct?",
                     ConfirmationCallback.INFORMATION,
                     ConfirmationCallback.YES_NO_OPTION,
                     ConfirmationCallback.NO);

     Callback[] callbacks = { nc, cc };
     h.handle(callbacks);

     if (cc.getSelectedIndex() == ConfirmationCallback.YES) {
         System.out.println("yes");
     } else {
         System.out.println("no");
     }
}
 
Example 9
Source File: Default.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String args[]) throws Exception {
     TextCallbackHandler h = new TextCallbackHandler();
     NameCallback nc = new NameCallback("Name: ", "charlie");
     ConfirmationCallback cc = new ConfirmationCallback
                     ("Correct?",
                     ConfirmationCallback.INFORMATION,
                     ConfirmationCallback.YES_NO_OPTION,
                     ConfirmationCallback.NO);

     Callback[] callbacks = { nc, cc };
     h.handle(callbacks);

     if (cc.getSelectedIndex() == ConfirmationCallback.YES) {
         System.out.println("yes");
     } else {
         System.out.println("no");
     }
}
 
Example 10
Source File: Default.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String args[]) throws Exception {
     TextCallbackHandler h = new TextCallbackHandler();
     NameCallback nc = new NameCallback("Name: ", "charlie");
     ConfirmationCallback cc = new ConfirmationCallback
                     ("Correct?",
                     ConfirmationCallback.INFORMATION,
                     ConfirmationCallback.YES_NO_OPTION,
                     ConfirmationCallback.NO);

     Callback[] callbacks = { nc, cc };
     h.handle(callbacks);

     if (cc.getSelectedIndex() == ConfirmationCallback.YES) {
         System.out.println("yes");
     } else {
         System.out.println("no");
     }
}
 
Example 11
Source File: Default.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String args[]) throws Exception {
     TextCallbackHandler h = new TextCallbackHandler();
     NameCallback nc = new NameCallback("Name: ", "charlie");
     ConfirmationCallback cc = new ConfirmationCallback
                     ("Correct?",
                     ConfirmationCallback.INFORMATION,
                     ConfirmationCallback.YES_NO_OPTION,
                     ConfirmationCallback.NO);

     Callback[] callbacks = { nc, cc };
     h.handle(callbacks);

     if (cc.getSelectedIndex() == ConfirmationCallback.YES) {
         System.out.println("yes");
     } else {
         System.out.println("no");
     }
}
 
Example 12
Source File: Password.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String args[]) throws Exception {
     TextCallbackHandler h = new TextCallbackHandler();
     PasswordCallback nc = new PasswordCallback("Invisible: ", false);
     PasswordCallback nc2 = new PasswordCallback("Visible: ", true);

     System.out.println("Two passwords will be prompted for. The first one " +
             "should have echo off, the second one on. Otherwise, this test fails");
     Callback[] callbacks = { nc, nc2 };
     h.handle(callbacks);
     System.out.println("You input " + new String(nc.getPassword()) +
             " and " + new String(nc2.getPassword()));
}
 
Example 13
Source File: Password.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String args[]) throws Exception {
     TextCallbackHandler h = new TextCallbackHandler();
     PasswordCallback nc = new PasswordCallback("Invisible: ", false);
     PasswordCallback nc2 = new PasswordCallback("Visible: ", true);

     System.out.println("Two passwords will be prompted for. The first one " +
             "should have echo off, the second one on. Otherwise, this test fails");
     Callback[] callbacks = { nc, nc2 };
     h.handle(callbacks);
     System.out.println("You input " + new String(nc.getPassword()) +
             " and " + new String(nc2.getPassword()));
}
 
Example 14
Source File: Password.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String args[]) throws Exception {
     TextCallbackHandler h = new TextCallbackHandler();
     PasswordCallback nc = new PasswordCallback("Invisible: ", false);
     PasswordCallback nc2 = new PasswordCallback("Visible: ", true);

     System.out.println("Two passwords will be prompted for. The first one " +
             "should have echo off, the second one on. Otherwise, this test fails");
     Callback[] callbacks = { nc, nc2 };
     h.handle(callbacks);
     System.out.println("You input " + new String(nc.getPassword()) +
             " and " + new String(nc2.getPassword()));
}
 
Example 15
Source File: Password.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String args[]) throws Exception {
     TextCallbackHandler h = new TextCallbackHandler();
     PasswordCallback nc = new PasswordCallback("Invisible: ", false);
     PasswordCallback nc2 = new PasswordCallback("Visible: ", true);

     System.out.println("Two passwords will be prompted for. The first one " +
             "should have echo off, the second one on. Otherwise, this test fails");
     Callback[] callbacks = { nc, nc2 };
     h.handle(callbacks);
     System.out.println("You input " + new String(nc.getPassword()) +
             " and " + new String(nc2.getPassword()));
}
 
Example 16
Source File: Password.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String args[]) throws Exception {
     TextCallbackHandler h = new TextCallbackHandler();
     PasswordCallback nc = new PasswordCallback("Invisible: ", false);
     PasswordCallback nc2 = new PasswordCallback("Visible: ", true);

     System.out.println("Two passwords will be prompted for. The first one " +
             "should have echo off, the second one on. Otherwise, this test fails");
     Callback[] callbacks = { nc, nc2 };
     h.handle(callbacks);
     System.out.println("You input " + new String(nc.getPassword()) +
             " and " + new String(nc2.getPassword()));
}
 
Example 17
Source File: Password.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String args[]) throws Exception {
     TextCallbackHandler h = new TextCallbackHandler();
     PasswordCallback nc = new PasswordCallback("Invisible: ", false);
     PasswordCallback nc2 = new PasswordCallback("Visible: ", true);

     System.out.println("Two passwords will be prompted for. The first one " +
             "should have echo off, the second one on. Otherwise, this test fails");
     Callback[] callbacks = { nc, nc2 };
     h.handle(callbacks);
     System.out.println("You input " + new String(nc.getPassword()) +
             " and " + new String(nc2.getPassword()));
}
 
Example 18
Source File: Password.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String args[]) throws Exception {
     TextCallbackHandler h = new TextCallbackHandler();
     PasswordCallback nc = new PasswordCallback("Invisible: ", false);
     PasswordCallback nc2 = new PasswordCallback("Visible: ", true);

     System.out.println("Two passwords will be prompted for. The first one " +
             "should have echo off, the second one on. Otherwise, this test fails");
     Callback[] callbacks = { nc, nc2 };
     h.handle(callbacks);
     System.out.println("You input " + new String(nc.getPassword()) +
             " and " + new String(nc2.getPassword()));
}
 
Example 19
Source File: Password.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String args[]) throws Exception {
     TextCallbackHandler h = new TextCallbackHandler();
     PasswordCallback nc = new PasswordCallback("Invisible: ", false);
     PasswordCallback nc2 = new PasswordCallback("Visible: ", true);

     System.out.println("Two passwords will be prompted for. The first one " +
             "should have echo off, the second one on. Otherwise, this test fails");
     Callback[] callbacks = { nc, nc2 };
     h.handle(callbacks);
     System.out.println("You input " + new String(nc.getPassword()) +
             " and " + new String(nc2.getPassword()));
}
 
Example 20
Source File: Password.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String args[]) throws Exception {
     TextCallbackHandler h = new TextCallbackHandler();
     PasswordCallback nc = new PasswordCallback("Invisible: ", false);
     PasswordCallback nc2 = new PasswordCallback("Visible: ", true);

     System.out.println("Two passwords will be prompted for. The first one " +
             "should have echo off, the second one on. Otherwise, this test fails");
     Callback[] callbacks = { nc, nc2 };
     h.handle(callbacks);
     System.out.println("You input " + new String(nc.getPassword()) +
             " and " + new String(nc2.getPassword()));
}