Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / July 2005

Tip: Looking for answers? Try searching our database.

Authenticator

Thread view: 
freesoft_2000 - 15 Jul 2005 13:33 GMT
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
Andrew Thompson - 16 Jul 2005 00:54 GMT
>                           I really need some advice and guidance on the
> following code

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

Signature

Andrew Thompson
physci.org 1point1c.org javasaver.com lensescapes.com athompson.info
Mr Bender's Wardrobe By ROBOTANY 500

freesoft_2000 - 23 Jul 2005 11:59 GMT
Hi everyone,

             No one really knows the answer to this??

Richard West


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.