Topic
4 replies Latest Post - ‏2013-06-03T18:38:51Z by Ortwin
giocot
giocot
155 Posts
ACCEPTED ANSWER

Pinned topic iSeries Login Example/Tutorial

‏2013-05-13T09:50:57Z |

Hi all

i'm looking for an example/tutorial how to create a general Login procedure to access to and iSeries so that all my projects / function can you use it only once when  tha application starts.  Can some suggest me some link / documents.

 

Thanks

 

  • Ortwin
    Ortwin
    204 Posts
    ACCEPTED ANSWER

    Re: iSeries Login Example/Tutorial

    ‏2013-05-13T21:17:18Z  in response to giocot

    Hi,

    Attached is the EGL part we use to authenticate the user.

    This function is called from within an EGL service.

    This EGL service has to contain the jt400.jar (or better the jt400.jar has to be available on the application server)

    Before calling the service from EGL RUI you have to set the user and password to the HTTP header:

    ServiceLib.setHTTPBasicAuthentication(svc, user, password);

     

    Ortwin

    Attachments

    • markevans
      markevans
      2759 Posts
      ACCEPTED ANSWER

      Re: iSeries Login Example/Tutorial

      ‏2013-05-14T17:34:55Z  in response to Ortwin

      Giocot,

       

      If you don't have it already, you may want to look at the book by Joe Pluta entitled Developing Web 2.0 Applications with EGL for IBM i.

      http://www.amazon.com/Developing-Web-2-0-Applications-EGL/dp/1583470891

    • giocot
      giocot
      155 Posts
      ACCEPTED ANSWER

      Re: iSeries Login Example/Tutorial

      ‏2013-06-02T21:47:36Z  in response to Ortwin

      Hi Ortwin

      many thanks for you reply/example; two question:

      1- where can i find  com.ibm.egl.iseriesobjects.java.AS400 and  com.ibm.egl.iseriesobjects.java.User;

      2- is it possbile to have com.mycompany.general.common.libraries.ServiceFunctions;

      many thanks for you help

      Gio

       

      • Ortwin
        Ortwin
        204 Posts
        ACCEPTED ANSWER

        Re: iSeries Login Example/Tutorial

        ‏2013-06-03T18:38:51Z  in response to giocot

        Hi Gio,

        In the following way you create the com.ibm.egl.iseriesobjects.java.AS400 and  com.ibm.egl.iseriesobjects.java.User:

        • Start the wizard to create an EGL Web project
        • In the wizard check 'Show advanced settings'
        • On the next screen check 'Support IBM i objects'

        This will create the file 'Java400ExternalTypes' which includes a number of external types to address java methodes in the jt400.jar. However I do now notice the User external type is not included and the AS400 external type is not implemented. Below is the implementation of both external types. Simply copy - paste the code into the Java400ExternalTypes (override the existing AS400 externalType).

        externalType User type JavaObject {packageName = "com.ibm.as400.access"}    // Constructor Declarations    constructor(system AS400 in, name string in);    // Function Declarations        // Retrieves the number of days until the password will expire.    // Returns:    //    The number of days until the password will expire. Possible values are:    //        * 0 - The password is expired.    //        * 1-7 - The number of days until the password expires.    //        * -1 - The password will not expire in the next 7 days.    function getDaysUntilPasswordExpire() returns(int);        // Returns the number of days (from 1 through 366) the user's password can remain active before it must be changed.    // Returns:    //    The password expiration interval. It can be the following special values:    //        * 0 - The system value QPWDEXPITV is used to determine the user's password expiration interval.    //        * -1 - The user's password does not expire(*NOMAX)    function getPasswordExpirationInterval() returns(int);        // Returns the date the user's password expires.    // Returns:    //    The date the user's password expires.    function getPasswordExpireDate() returns(date);        // Returns the date the user's password was last changed.    // Returns:    //    The date the user's password was last changed.    function getPasswordLastChangedDate() returns(date);        // Indicates whether the user's password is set to expire, requiring the user to change the pasword when signing on.    // Returns:    //    true if the user's password is set to expire; false otherwise.    function isPasswordSetExpire() returns(boolean);endexternalType AS400 type JavaObject {packageName = "com.ibm.as400.access"}    // Constructor Declarations    constructor(systemName string in, userId string in, password string in);    // Function Declarations    // Changes the password on the AS/400.    // Parameters:    //    oldpassword - The old password.    //    newpassword - The new password.    function changePassword(oldPassword string in, newPassword string in);            // Validates the userid and password on the AS400    // Parameters:    //    userID - The user id.    //    password - The password.    function authenticate(userId string in, password string in) returns (boolean);end
        

        The com.mycompany.general.common.libraries.ServiceFunctions is attached and so are the referenced external types.

        Ortwin

         

        Sorry for the poor formatting. This editor is not yet my friend ;-)

        Updated on 2013-06-03T18:51:39Z at 2013-06-03T18:51:39Z by Ortwin