Authenticator

Discussion in 'Java' started by freesoft_2000, Jul 15, 2005.

  1. Hi everyone,

    I really need some advice and guidance on the
    following code

    import javax.swing.*;
    import java.util.*;

    public class PopupAuthenticator
    extends Authenticator {

    public PasswordAuthentication
    getPasswordAuthentication() {
    String username, password;

    String result = JOptionPane.showInputDialog(
    "Enter 'username,password'");

    StringTokenizer st =
    new StringTokenizer(result, ",");
    username = st.nextToken();
    password = st.nextToken();

    return new PasswordAuthentication(
    username, password);
    }
    }

    As you guys see above there is JOptionPane that requests
    both the username and password to access a http website, but i have a
    dilemma about someting about the method getPasswordAuthentication() that
    i am supposed to overide.

    The thing is i am afraid the getPasswordAuthentication() method
    may actually return the value of the of both the username and password
    before the user has even had the chance to type in the correct
    username and password.

    As you guys can see that the gui that i set gets the value of
    the input optionpane and i was hoping that that the function returns after
    the user had pressed "OK" but the thing is i suspect that the function may
    be returning as soon as the option pane is shown thus causing both the
    values of the username and password to be null.

    Am i using the Authenticator class with gui the correct way or
    am i missing something??

    I really hope someone can explain to me in detail on how this
    Authenticator class works and maybe help suggest a possible solution that
    can help me out of my dillema.

    Any help is greatly appreciated

    Thank You

    Yours Sincerely

    Richard West
     
    freesoft_2000, Jul 15, 2005
    #1
    1. Advertising

  2. On Fri, 15 Jul 2005 08:33:45 -0400, freesoft_2000 wrote:

    > I really need some advice and guidance on the
    > following code


    Stop multi-posting and people might atke your questions seriously.

    --
    Andrew Thompson
    physci.org 1point1c.org javasaver.com lensescapes.com athompson.info
    Mr Bender's Wardrobe By ROBOTANY 500
     
    Andrew Thompson, Jul 16, 2005
    #2
    1. Advertising

  3. Hi everyone,


    No one really knows the answer to this??

    Richard West
     
    freesoft_2000, Jul 23, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Elwood P. Dowd
    Replies:
    0
    Views:
    785
    Elwood P. Dowd
    Oct 30, 2003
  2. No Comment

    Authenticator Question

    No Comment, Nov 11, 2004, in forum: Java
    Replies:
    0
    Views:
    458
    No Comment
    Nov 11, 2004
  3. JohnG
    Replies:
    0
    Views:
    762
    JohnG
    May 6, 2005
  4. notHere

    Authenticator mozilla apache

    notHere, Oct 12, 2005, in forum: Java
    Replies:
    2
    Views:
    442
    notHere
    Oct 13, 2005
  5. Marian Schedenig

    Fallback Authenticator

    Marian Schedenig, Dec 3, 2007, in forum: Java
    Replies:
    0
    Views:
    311
    Marian Schedenig
    Dec 3, 2007
Loading...

Share This Page