com.sun.security.auth.callback.TextCallbackHandler Java Examples

The following examples show how to use com.sun.security.auth.callback.TextCallbackHandler. 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 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 #2
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 #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 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 #5
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 #6
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 #7
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 #8
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 #9
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 #10
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 #11
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 #12
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 #13
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 #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: NPE.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String args[]) throws Exception {
     System.setIn(new ByteArrayInputStream(new byte[0]));

     try {
         new TextCallbackHandler().handle(new Callback[]  {
             new NameCallback("Name: ") }
         );
     } catch (IOException ioe) {
         // This is OK
     }
}
 
Example #16
Source File: Confirm.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    // Provide answer in an individual stream so that the program
    // does not block.
    System.setIn(new ByteArrayInputStream("1\n".getBytes()));

    new TextCallbackHandler().handle(new Callback[]{
        new ConfirmationCallback("Prince", ConfirmationCallback.INFORMATION,
                new String[]{"To be", "Not to be"}, 0)});
}
 
Example #17
Source File: Confirm.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 {
    // Provide answer in an individual stream so that the program
    // does not block.
    System.setIn(new ByteArrayInputStream("1\n".getBytes()));

    new TextCallbackHandler().handle(new Callback[]{
        new ConfirmationCallback("Prince", ConfirmationCallback.INFORMATION,
                new String[]{"To be", "Not to be"}, 0)});
}
 
Example #18
Source File: NPE.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 {
     System.setIn(new ByteArrayInputStream(new byte[0]));

     try {
         new TextCallbackHandler().handle(new Callback[]  {
             new NameCallback("Name: ") }
         );
     } catch (IOException ioe) {
         // This is OK
     }
}
 
Example #19
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 #20
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 #21
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 #22
Source File: Confirm.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 {
    // Provide answer in an individual stream so that the program
    // does not block.
    System.setIn(new ByteArrayInputStream("1\n".getBytes()));

    new TextCallbackHandler().handle(new Callback[]{
        new ConfirmationCallback("Prince", ConfirmationCallback.INFORMATION,
                new String[]{"To be", "Not to be"}, 0)});
}
 
Example #23
Source File: NPE.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 {
     System.setIn(new ByteArrayInputStream(new byte[0]));

     try {
         new TextCallbackHandler().handle(new Callback[]  {
             new NameCallback("Name: ") }
         );
     } catch (IOException ioe) {
         // This is OK
     }
}
 
Example #24
Source File: Confirm.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 {
    // Provide answer in an individual stream so that the program
    // does not block.
    System.setIn(new ByteArrayInputStream("1\n".getBytes()));

    new TextCallbackHandler().handle(new Callback[]{
        new ConfirmationCallback("Prince", ConfirmationCallback.INFORMATION,
                new String[]{"To be", "Not to be"}, 0)});
}
 
Example #25
Source File: Confirm.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 {
    // Provide answer in an individual stream so that the program
    // does not block.
    System.setIn(new ByteArrayInputStream("1\n".getBytes()));

    new TextCallbackHandler().handle(new Callback[]{
        new ConfirmationCallback("Prince", ConfirmationCallback.INFORMATION,
                new String[]{"To be", "Not to be"}, 0)});
}
 
Example #26
Source File: NPE.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 {
     System.setIn(new ByteArrayInputStream(new byte[0]));

     try {
         new TextCallbackHandler().handle(new Callback[]  {
             new NameCallback("Name: ") }
         );
     } catch (IOException ioe) {
         // This is OK
     }
}
 
Example #27
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 #28
Source File: Confirm.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 {
    // Provide answer in an individual stream so that the program
    // does not block.
    System.setIn(new ByteArrayInputStream("1\n".getBytes()));

    new TextCallbackHandler().handle(new Callback[]{
        new ConfirmationCallback("Prince", ConfirmationCallback.INFORMATION,
                new String[]{"To be", "Not to be"}, 0)});
}
 
Example #29
Source File: NPE.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 {
     System.setIn(new ByteArrayInputStream(new byte[0]));

     try {
         new TextCallbackHandler().handle(new Callback[]  {
             new NameCallback("Name: ") }
         );
     } catch (IOException ioe) {
         // This is OK
     }
}
 
Example #30
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()));
}