Examples of ConfirmationCallback


Examples of javax.security.auth.callback.ConfirmationCallback

    /*
     * Regression test for bug in setSelectedIndex
     */
    public final void testSetSelectedIndex() throws Exception {
        cc = new ConfirmationCallback("prompt", mt[0], ot[0], dopt[0]);
        cc.setSelectedIndex(ConfirmationCallback.YES);
    }
View Full Code Here

Examples of javax.security.auth.callback.ConfirmationCallback

      // Setup default callback handlers.
      Callback[] callbacks = new Callback[]
      {
              new NameCallback("Username: "), /* 0 */
              new PasswordCallback("Password: ", false), /* 1 */
              new ConfirmationCallback(ConfirmationCallback.INFORMATION,
                      ConfirmationCallback.YES_NO_OPTION, ConfirmationCallback.NO),

              /* 2 */
              new TextInputCallback("Domain: "), /* 3 */
              new ConfigurationCallback(), /* 4 */
 
View Full Code Here

Examples of javax.security.auth.callback.ConfirmationCallback

     * instance of NameCallback or PasswordCallback
     */
    public void handle(Callback[] callbacks)
        throws IOException, UnsupportedCallbackException
    {
        ConfirmationCallback confirmation = null;

        for (int i = 0; i < callbacks.length; i++) {
            if (callbacks[i] instanceof TextOutputCallback) {
                TextOutputCallback tc = (TextOutputCallback) callbacks[i];

View Full Code Here

Examples of javax.security.auth.callback.ConfirmationCallback

                        pc.setPassword(password.getPassword());
                    }
                });

            } else if (callbacks[i] instanceof ConfirmationCallback) {
                ConfirmationCallback cc = (ConfirmationCallback)callbacks[i];

                confirmation.setCallback(cc);
                if (cc.getPrompt() != null) {
                    messages.add(cc.getPrompt());
                }

            } else {
                throw new UnsupportedCallbackException(
                    callbacks[i], "Unrecognized Callback");
View Full Code Here

Examples of javax.security.auth.callback.ConfirmationCallback

    /**
     * @InheritDoc
     */
    public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
        ConfirmationCallback confirmation = null;

        for (Callback callback : callbacks) {
            if (callback instanceof TextOutputCallback) {
                handleOutputCallback((TextOutputCallback) callback);
            } else if (callback instanceof NameCallback) {
View Full Code Here

Examples of javax.security.auth.callback.ConfirmationCallback

     *  Ctor test 
     */
    public final void testConfirmationCallback_01() throws IllegalArgumentException {
        try {
            for (int i = 0; i < mt.length; i++) {
                cc = new ConfirmationCallback(mt[i], ot[1], dopt[1]);
            }
        } catch (IllegalArgumentException e){}
    }
View Full Code Here

Examples of javax.security.auth.callback.ConfirmationCallback

     * if optionType is not either YES_NO_OPTION, YES_NO_CANCEL_OPTION,OK_CANCEL_OPTION;
     * if defaultOption does not lie within the array boundaries of options.
     */
    public final void testConfirmationCallback_02() throws IllegalArgumentException{
        try {
            cc = new ConfirmationCallback(3, ot[1], dopt[1]);
            fail("Message type should be either INFORMATION, WARNING or ERROR");
        }catch (IllegalArgumentException e){}
        try {
            cc = new ConfirmationCallback(mt[1], 3, dopt[1]);
            fail("Option type should be either YES_NO_OPTION, YES_NO_CANCEL_OPTION or OK_CANCEL_OPTION");
        } catch (IllegalArgumentException e){}
        try {
            cc = new ConfirmationCallback(mt[1], ot[1], 4);
            fail("Default option type should be either YES, NO, CANCEL or OK");
        } catch (IllegalArgumentException e){}
    }
View Full Code Here

Examples of javax.security.auth.callback.ConfirmationCallback

     * else ok.    
     */
   
    public final void testConfirmationCallback_03() throws IllegalArgumentException {
        try {
            cc = new ConfirmationCallback(ConfirmationCallback.INFORMATION, ot[0], dopt[0]);
        } catch(IllegalArgumentException e){}
        try {
            cc = new ConfirmationCallback(ConfirmationCallback.INFORMATION, ot[0], dopt[1]);
        } catch(IllegalArgumentException e){}
        try {
            cc = new ConfirmationCallback(ConfirmationCallback.INFORMATION, ot[0], dopt[2]);
            fail("1. If option type is YES_NO_OPTION then default option should be YES/NO");
        } catch(IllegalArgumentException e){}
        try {
            cc = new ConfirmationCallback(ConfirmationCallback.INFORMATION, ot[0], dopt[3]);
            fail("2. If option type is YES_NO_OPTION then default option should be YES/NO ");
        } catch(IllegalArgumentException e){}
       
}
View Full Code Here

Examples of javax.security.auth.callback.ConfirmationCallback

     * Expected IAE, if optionType is YES_NO_CANCEL_OPTION and defaultOption is not YES/NO/CANCEL,
     * else ok.    
     */
    public final void testConfirmationCallback_04() throws IllegalArgumentException {
        try {
            cc = new ConfirmationCallback(ConfirmationCallback.INFORMATION, ot[1], dopt[0]);
        } catch(IllegalArgumentException e){}
        try {
            cc = new ConfirmationCallback(ConfirmationCallback.INFORMATION, ot[1], dopt[1]);
        } catch(IllegalArgumentException e){}
        try {
            cc = new ConfirmationCallback(ConfirmationCallback.INFORMATION, ot[1], dopt[2]);
        } catch(IllegalArgumentException e){}
        try {
            cc = new ConfirmationCallback(ConfirmationCallback.INFORMATION, ot[1], dopt[3]);
            fail("1. If option type is YES_NO_CANCEL_OPTION then default option should be YES/NO/CANCEL");
        } catch(IllegalArgumentException e){}

    }
View Full Code Here

Examples of javax.security.auth.callback.ConfirmationCallback

     * Expected IAE, if optionType is OK_CANCEL_OPTION and defaultOption is not CANCEL/OK
     * else ok.    
     */
    public final void testConfirmationCallback_05() throws IllegalArgumentException {
        try {
            cc = new ConfirmationCallback(ConfirmationCallback.INFORMATION, ot[2], dopt[0]);
            fail("1. If option type is OK_CANCEL_OPTION then default option should be CANCEL/OK");
        } catch(IllegalArgumentException e){}
        try {
            cc = new ConfirmationCallback(ConfirmationCallback.INFORMATION, ot[2], dopt[1]);
            fail("2. If option type is OK_CANCEL_OPTION then default option should be CANCEL/OK");
        } catch(IllegalArgumentException e){}
        try {
            cc = new ConfirmationCallback(ConfirmationCallback.INFORMATION, ot[2], dopt[2]);
        } catch(IllegalArgumentException e){}
        try {
            cc = new ConfirmationCallback(ConfirmationCallback.INFORMATION, ot[2], dopt[3]);
        } catch(IllegalArgumentException e){}
    }
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.