Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: XOBSRAKJ

XOBSRAKJ.m

Go to the documentation of this file.
  1. XOBSRAKJ ;kc/oak - VistALink Reauthentication Code, SSO/UC KAAJEE ; 03/02/2004 07:00
  1. ;;1.6;VistALink Security;;May 08, 2009;Build 15
  1. ;Per VHA directive 2004-038, this routine should not be modified.
  1. QUIT
  1. ;
  1. ; ------------------------------------------------------------------------
  1. ; RPC Server: Reauthentication subroutines for SSO/UC KAAJEE
  1. ; ------------------------------------------------------------------------
  1. ;
  1. CCOW(XOBID,XOBERR) ; -- CCOW connection type
  1. NEW XOBOUT,T,HDL
  1. SET XOBID=0
  1. ;
  1. ;get DUZ using Kernel CCOW Token xref
  1. SET HDL=$GET(XOBDATA("XOB RPC","SECURITY","TYPE","CCOW"))
  1. SET HDL=$$DECRYP^XUSRB1(HDL)
  1. ;
  1. IF $EXTRACT(HDL,1,2)'="~2" DO QUIT
  1. . SET XOBERR=182301_U_"CCOW"_U_"[token does not match CCOW handle format.]"
  1. . SET XOBID=0
  1. ;
  1. ; TODO: need IP address, then need to do $$IPLOCKED(IP)?
  1. ;
  1. ; since bypassing CHKCCOW^XUSRB4, need to extract true handle, expiry here
  1. SET HDL=$$UP^XLFSTR($EXTRACT(HDL,3,99)),T=$PIECE($GET(^XTV(8989.3,1,30),5400),U)
  1. ; call Kernel to resolve CCOW handle into user ID
  1. SET XOBOUT=$$CHECK^XUSRB4(HDL,T)
  1. IF (+XOBOUT)<1 DO QUIT
  1. . SET XOBERR=182301_U_"CCOW"_U_"["_$PIECE(XOBOUT,U,2)_"]"
  1. . SET XOBID=0
  1. ;
  1. ; need to get set XOBID=DUZ, save off DUZ(2) and anything else held in the token for XOBSRA
  1. SET XOBID=+XOBOUT
  1. ;
  1. ; Save the division station# into $GET(XOBDATA("XOB RPC","SECURITY","DIV")) -- that
  1. ; is where the XOBSRA division check is looking for it
  1. SET:+DUZ(2) XOBDATA("XOB RPC","SECURITY","DIV")=$$STA^XUAF4(DUZ(2))
  1. ;
  1. IF XOBID<1 DO QUIT
  1. . SET XOBERR=182305_U_"CCOW"
  1. . SET XOBID=0
  1. ;
  1. ; probably can run MORECHKS as is?
  1. ; SET XOBERR=$$MORECHKS(XOBID)
  1. ;
  1. IF XOBERR SET XOBID=0 QUIT
  1. ;
  1. ; TODO: POST(IP)
  1. ;
  1. QUIT
  1. ;
  1. AV(XOBID,XOBERR) ; -- AV connection type
  1. NEW AC,AVCODE,VC,X,XOBCLIP,XOBTYPE
  1. SET XOBID=0
  1. ;
  1. ; -- get DUZ using access and verify codes
  1. SET AVCODE=$GET(XOBDATA("XOB RPC","SECURITY","TYPE","AVCODE"))
  1. ;
  1. SET AVCODE=$$DECRYP^XUSRB1(AVCODE)
  1. SET AC=$PIECE(AVCODE,";",1),VC=$PIECE(AVCODE,";",2),XOBCLIP=$PIECE(AVCODE,";",3)
  1. ;
  1. ; -- convert AC, VC into hashed versions
  1. SET X=AC,AC=$$EN^XUSHSH($$UP^XLFSTR(X))
  1. SET X=VC,VC=$$EN^XUSHSH($$UP^XLFSTR(X))
  1. ;
  1. ; -- check if exceeded multiple signon attempts
  1. SET XOBERR=$$IPLOCKED(XOBCLIP) IF XOBERR SET XOBID=0 QUIT
  1. ;
  1. ; -- look up AC
  1. SET XOBID=+$ORDER(^VA(200,"A",AC,0))
  1. IF XOBID<1 DO QUIT
  1. . SET XOBERR=182305_U_"AV"
  1. . SET XOBID=0
  1. ;
  1. ; -- check VC
  1. IF $PIECE($GET(^VA(200,XOBID,.1)),U,2)'=VC DO QUIT
  1. . SET XOBERR=182305_U_"AV"
  1. . SET XOBID=0
  1. ;
  1. ; -- check user access and whether verify code needs changing
  1. SET XOBERR=$$MORECHKS(XOBID)
  1. IF XOBERR SET XOBID=0 QUIT
  1. ;
  1. ; login succeeded
  1. DO POST(XOBCLIP)
  1. ;
  1. ; NOTE: AV doesn't need to check $$PERSON for AV because our source was file 200, not a separate index
  1. ;
  1. QUIT
  1. ;
  1. MORECHKS(XOBID) ; -- More separate checks
  1. NEW XOBERR
  1. SET XOBERR=0
  1. ;
  1. ; -- check user access
  1. SET XOBERR=$$NOACCESS^XOBSRA(XOBID)
  1. IF XOBERR SET XOBID=0 QUIT XOBERR
  1. ;
  1. ; -- check if verify code needs changing
  1. SET XOBERR=$$VCHG^XOBSRA(XOBID)
  1. IF XOBERR SET XOBID=0 QUIT XOBERR
  1. ;
  1. QUIT XOBERR
  1. ;
  1. IPLOCKED(XOBCLIP) ; -- check if IP address is locked, increment if not
  1. ;
  1. ; Implements the script-inhibiting lock-by-IP-address Kernel function.
  1. ; Does not lock user out for long, but does slow down scripts.
  1. ;
  1. ; Return:
  1. ; 182306^XOBID : if too many invalid login attempts
  1. ; 0 : not too many login attempts
  1. ;
  1. IF $$LKCHECK^XUSTZIP(XOBCLIP) DO QUIT XOBERR
  1. . SET XOBERR="182306^Too many invalid signon attempts."
  1. ;
  1. NEW XOBERR,XUFAC SET XOBERR=0
  1. ;
  1. IF $$FAIL^XUS3(XOBCLIP) SET XOBERR="182306^"_$$RA^XUSTZ(XOBCLIP)
  1. QUIT XOBERR
  1. ;
  1. POST(XOBCLIP) ; post-successful tasks
  1. DO CLRFAC^XUS3(XOBCLIP)
  1. QUIT