Package javax.security.auth.callback

Examples of javax.security.auth.callback.ConfirmationCallback


                        pw = null;
                    } else {
                        cb.setPassword(new char[0]);
                    }
                } else if (callbacks[i] instanceof ConfirmationCallback) {
                    ConfirmationCallback cb = (ConfirmationCallback) callbacks[i];
                    cb.setSelectedIndex(cb.getDefaultOption());
                } else {
                    throw new UnsupportedCallbackException(callbacks[i]);
                }
            }
        }
View Full Code Here


                    } else {
                        throw new UnsupportedCallbackException(callbacks[i]);
                    }
                } else if (callbacks[i] instanceof ConfirmationCallback) {
                    logger.fine("handle confirm callback");
                    ConfirmationCallback cb = (ConfirmationCallback) callbacks[i];
                    cb.setSelectedIndex(cb.getDefaultOption());
                } else {
                    throw new UnsupportedCallbackException(callbacks[i]);
                }
            }
        }
View Full Code Here

    * @throws UnsupportedCallbackException if the callback is not an
    * 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

                        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

     * 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

      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

public class ConfirmationCallbackTest extends SerializationTest implements
        SerializationTest.SerializableAssert {

    @Override
    protected Object[] getData() {
        return new Object[] { new ConfirmationCallback("prompt",
                ConfirmationCallback.INFORMATION,
                ConfirmationCallback.YES_NO_OPTION, 1) };
    }
View Full Code Here

     *  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

     * 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

     * 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

TOP

Related Classes of javax.security.auth.callback.ConfirmationCallback

Copyright © 2018 www.massapicom. 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.