当前位置: 首页>>代码示例>>Java>>正文


Java NameCallback.getDefaultName方法代码示例

本文整理汇总了Java中javax.security.auth.callback.NameCallback.getDefaultName方法的典型用法代码示例。如果您正苦于以下问题:Java NameCallback.getDefaultName方法的具体用法?Java NameCallback.getDefaultName怎么用?Java NameCallback.getDefaultName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.security.auth.callback.NameCallback的用法示例。


在下文中一共展示了NameCallback.getDefaultName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: handleNameCallback

import javax.security.auth.callback.NameCallback; //导入方法依赖的package包/类
private void handleNameCallback(NameCallback nc) {
    // check to see if this user is in the user password database.
    if (credentials.get(nc.getDefaultName()) == null) {
        LOG.warn("User '" + nc.getDefaultName() + "' not found in list of DIGEST-MD5 authenticateable users.");
        return;
    }
    nc.setName(nc.getDefaultName());
    userName = nc.getDefaultName();
}
 
开发者ID:maoling,项目名称:fuck_zookeeper,代码行数:10,代码来源:SaslServerCallbackHandler.java

示例2: handleNameCallback

import javax.security.auth.callback.NameCallback; //导入方法依赖的package包/类
private void handleNameCallback(NameCallback nc) {
    // check to see if this user is in the user password database.
    if (credentials.get(nc.getDefaultName()) == null) {
        LOG.warn("User '{}' not found in list of DIGEST-MD5 authenticateable users.",
                nc.getDefaultName());
        return;
    }
    nc.setName(nc.getDefaultName());
    userName = nc.getDefaultName();
}
 
开发者ID:l294265421,项目名称:ZooKeeper,代码行数:11,代码来源:SaslQuorumServerCallbackHandler.java

示例3: handleNameCallback

import javax.security.auth.callback.NameCallback; //导入方法依赖的package包/类
private void handleNameCallback(NameCallback nc) {
    // check to see if this user is in the user password database.
    if (credentials.get(nc.getDefaultName()) == null) {
        LOG.severe("User '" + nc.getDefaultName() + "' not found in list of JAAS DIGEST-MD5 users.");
        return;
    }
    nc.setName(nc.getDefaultName());
    userName = nc.getDefaultName();
}
 
开发者ID:diennea,项目名称:herddb,代码行数:10,代码来源:SaslNettyServer.java

示例4: handleName

import javax.security.auth.callback.NameCallback; //导入方法依赖的package包/类
protected synchronized void handleName(NameCallback c)
{
  Frame ownerFrame = new Frame();
  Dialog dialog = new Dialog(ownerFrame);
  dialog.setTitle(c.getPrompt());
  dialog.setLayout(new GridLayout(3, 1));
  Label label = new Label(c.getPrompt());
  TextField input = new TextField();
  if (c.getDefaultName() != null)
    {
      input.setText(c.getDefaultName());
    }
  Panel buttons = new Panel();
  Button ok = new Button(messages.getString("callback.ok"));
  ok.setActionCommand(ACTION_OK);
  ok.addActionListener(this);
  Button cancel = new Button(messages.getString("callback.cancel"));
  cancel.setActionCommand(ACTION_CANCEL);
  cancel.addActionListener(this);
  dialog.add(label);
  dialog.add(input);
  buttons.setLayout(new FlowLayout(FlowLayout.RIGHT));
  buttons.add(ok);
  buttons.add(cancel);
  dialog.add(buttons);
  dialog.pack();
  dialog.show();
  try { wait(); }
  catch (InterruptedException ie) { }
  if (actionCommand.equals(ACTION_OK))
    {
      c.setName(input.getText());
    }
  dialog.dispose();
  ownerFrame.dispose();
}
 
开发者ID:vilie,项目名称:javify,代码行数:37,代码来源:AWTCallbackHandler.java

示例5: handleName

import javax.security.auth.callback.NameCallback; //导入方法依赖的package包/类
protected void handleName (final NameCallback callback)
  throws IOException
{
  final JDialog dialog = new JDialog ();
  Container content = dialog.getContentPane ();
  content.setLayout (new GridBagLayout ());

  content.add (new JLabel (callback.getPrompt ()),
                           new GridBagConstraints (0, 0, 1, 1, 0, 0,
                                                   GridBagConstraints.NORTHEAST,
                                                   GridBagConstraints.VERTICAL,
                                                   new Insets (10, 10, 15, 5), 0, 0));

  final JTextField name = new JTextField ();
  name.setColumns (20);
  String _name;
  if ((_name = callback.getDefaultName ()) != null)
    name.setText (_name);
  content.add (name, new GridBagConstraints (1, 0, 1, 1, 1, 1,
                                             GridBagConstraints.NORTHWEST,
                                             GridBagConstraints.BOTH,
                                             new Insets (10, 5, 15, 10), 0, 0));

  ActionListener listener = new ActionListener ()
    {
      public void actionPerformed (ActionEvent ae)
      {
        String cmd = ae.getActionCommand ();
        if (cmd.equals ("okay"))
          callback.setName (name.getText ());
        dialog.setVisible (false);
        synchronized (callback)
          {
            callback.notify ();
          }
      }
    };

  JPanel buttons = new JPanel ();
  buttons.setLayout (new FlowLayout (FlowLayout.RIGHT));
  JButton cancel = new JButton (messages.getString ("callback.cancel"));
  JButton okay = new JButton (messages.getString ("callback.ok"));
  cancel.setActionCommand ("cancel");
  cancel.addActionListener (listener);
  buttons.add (cancel);
  okay.setActionCommand ("okay");
  okay.addActionListener (listener);
  buttons.add (okay);
  content.add (buttons, new GridBagConstraints (0, 1, 2, 1, 0, 0,
                                                GridBagConstraints.SOUTHEAST,
                                                GridBagConstraints.NONE,
                                                new Insets (0, 10, 10, 10), 0, 0));

  dialog.setResizable (false);
  dialog.pack ();
  dialog.setVisible (true);
  dialog.getRootPane ().setDefaultButton (okay);
  waitForInput (dialog, callback);
}
 
开发者ID:vilie,项目名称:javify,代码行数:60,代码来源:SwingCallbackHandler.java


注:本文中的javax.security.auth.callback.NameCallback.getDefaultName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。