Package javax.security.auth.callback

Examples of javax.security.auth.callback.ConfirmationCallback


      }
    catch (Exception x)
      {
      }
    String nl = Util.getProperty("line.separator");
    ConfirmationCallback confirm = new ConfirmationCallback(
      "The server's certificate could not be verified. There is no proof" + nl +
      "that this server is who it claims to be, or that their certificate" + nl +
      "is valid. Do you wish to continue connecting?",
      ConfirmationCallback.ERROR, ConfirmationCallback.YES_NO_OPTION,
      ConfirmationCallback.NO);
    try
      {
        handler.handle(new Callback[] { confirm });
      }
    catch (Exception x)
      {
        return false;
      }
    return confirm.getSelectedIndex() == ConfirmationCallback.YES;
  }
View Full Code Here


     * Creates a default ConfirmationCallback binding (because the caller did
     * not provide one).
     * @return the default ConfirmationCallbackUIBinding
     */
    public CallbackGUIBindings.Confirmation getDefaultConfirmationCallbackUIBinding() {
        ConfirmationCallback defaultCallback = new ConfirmationCallback
                (ConfirmationCallback.INFORMATION,
                 ConfirmationCallback.OK_CANCEL_OPTION,
                 ConfirmationCallback.OK);

        CallbackGUIBindings.Confirmation binding =
View Full Code Here

        // 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)});
    }
View Full Code Here

     * Creates a default ConfirmationCallback binding (because the caller did
     * not provide one).
     * @return the default ConfirmationCallbackUIBinding
     */
    public CallbackGUIBindings.Confirmation getDefaultConfirmationCallbackUIBinding() {
        ConfirmationCallback defaultCallback = new ConfirmationCallback
                (ConfirmationCallback.INFORMATION,
                 ConfirmationCallback.OK_CANCEL_OPTION,
                 ConfirmationCallback.OK);

        CallbackGUIBindings.Confirmation binding =
View Full Code Here

          pc.setPassword(getPasswordService().encrypt(password).toCharArray());
        } catch (PasswordException e) {
          logger.error(e, e);
        }
      } else if (callbacks[x] instanceof ConfirmationCallback) {
        ConfirmationCallback conf = (ConfirmationCallback) callbacks[x];
        if (conf.getMessageType() != ConfirmationCallback.YES_NO_OPTION) {
          throw new UnsupportedCallbackException(conf, "cannot handle none YN questions yet");
        }
        confirmNewPlayer(conf);
      } else if (callbacks[x] instanceof ActionCallback) {
        ActionCallback cp = (ActionCallback) callbacks[x];
View Full Code Here

      retrieveExistingPlayer(); // populate dupe player if there is one
      doLoadPlayerCallback(); // load the player
      boolean confirmed = false;

      if (getPlayer() == null) {
        ConfirmationCallback confirm = new ConfirmationCallback("Your name is not in our annuls:" + nameCallback.getName() + "..  Did you type it correctly?", ConfirmationCallback.INFORMATION, ConfirmationCallback.YES_NO_OPTION, ConfirmationCallback.YES);
        cb = createCallbackArray(confirm);
        getCallbackHandler().handle(cb);
        confirmed = (confirm.getSelectedIndex() == ConfirmationCallback.YES);
      }
      if (confirmed || getPlayer() != null) {

        if (!getUsername().equals(GUEST_USER)) {
          getPlayerPrincipals().add(createPrincipal(PLAYER_PRINCIPAL));
View Full Code Here

  protected void confirmDestIfDupeExisted() throws IOException, UnsupportedCallbackException, FailedLoginException {
    Callback[] cb;
    Player dupe = getDupe();
    if (dupe != null) {
      // we need to dest this player if they say yes
      ConfirmationCallback alreadyPlaying = new ConfirmationCallback("You are already playing. Throw the other copy out?", ConfirmationCallback.INFORMATION, ConfirmationCallback.YES_NO_OPTION, ConfirmationCallback.NO);
      cb = createCallbackArray(alreadyPlaying);
      getCallbackHandler().handle(cb);
      if (alreadyPlaying.getSelectedIndex() == ConfirmationCallback.YES) {
        dupe.dest(true);
      } else {
        throw new FailedLoginException("cannot log in, already logged in!");
      }
    }
View Full Code Here

      retrieveExistingPlayer(); // populate dupe player if there is one
      doLoadPlayerCallback(); // load the player
      boolean confirmed = false;

      if (getPlayer() == null) {
        ConfirmationCallback confirm = new ConfirmationCallback("Your name is not in our annuls:" + nameCallback.getName() + "..  Did you type it correctly?", ConfirmationCallback.INFORMATION, ConfirmationCallback.YES_NO_OPTION, ConfirmationCallback.YES);
        cb = createCallbackArray(confirm);
        getCallbackHandler().handle(cb);
        confirmed = (confirm.getSelectedIndex() == ConfirmationCallback.YES);
      }
      if (confirmed || getPlayer() != null) {

        if (!getUsername().equals(GUEST_USER)) {
          getPlayerPrincipals().add(createPrincipal(PLAYER_PRINCIPAL));
View Full Code Here

  protected void confirmDestIfDupeExisted() throws IOException, UnsupportedCallbackException, FailedLoginException {
    Callback[] cb;
    Player dupe = getDupe();
    if (dupe != null) {
      // we need to dest this player if they say yes
      ConfirmationCallback alreadyPlaying = new ConfirmationCallback("You are already playing. Throw the other copy out?", ConfirmationCallback.INFORMATION, ConfirmationCallback.YES_NO_OPTION, ConfirmationCallback.NO);
      cb = createCallbackArray(alreadyPlaying);
      getCallbackHandler().handle(cb);
      if (alreadyPlaying.getSelectedIndex() == ConfirmationCallback.YES) {
        dupe.getRegistry().dest(dupe, true);
      } else {
        throw new FailedLoginException("cannot log in, already logged in!");
      }
    }
View Full Code Here

          pc.setPassword(getPasswordService().encrypt(password).toCharArray());
        } catch (PasswordException e) {
          logger.error(e, e);
        }
      } else if (callbacks[x] instanceof ConfirmationCallback) {
        ConfirmationCallback conf = (ConfirmationCallback) callbacks[x];
        if (conf.getMessageType() != ConfirmationCallback.YES_NO_OPTION) {
          throw new UnsupportedCallbackException(conf, "cannot handle none YN questions yet");
        }
        confirmNewPlayer(conf);
      } else if (callbacks[x] instanceof ActionCallback) {
        ActionCallback cp = (ActionCallback) callbacks[x];
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.