Package org.eclipse.ecf.core.security

Examples of org.eclipse.ecf.core.security.CallbackHandler.handle()


    final CallbackHandler callbackHandler = connectContext.getCallbackHandler();
    if (callbackHandler == null)
      return null;
    final NameCallback usernameCallback = new NameCallback(USERNAME_PREFIX);
    final ObjectCallback passwordCallback = new ObjectCallback();
    callbackHandler.handle(new Callback[] {usernameCallback, passwordCallback});
    username = usernameCallback.getName();
    password = (String) passwordCallback.getObject();
    return new UsernamePasswordCredentials(username, password);
  }
View Full Code Here


          final Callback[] callbacks = new Callback[1];
          callbacks[0] = new NameCallback(Messages.XMPPChatRoomContainer_NAME_CALLBACK_NICK, roomID.getNickname());
          if (connectContext != null) {
            final CallbackHandler handler = connectContext.getCallbackHandler();
            if (handler != null) {
              handler.handle(callbacks);
            }
          }
          if (callbacks[0] instanceof NameCallback) {
            final NameCallback cb = (NameCallback) callbacks[0];
            nick = cb.getName();
View Full Code Here

    if (callbackHandler == null)
      return;
    final NameCallback usernameCallback = new NameCallback(USERNAME_PREFIX);
    final ObjectCallback passwordCallback = new ObjectCallback();
    // Call callback with username and password callbacks
    callbackHandler.handle(new Callback[] {usernameCallback, passwordCallback});
    username = usernameCallback.getName();
    Object o = passwordCallback.getObject();
    if (!(o instanceof String))
      throw new UnsupportedCallbackException(passwordCallback, Messages.UrlConnectionRetrieveFileTransfer_UnsupportedCallbackException);
    password = (String) passwordCallback.getObject();
View Full Code Here

    final CallbackHandler callbackHandler = connectContext.getCallbackHandler();
    if (callbackHandler == null)
      return null;
    final NameCallback usernameCallback = new NameCallback(USERNAME_PREFIX);
    final ObjectCallback passwordCallback = new ObjectCallback();
    callbackHandler.handle(new Callback[] {usernameCallback, passwordCallback});
    username = usernameCallback.getName();
    password = (String) passwordCallback.getObject();
    return new UsernamePasswordCredentials(username, password);
  }
View Full Code Here

    if (callbackHandler == null)
      return;
    final NameCallback usernameCallback = new NameCallback(USERNAME_PREFIX);
    final ObjectCallback passwordCallback = new ObjectCallback();
    // Call callback with username and password callbacks
    callbackHandler.handle(new Callback[] {usernameCallback, passwordCallback});
    username = usernameCallback.getName();
    Object o = passwordCallback.getObject();
    if (!(o instanceof String))
      throw new UnsupportedCallbackException(passwordCallback, Messages.UrlConnectionRetrieveFileTransfer_UnsupportedCallbackException);
    password = (String) passwordCallback.getObject();
View Full Code Here

      Callback[] callbacks = new Callback[2];
      callbacks[0] = new NameCallback("Username");
      callbacks[1] = new ObjectCallback();
      CallbackHandler handler = connectContext.getCallbackHandler();
      if (handler != null) {
        handler.handle(callbacks);
      }
      NameCallback nc = (NameCallback) callbacks[0];
      ObjectCallback cb = (ObjectCallback) callbacks[1];
      return new Credentials(nc.getName(), (String) cb.getObject());
    } catch (Exception e) {
View Full Code Here

      throws IOException, UnsupportedCallbackException {
    final Callback[] callbacks = createAuthorizationCallbacks();
    if (joinContext != null && callbacks != null && callbacks.length > 0) {
      final CallbackHandler handler = joinContext.getCallbackHandler();
      if (handler != null) {
        handler.handle(callbacks);
      }
      if (callbacks[0] instanceof ObjectCallback) {
        final ObjectCallback cb = (ObjectCallback) callbacks[0];
        return cb.getObject();
      }
View Full Code Here

    final CallbackHandler callbackHandler = connectContext.getCallbackHandler();
    if (callbackHandler == null)
      return null;
    final NameCallback usernameCallback = new NameCallback(USERNAME_PREFIX);
    final ObjectCallback passwordCallback = new ObjectCallback();
    callbackHandler.handle(new Callback[] {usernameCallback, passwordCallback});
    username = usernameCallback.getName();
    password = (String) passwordCallback.getObject();
    return new UsernamePasswordCredentials(username, password);
  }
View Full Code Here

    final CallbackHandler callbackHandler = connectContext.getCallbackHandler();
    if (callbackHandler == null)
      return null;
    final NameCallback usernameCallback = new NameCallback(USERNAME_PREFIX);
    final ObjectCallback passwordCallback = new ObjectCallback();
    callbackHandler.handle(new Callback[] {usernameCallback, passwordCallback});
    username = usernameCallback.getName();
    password = (String) passwordCallback.getObject();
    return new UsernamePasswordCredentials(username, password);
  }
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.