Page 1 of 2

Retrieve the User Id of the signed in user

Posted: Mon Mar 01, 2010 11:25 am
by JamesMayor
I need to retrieve the User Id of the signed in user into a RPGSP program, does Atrium store these values and if so how would I retrieve them.

Re: Retrieve the User Id of the signed in user

Posted: Mon Mar 01, 2010 7:26 pm
by Hany
There are two different authentication methods in Atrium:

  • - HTTP Basic

  • - Request Parameter


The HTTP Basic method uses the sign on credentials provided by the system’s configured HTTP Apache web server instance. This sign on method is appropriate when the web server has been configured to validate users against IBM i user profiles or a validation list.

If you use the HTTP Basic method, you can retrieve the logged in user ID through this call in your RPGsp program:

Code: Select all

RPGspIn('REMOTE_USER' : 'Env');
The Request Parameter method uses sign-on credentials from DB2 database files and passes them along to the web application as encoded parameters. This sign on method is appropriate for user-defined profiles or when setting up System i profiles for all users is not desirable. We do offer APIs with Atrium that helps in decoding the sign on credentials and validating them against the database files. Let me know if you're interested in this.

Thanks,

Hany

Re: Retrieve the User Id of the signed in user

Posted: Tue Mar 02, 2010 6:06 am
by JamesMayor
I am using IBM i profiles, not sure how to check whether I am using HTTP Basic but I have tried using the RPGspIn('REMOTE_USER' : 'Env'); method but get blanks returned for the User Id. Where in Atrium can I check whether I am using the HTTP Basic method.

Re: Retrieve the User Id of the signed in user

Posted: Tue Mar 02, 2010 10:19 am
by Hany
You can set this option in Atrium's Control Panel under the Navigation Tab. When creating your navigation item. You need to set the "Action type" option to "Web Application", check the "Authenticate" checkbox and then select "HTTP Basic" from the "Authentication method" drop down field.

For more information, you can download our latest Atrium webinar recording here:

http://www.profoundlogic.com/webinars.rpgsp?id=899

Hany

Re: Retrieve the User Id of the signed in user

Posted: Tue Mar 02, 2010 11:09 am
by JamesMayor
I still get blanks returned, does Atrium need to be using HTTPS for this to work and if so where is this configured.

Note: Once the web site is live HTTPS will be used anyway but at the moment I am in a development environment.

Re: Retrieve the User Id of the signed in user

Posted: Mon Mar 21, 2011 4:34 pm
by mbconsul
Was there ever an answer to the last question here? We use the same arrangement and do not need to set up ssl for development. Also we do not want to have to create system profiles for customers and vendors to access their respective portals

Re: Retrieve the User Id of the signed in user

Posted: Mon Mar 21, 2011 4:44 pm
by David
In order to authenticate to the RPGsp pages from Atrium, you'd need to run the pages under the PROFOUNDUI HTTP server.

You can do that by setting up a ScriptAlias directive in your HTTP server configuration to point to your RPGsp pages. There is already a sample ScriptAlias directive in there for RPGsp.

To require sign on with OS/400 profiles for the RPGsp pages, you'd then need to include a section in your configuration like this:

Code: Select all


<Location /rpgsp>                      
    Require valid-user                                                                               
    AuthType Basic                                                                                   
    AuthName "RPGsp"                                                                           
    PasswdFile %%SYSTEM%%                                                                            
    UserID %%CLIENT%%                                                                                
</Location>                                                                                    

After doing that setup, you should be able to run your RPGsp pages through the PROFOUNDUI HTTP server like this:

http://Systemi:8080/rpgsp/mypage.pgm

You'll be prompted to sign on when running the page that way.

You can then setup the item in Atrium using a URL like this:

/rpgsp/mypage.pgm

And then use the HTTP Basic authentication method. The user will not have to sign into the page again when launching through Atrium in this way.

Re: Retrieve the User Id of the signed in user

Posted: Tue Mar 22, 2011 9:47 am
by mbconsul
Where can I find documentation on the parameters that are passed to web programs from Atrium when using DB2 authentication?

Re: Retrieve the User Id of the signed in user

Posted: Tue Mar 22, 2011 10:44 am
by David
There is one parameter that is sent that is called AT_AUTH. This is an encoded parameter that cannot be read directly.

See /COPY member at PROFOUNDUI/QRPGLEINC,PUIATAUTH

This includes prototypes for the API which can decode the parameter. You can call Authenticate() to return the signed in user profile when running in this mode. It will return the user profile. It also has an error parameter that will return an error message or blanks on success.

The IsAuthorized() function will accept a user profile name, an Atrium menu item number and return an *On/*Off flag to indicate whether or not the user is authorized to that menu option.

Note that when calling RPGsp pages, you'll need to ensure that the 'AT_AUTH' URL parameter is maintained. This is passed on the URL when opening the page. From then on, it's up to the page to make this parameter persist between any page reloads. This can be done by reading the parameter with RPGspIn() and putting into a hidden form field, and also by passing along on the URL to any linked pages.

To use these APIs, bind to service program PUIATAUTH.

Please note, that the Authenticate() function and AT_AUTH parameters are not used when dealing with OS/400 profiles.

In that case, you would just use the REMOTE_USER enviornment variable to retrieve the user profile.

Re: Retrieve the User Id of the signed in user

Posted: Tue Mar 22, 2011 3:37 pm
by Rob
The above post is referring to an RPGsp application within Atrium (not a Profound UI application)