× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: RE: HTTP Sign-On API
  • From: Peter Connell <peterc@xxxxxxxxxxxxx>
  • Date: Tue, 8 Aug 2000 11:51:49 +1200

Are you sure you're not trying to reinvent what OS/400 object level
authority already provides.
The CHKOBJ command or the API QSYCUSRA can be used to determine if a user
has the appropriate authority to an object.

-----Original Message-----
From: Scott Klement [mailto:klemscot@klements.com]
Sent: Tuesday, August 08, 2000 10:57 AM
To: RPG400-L@midrange.com
Subject: Re: HTTP Sign-On API




On Mon, 7 Aug 2000, Ted Barry wrote:

> I'm looking for the API to validate users, so I can build the page based
on
> where or not they're authorized to certain programs/functions.  The
> e-RPG book has a good example, but I was wondering if there was a
> system API to handle this.  I guess I'm looking for the API to
authenticate a
> users name and password.  What is the name of it and what are the
> parameters?
> 

I did something similar to this (It wasn't HTTP-related...)  where clients
could connect over the network to my AS/400, and I'd get a userid and
password, and make the program run with the user's authority.

I did it something like this:

1) Accepted connection from client, submitted a new job and used the
      takedescriptor() and givedescriptor() API's to pass the
      socket descriptor to the new job.  You probably don't need to
      do this with an HTTP (CGI-script) type of thing.

2) Get Userid & Password from client

3) Use the QSYGETPH API to validate the userid & password, and to get
        a profile handle for the user.

4) Use the QWTSETP API to set the job to use the user's profile, so that
        authority is now checked for that userid instead of the one 
        whos running the script.

5) Carry out whatever functions the client program was interested in.  
        (I made this configurable, so that my server could be used for
        many different applications that wanted to connect to the AS/400
        with sockets)

Here are the prototypes that I used for the QSYGETPH & QWTSETP APIs:

D ChkUsrPrf       PR                  ExtPgm('QSYGETPH')
D   UsrPrf                      10A   CONST
D   Passwd                      10A   CONST
D   Handle                      12A
D   ErrorCode                   15A   OPTIONS(*NOPASS)

D SetUsrPrf       PR                  ExtPgm('QWTSETP')
D   Handle                      12A  
D   ErrorCode                   15A   OPTIONS(*NOPASS)

(where error code is the typical "QUSEC"-style API error structure)

There isn't too much to calling them, you just have to supply the user id
and password to QSYGETPH, and define a variable to receive the handle.
Then check the error code to make sure that it was a valid userid/password

Then use that returned handle to call the QWTSETP API.

The only complication that I can forsee is that calling these API's
requires you to have *ALLOBJ authority (I believe) since its allowing
you to change "who you are".  I don't know if this will be an issue when
called as a CGI-type-deal.

Hope That Helps.


+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator:
david@midrange.com
+---

This communication is confidential and may be legally privileged.  If it is not 
addressed to you, you are on notice of its status.  Please immediately contact 
us at our cost and destroy it.  Please do not use, disclose, copy, distribute 
or retain any of it without our authority - to do so could be a breach of 
confidence.  Thank you for your co-operation.  Please contact us on (09) 356 
5800 if you need assistance.
+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.