The following Robot implementation does the following things when authentication dialog opens:
- It will paste UserName in argument on Username field because control is by default there
 
- Then It will Press Tab
 
- After that it will paste password in password field 
 
- Again it will press TAB
 
- At last it will HIT enter 
 
Solution in JAVA:
//Call this function and provide UserName and password 
public void authenticate(String password,String Uname) throws AWTException, InterruptedException
{
    Thread.sleep(5000);
    Robot rb=new Robot();       
    StringSelection stringSelection = new StringSelection(Uname);
    //Copy Path on Clipboard
    Toolkit.getDefaultToolkit().getSystemClipboard()
    .setContents(stringSelection, null);
    //Paste Clipboard Data
    rb.keyPress(KeyEvent.VK_CONTROL);
    rb.keyPress(KeyEvent.VK_V);
    rb.keyRelease(KeyEvent.VK_V);
    rb.keyRelease(KeyEvent.VK_CONTROL);
    rb.keyPress(KeyEvent.VK_TAB);
    rb.keyRelease(KeyEvent.VK_TAB);
    stringSelection = new StringSelection(password);
    Toolkit.getDefaultToolkit().getSystemClipboard().setContents(stringSelection, null);
    rb.keyPress(KeyEvent.VK_CONTROL);
    rb.keyPress(KeyEvent.VK_V);
    rb.keyRelease(KeyEvent.VK_V);
    rb.keyRelease(KeyEvent.VK_CONTROL);
    rb.keyPress(KeyEvent.VK_TAB);
    rb.keyRelease(KeyEvent.VK_TAB);
    rb.keyPress(KeyEvent.VK_ENTER);
    rb.keyRelease(KeyEvent.VK_ENTER);   
}