Re: Passing User ID and Password in Applet

Kenneth Pouncey <[email protected]>
Newsgroups gmane.comp.java.tn5250j.general
Message-ID <[email protected]>
Hello all

First cover samples and then the questions afterwards.

I have basically taken the day off to write some sample programs.  Am thinking
of creating a samples directory and delivering them on the SF download site.

If anybody has any sample code they have written to do some of the stuff that
comes up on the list.  Please share this if you would like and I will package in
the samples as well.

Yes they are in clear text.  There is a specification for encrypting the
password during this negotiation if anybody is interested in implementing it
within the emulator.  Contact me and I will give you a link and the process to
follow for this implementation.  It envolves using DES encryption routines.

Any takers and we can kick this clear text password problem in the rear end once
in for all.

Now as for the sample program I wrote I provide a copy of the description from
the program here.

/**
 * First this is an example program copied from the delivered My5250App.java
 * program written for the tn5250j emulator.
 * 
 * @author Kenneth J. Pouncey
 *
 * You will find two parts interesting for this example:
 *      1) Communicating with a Servlet (PasswordServlet) to obtain user signon
 *            creditials.  These are then loaded into the properties to be
 *            used for connection.
 * 		2) The use of a scanning listener.  See the information for the method
 *         scanned() implemented for the interface ScanListener();
 * 
 * 
 */

If need be the communication with the PasswordServlet servlet could be https://
 but of course if we were serving from an https server we really would not need
this.

This should take care of the first of the requirements unless I mis-understood
the problem with trasmitting the password in clear text to begin with.  I assume
the password problem was being passed as a parameter in the applet html code.  

In both the servlet code and example program you could write a very simple
encryption routine to send the password encrypted.  There is some sample
encryption code in org.tn5250j.tools called DESSHA1 that I use for the Options
Access password encryption.  You could use it in the servlet to encrypt the
password before sending it and then decrypt it when it arrives in the applet.

Also; this implements the scanning listener to do anything you would like when
you receive the command.  I also have an example AS/400 program to test with if
you are interested.  

If you follow the outline that Wim mentions below you could do just about
anything you want including change the flow of the screens for the user.

Pete I will send the code in a few.  If anybody else is interested in this let
me know.

Regards

Kenneth



Quoting [email protected]:

> Hello Pete,
> 
> I'm not quite sure why everybody make a problem about the clear passwords. 
> When you would send them encrypted, the emulator telnets to the AS/400 and 
> what does he do in the first place: send your userid and password to the 
> as/400. I think that these are in clear text also. 
>The only solution would 
> be to SSL or VPN your communication to your webserver and AS/400. 
> 
> Next the autoclosing is fairly easy to implement using the autologin and 
> scanning we have introduced in the emulator: when logging on you want to 
> autostart a command. Lets call this the application command. What you can 
> do is wrap this app command in you own shell command. e.g. start 
> cmd('appcmd'). The start can do a few thing like setting liblists etc. But 
> it's main purpose is to properly shutdown the emulator. You can do this in 
> 2 ways: to a signof with disconnect. At the emulator side, you can attach 
> a sessionlistener and have you applet navigate away from you page as the 
> session gets disconnected. Or the start command can also trigger a scan 
> code to the emulator: #! END so the applet can listen to this and perform 
> an end of session. This way you can do a lot more than just ending. 
> 
> Hope this helps,
> Wim.
> 
> 
> 
> 
> Pete Helgren <[email protected]> 
> Sent by: [email protected]
> 15/06/2005 21:06
> Please respond to
> [email protected]
> 
> 
> To
> TN5250J List <[email protected]>
> cc
> 
> Subject
> [Tn5250j-general] Passing User ID and Password in Applet
> 
> 
> 
> 
> 
> 
> I had posted some of this about two years ago when I first started 
> working with the 5250 applet.  The problems that I had (and still have) 
> have to do with the passing of UserID and password in the clear when I 
> start an applet session.  Gaurav posted some code that has a servlet 
> that talks to the applet and passes the password back to it.  I think I 
> can follow the approach but wanted to know if anyone else had solved 
> this problem in a different way.
> 
> We have an HTML based menuing system that runs on the iSeries (under an 
> Apache web server).  The user logs in via an HTML login prompt and then 
> the menu(s) are generated from there.  Some of the menu items are HTML 
> based but some are 5250 apps and we launch them using tn5250j in an 
> applet.  We generate the HTML that launches the applet on the fly using 
> a template but so far we have had to pass the password in the clear, not 
> a good solution.  So, if you have any ideas that we could use to start 
> the applet without passing the password in the clear, I'd like to hear 
> about it.
> 
> We also have a need to end the application gracefully when the users are 
> done running the 5250 application.  Right now, we display a message that 
> says "Click the Exit link to end the program" and the user has to click 
> the link to end the session.  What I would like to do is have the applet 
> close when the 5250 application has ended automatically.  I am not sure 
> how to accomplish this since the 5250 session would have to "tell" the 
> applet to close....
> 
> I'd appreciate anyone's idea as to how to solve these two issues as 
> simply as possible. 
> 
> Thanks,
> 
> Pete Helgren
> 
> 
> -------------------------------------------------------
> SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
> from IBM. Find simple to follow Roadmaps, straightforward articles,
> informative Webcasts and more! Get everything you need to get up to
> speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
> _______________________________________________
> Tn5250j-general mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/tn5250j-general
> 
> 






-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.