Zowe
Published in

Zowe

Curious about what Deep interaction with zOS in Zowe looks like?

New Foundation by Ed G

The process

Code

Installation of new service within ZSS

  • The installation procedure within the service itself
  • The call to this procedure within the zss.c
void installCertificateService(HttpServer *server)
{
HttpService *httpService = makeGeneratedService("CertificateService", "/certificate/x509/**");
httpService->authType = SERVICE_AUTH_NATIVE_WITH_SESSION_TOKEN;
httpService->serviceFunction = serveMappingService;
httpService->runInSubtask = TRUE;
httpService->doImpersonation = TRUE;

registerHttpService(server, httpService);
}
  • The authType states what authentication options will be accepted. The SERVICE_AUTH_NATIVE_WITH_SESSION_TOKEN accepts the valid JWT token produced by the API Mediation Layer and as such is used to participate in SSO.
  • The runInSubtask option specifies whether the request processing will be run in a new process.
  • The doImpersonation option specifies whether the process will run under the identity of the ZSS or of the authenticated user, where true means the authenticated user.
  • The serviceFunction specifies the procedure available from the code which will be called. The following line is an example of what such a function might look like.
static int serveMappingService(HttpService *service, HttpResponse *response)
#include "certificateService.h" // On the topinstallCertificateService(server); // As part of the main method at the end of the file.

Reading the code from JSON

HttpRequest *request = response->request;
int contentLength = request->contentLength;
char* requestBody = request->contentBody;

Responding with the result

#include "httpserver.h"
#include "json.h"
#include "http.h"
jsonPrinter *p = respondWithJsonPrinter(response);
setResponseStatus(response, 200, "OK");
setDefaultJSONRESTHeaders(response);
writeHeader(response);

jsonStart(p);
{
jsonAddString(p, "userid", userMapCertificateStructure.useridRacf);
jsonAddInt(p, "returnCode", rc);
jsonAddInt(p, "safReturnCode", userMapCertificateStructure.returnCode);
jsonAddInt(p, "racfReturnCode", userMapCertificateStructure.returnCodeRacf);
jsonAddInt(p, "racfReasonCode", userMapCertificateStructure.reasonCodeRacf);
}
jsonEnd(p);

finishResponse(response);

Build and run

./build/build.sh
cd bin
./zssServer config/server.json

Conclusion

--

--

Zowe is the modern open source interface for the mainframe and z/OS. The Zowe blog has how-to’s, tips & tricks and other helpful insights for mainframe devops. Zowe is a project within the Linux Foundation’s Open Mainframe Project (OMP). Download @ Zowe.org.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Jakub Balhar

I always try to find answers to the complex questions. Now exploring the world of Mainframes in the Broadcom inc.