|
Hi Mark,
I'm generating a new profile token from the user profile in positions 254 to 263 of the status data structure. It would be QTMHHTTP in this case. Any ideas?
But, here's a code snippet... hopefully it'll help you figure it out:
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
* CGI_RunWithUserAuthority(): Run procedure w/User's Authority
*
* The HTTP Server (Powered by Apache) has the capability of
* verifying a user's login w/the iSeries password file and
* generating a profile token. When that configuration is
* set up, this subprocedure can be called to run a subprocedure
* under the authority of the given user.
*
* peFilename = (input) name of file that contains parameter
* format of CGI data to send to callback.
*
* peCallback = (input) Procedure to call back with this info.
*
* Returns *ON if successful, *OFF otherwise.
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
P CGI_RunWithUserAuthority...
P B export
D CGI_RunWithUserAuthority...
D PI 1N
D peCallback * procptr valueD Callback PR extproc(peCallback)
D wwHandle s 12A
D wwB64Token s 64A varying
D wwToken s 32A
D wwErrMsg s 80A varying
D wwErr ds likeds(ErrorCode)
D inz(*likeds)
D wwRC s 1N/free
//
// Check if we received a profile token from the Web server
// and if so, decode the base64.
// if (mygetenv('HTTP_AS_AUTH_PROFILETKN') = *NULL);
SetError(CGI_NOTOKEN: 'No Profile Token Provided.');
return *OFF;
endif; wwB64Token = %str(mygetenv('HTTP_AS_AUTH_PROFILETKN')); base64_decode( %addr(wwB64Token) + 2
: %len(wwB64Token)
: %addr(wwToken)
: %size(wwToken) ); //
// Save the current security settings in wwHandle,
// then switch to run with the authenticated user's
// authority.
// QSYGETPH('*CURRENT': '*NOPWD': wwHandle);
QSYSETPT(wwToken: wwErr); if (wwErr.BytesAvail > 0);
util_compose('QCPFMSG *LIBL'
: wwErr.MsgID
: wwErr.MsgData
: wwErrMsg
: %size(wwErrMsg));
SetError(CGI_BADTKN: wwErrMsg);
QSYRLSPH(wwHandle);
return *OFF;
endif; //
// Get the CGI parms & run the procedure
// wwRC = *ON;
monitor;
Callback();
on-error;
wwRC = *OFF;
SetError(CGI_PRCCRSH: 'Callback procedure crashed.');
endmon; //
// Reset back to the original user profile
// QWTSETP(wwHandle);
QSYRLSPH(wwHandle);
return wwRC; /end-free
P E
if CGI_RunWithUserAuthority(%paddr(DoRealWork)) = *OFF; ErrorMsg = CGI_Error(); // call a subprocedure to send the error msg to // the support staff. endif;
*inlr = *on; // if appropriate
Good Luck
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.