Global User Exit Example

The following is an example of the XWBAUTH user exit program.

      $SET DIALECT(MF) SOURCEFORMAT(VARIABLE)
       identification division.

       author.     Micro Focus, Ltd.
                   Newbury, Berkshire
                   United Kingdom

                         ALL RIGHTS RESERVED.

      ***--------------------------------------------------------------*
      ***  XWBAUTH exit for WEB-SEND/WEB-CONVERSE needs
      ***  to be compiled without CICS
      ***--------------------------------------------------------------*

       environment division.
       special-names.
       data division.
       working-storage section.
       78  78-max-host-sz              value 116.
       78  78-cwi-user-pw-max-len      value 256.
       78  78-cwi-realm-max-len        value 56.

       *> Values for User Exits XWBOPEN, XWBSNDO, XWBAUTH return codes
       78  78-UERCNORM                 value 0.  *>INITIALISATION SUCCESSFUL
       78  78-UERCBARR                 value 4.  *>REMOTE HOST NAME IS BARRED
       78  78-UERCBYP                  value 4.  *>BYPASS (NO ACTION)
       78  78-UERCPROX                 value 8.  *>PROXY INFORMATION PROVIDED
       78  78-UERCERR                  value 12. *>ERROR OCCURRED IN EXIT PROCESSING
       01 WS-WORK-AREAS.
           05 AUTHREQ                  pic x(8) value 'auth.req'.
           05 AUTHREQL                 pic x(4) comp-x value 8.
           05 AUTHBYP                  pic x(8) value 'auth.byp'.
           05 AUTHBYPL                 pic x(4) comp-x value 8.
           05 AUTHERR                  pic x(8) value 'auth.err'.
           05 AUTHERRL                 pic x(4) comp-x value 8.
           05 RETSYSAD                 pic x(12) value 'SSL/SSLTESTS'.
           05 RETSYSADL                pic x(4) comp-x value 12.
           05 WRITEOPER                pic x(22) 
		                               value '/cics/services/xwbauth'.

       linkage section.
        01 uxi-user-exit-interface.
           02 uxi-operational-flags-ptr         pointer.
           02 uxi-scheduling-flags-ptr          pointer.
           02 uxi-global-area-ptr               pointer.
           02 uxi-global-area-length            pic x(4) comp-5.
           02 uxi-local-area-ptr                pointer.
           02 uxi-local-area-length             pic x(4) comp-5.
           02 uxi-dfheiblk-ptr                  pointer.
           02 uxi-unit-of-recovery-ptr          pointer.

      ***--------------------------------------------------------------*
      ***  Exit specific parameters                                    *
      ***--------------------------------------------------------------*

           02 uxi-exit-specific-ptrs.         *> XZCAT In/Ot XEin/ot FSHRO  XWB????
            03 uxi-resource-ptr      pointer. *> TCTTE TCTTE Arg lst Buffer
            03 uxi-resource-data-ptr pointer. *> TIOA  TIOA  UserID  UserID
            03 uxi-res-data-len-ptr  pointer. *>  *     *
            03 uxi-aux-1-ptr         pointer. *> 62TPN       program F-Name ParmList
            03 uxi-aux-1-length-ptr  pointer. *>  *                  *
            03 uxi-aux-2-ptr         pointer. *> Tran        Sys EIB Keys
            03 uxi-aux-2-length-ptr  pointer. *>
            03 uxi-aux-3-ptr         pointer. *> TEUA  TEUA
            03 uxi-aux-3-length-ptr  pointer. *>  *     *
            03 uxi-aux-4-ptr         pointer. *> ComA  ComA
            03 uxi-aux-4-length-ptr  pointer. *>  *     *
            03                       pointer. *>

      ***--------------------------------------------------------------*
      ***  System parameters                                           *
      ***--------------------------------------------------------------*

           02 uxi-PCA-ptr                       pointer.
           02 uxi-CSA-ptr                       pointer.
           02 uxi-DCA-ptr                       pointer.
           02 uxi-local-trace-table-ptr         pointer.

       01 lk-host-len                  pic x(4) comp-x.
       01 lk-host-name.
          05 lk-host-char              pic x occurs 0 to 78-max-host-sz
                                       depending lk-host-len.
       01 lk-path-len                  pic x(4) comp-x.
       01 lk-path-name                 pic x.

       01 lk-realm-len                 pic x(4) comp-x.
       01 lk-realm-name.
          05 lk-realm-char             pic x occurs 0 to 78-cwi-realm-max-len
                                       depending lk-realm-len.

       01 lk-user-len                  pic x(4) comp-x.
       01 lk-user-name.
          05 lk-user-char              pic x occurs 0 to 78-cwi-user-pw-max-len
                                       depending lk-user-len.

       01 lk-password-len              pic x(4) comp-x.
       01 lk-password-value.
          05 lk-password-char          pic x occurs 0 to 78-cwi-user-pw-max-len
                                       depending lk-password-len.

       01 lk-auth-type                 pic x.
          88 lk-auth-basic-88          value x'01'.

       01 lk-hosttype                  pic x.
          88 lk-url-hostname-88        value x'01'.
          88 lk-url-ipv4-88            value x'02'.
          88 lk-url-ipv6-88            value x'03'.

       01 lk-parm-list.
          05 lk-host-name-ptr          pointer.
          05 lk-host-len-ptr           pointer.
          05 lk-path-name-ptr          pointer.
          05 lk-path-len-ptr           pointer.
          05 lk-realm-name-ptr         pointer.
          05 lk-realm-len-ptr          pointer.
          05 lk-auth-type-ptr          pointer.
          05 lk-user-name-ptr          pointer.
          05 lk-user-len-ptr           pointer.
          05 lk-password-ptr           pointer.
          05 lk-password-len-ptr       pointer.
          05 lk-hosttype-ptr           pointer.


       procedure division using uxi-user-exit-interface.

           set address of lk-parm-list to uxi-aux-1-ptr
           set address of lk-host-name to lk-host-name-ptr
           set address of lk-host-len  to lk-host-len-ptr
           set address of lk-path-name to lk-path-name-ptr
           set address of lk-path-len  to lk-path-len-ptr
           set address of lk-realm-name
                                       to lk-realm-name-ptr
           set address of lk-realm-len to lk-realm-len-ptr
           set address of lk-auth-type to lk-auth-type-ptr
           set address of lk-user-name to lk-user-name-ptr
           set address of lk-user-len  to lk-user-len-ptr
           set address of lk-password-value
                                       to lk-password-ptr
           set address of lk-password-len
                                       to lk-password-len-ptr
           set address of lk-hosttype  to lk-hosttype-ptr

           move 78-UERCBYP             to return-code
           if lk-auth-basic-88
               evaluate lk-path-name(1:lk-path-len)
                   when WRITEOPER
      ***              *> Write console message
				       call 'WRITEOPR'
                       move 'XWBUSER'  to lk-user-name
                       move 7          to lk-user-len
                       move 'TESTPWD'   to lk-password-value
                       move 6          to lk-password-len					   
                       move 78-UERCNORM 
					                   to return-code								   
                   when AUTHREQ
                       move 'TESTUSER'  to lk-user-name
                       move 7          to lk-user-len
                       move 'TESTPWD'   to lk-password-value
                       move 6          to lk-password-len
                       move 78-UERCNORM
                                       to return-code
                   when AUTHBYP
                       move 78-UERCBYP to return-code
                   when AUTHERR
                       move 78-UERCERR to return-code
                   when other
                       move 78-UERCBYP to return-code
               end-evaluate
           end-if
           goback
           .