Code example for UnsupportedCallbackException

Methods: getCallback

0
      LoginException ex = new LoginException(
          "IOException logging in."); 
      ex.initCause(e);
      throw ex;
    } catch (UnsupportedCallbackException e) {
      String className = e.getCallback().getClass().getName();
      LoginException ex = new LoginException(className
          + " is not a supported Callback."); 
      ex.initCause(e);
      throw ex;
    } 
 
    // Now that the CallbackHandler has gathered the username and password, 
    // use them to authenticate the user against the expected passwords. 
    name = nameCB.getName();
    password = String.valueOf(passwordCB.getPassword());
 
    if ("sysadmin".equals(name) && "password".equals(password)) {
      // login in sysadmin 
      return true;