Hello Patrick, The same thing you are trying to do here is already implemented in the SessionBean class in 5250.
What you should do, I think (and we do it all the time in our ERP systems based on our own Java Workflow framework for iSeries) is setup a cache of authentications for the user. When he first tries to access a system by name, you should get his profile from the cache (userid & password). If its not there, you should popup you own dialog to ask for, try to authencitcate the user by using the following code: String user = dialog.getUserName(); String pwd = dialog.getPassword(); String host = "myhost"; AS400 as400 = new AS400(host); as400.setGuiAvailable(false); // disables all password popping as400.authenticate(user, pwd); cache.put(name, new User(user.pwd); When you need a 5250 connection, create a sessinbean, set its properties and connect. Also set userid and password. Normally the bean allows you to login automatically by keystroke simulation or by embedding the credentials in the datastream (for the last to work your as400 must allow this by setting the system value QRMTSIGN to *VERIFY). The property bean.setSignonEmbedded() controls how the emulator does the auto signon. Hope this helps, Wim. |---------+-------------------------------------------> | | "Patrick Bielen" | | | <[EMAIL PROTECTED]> | | | Sent by: | | | [EMAIL PROTECTED]| | | ceforge.net | | | | | | | | | 13/04/2005 09:06 | | | Please respond to | | | tn5250j-general | | | | |---------+-------------------------------------------> >-------------------------------------------------------------------------------------------------------------------------------| | | | To: <tn5250j-general@lists.sourceforge.net> | | cc: | | Subject: [Tn5250j-general] JTOpen toolkit and passwords | >-------------------------------------------------------------------------------------------------------------------------------| Hi Guys, It's been a long time, let's pump up the channel again :-) I want to discuss the password-issues again. As you all know we have to provide tn5250j or any jython script we create with a valid password over and over again. Since yesterday i finally saw you're able to provide the AS400 class com.ibm.as400.access.AS400 with the next statement to keep the password in cache. AS400.setPasswordCache(1) --> in jython AS400.setPasswordCache(true) --> in java is the statement to let the jtopen toolkit store the password in cache. So if we can change tn5250j somewhat so that when we give username and password for the first time (for example when we provide the data for the first login-session) and then imediately let jtopen open an iSeries connection and also close it right away then we're sure the password is in cache, which means that when we have to open a new connection to the iSeries, that we simply can use the next command to logon without the password dialog popping up... AS400("as400.stafa.nl", System.getProperty("user.name")) On our systems, the user.name of the windows-box is the same as the profile on the iSeries, but for other users it should be possible to store the username in a variable by the first logon-session. In other words, if we should do it that way, and for example create a variable that hold the username (read profilename) then we could just use AS400("as400.stafa.nl", ProfileVar) to open a connection to the iSeries and users are happy cause they do not have to provide that freaking password over and over again. What do you guys think about that The password needs only to be referenced once, when we get the logonscreen for the first time and only then, so there is no need to store the password into a variable like we do for the username, cause the password is stored in the cache we do not need a variable for it and we are save again in the view of security, cause you're not able to obtain the password in any way, except for logging in with jtopen cause it stored that password in cache the very first time. If all this above is not clear, read it over and over again, and just ask if something is unclear. If this all is possible i get new power in mood again, cause i do not have to worry anymore about users providing the password over and over again, and we can focus on extending tn5250j ever further, and programming java, jython and our iSeries becomes fun again. Cause that was the only thing why i always programmed my apps in VB.NET cause CA stored the password in cache also, and you only had to provide it once. So think about it and let me know. Met vriendelijke groeten, Best Regards, Patrick Bielen System-Administrator Stafa Holland BV Microsoft Certified Professional Sun Certified Java Programmer ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_ide95&alloc_id396&op=click _______________________________________________ Tn5250j-general mailing list Tn5250j-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/tn5250j-general