Produced by Araxis Merge on 10/18/2017 11:37:29 AM Eastern Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | OSCIF_CPRS v32 Phase 2 Build 2OR3.0405_August_2017.zip\OR_30_405V36_SRC.zip\XE8\Broker\Source | RpcSLogin.pas | Wed Oct 11 20:08:07 2017 UTC |
| 2 | OSCIF_CPRS v32 Phase 2 Build 2OR3.0405_August_2017.zip\OR_30_405V36_SRC.zip\XE8\Broker\Source | RpcSLogin.pas | Tue Oct 17 19:56:53 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 780 |
| Changed | 1 | 2 |
| Inserted | 0 | 0 |
| Removed | 0 | 0 |
| Whitespace | |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
| 1 | { ******** ********** ********** ********** ********** ********** **** | |
| 2 | Pa ckage: XWB - Kernel RPCBroker | |
| 3 | Da te Created : Sept 18, 1997 (Ver sion 1.1) | |
| 4 | Si te Name: O akland, OI Field Off ice, Dept of Veteran Affairs | |
| 5 | De velopers: PII , PI I
|
|
| 6 | De scription: Contains TRPCBroker and relat ed compone nts. | |
| 7 | Unit: Rp cSLogin Si lent Login functiona lity. | |
| 8 | Cu rrent Rele ase: Versi on 1.1 Pat ch 65 | |
| 9 | ********** ********** ********** ********** ********** ********** *** } | |
| 10 | ||
| 11 | { ******** ********** ********** ********** ********** ** | |
| 12 | Changes in v1.1.65 (HGW 11/1 7/2016) XW B*1.1*65 | |
| 13 | 1. Added new Silen t Login mo de for Ide ntity and Access Man agement (I AM) | |
| 14 | Singl e Sign-On (lmSSOi). | |
| 15 | 2. In fu nction Sil entLogin, ASOSKIP (P aram[1]) i s set to 1 to disabl e | |
| 16 | Clien t Agent (C lAgent.exe ) callback (deprecat ed). | |
| 17 | 3. Comme nted out ( but did no t yet remo ve) login mode lmNTT oken, as i t | |
| 18 | was n ot fully i mplemented . | |
| 19 | ||
| 20 | Changes in v1.1.60 (HGW 12/1 8/2013) XW B*1.1*60 | |
| 21 | 1. None. | |
| 22 | ||
| 23 | Changes in v1.1.50 (JLI 09/0 1/2011) XW B*1.1*50 | |
| 24 | 1. Updat es to supp ort SSH. | |
| 25 | ********** ********** ********** ********** ********** } | |
| 26 | unit RpcSL ogin; | |
| 27 | ||
| 28 | interface | |
| 29 | ||
| 30 | {$I IISBas e.inc} | |
| 31 | ||
| 32 | uses | |
| 33 | {System} | |
| 34 | SysUtils , Classes, IniFiles, Registry, AnsiStrin gs, | |
| 35 | {WinApi} | |
| 36 | Messages , WinProcs , | |
| 37 | {VA} | |
| 38 | Trpcb, | |
| 39 | {Vcl} | |
| 40 | Dialogs; | |
| 41 | ||
| 42 | function S ilentLogIn (SLBroker: TRPCBroke r): boolea n; | |
| 43 | procedure GetUserInf o(Connecte dBroker: T RPCBroker) ; | |
| 44 | procedure GetSession Info(Conne ctedBroker : TRPCBrok er); | |
| 45 | procedure StartProgS Login(cons t ProgLine : String; ConnectedB roker: TRP CBroker; W indowType: Integer = SW_SHOWNO RMAL); | |
| 46 | function C heckCmdLin e(SLBroker : TRPCBrok er): Boole an; | |
| 47 | ||
| 48 | implementa tion | |
| 49 | ||
| 50 | uses | |
| 51 | {VA} | |
| 52 | Wsockc, Loginfrm, RpcbErr, S elDiv, XWB Hash; | |
| 53 | ||
| 54 | {--------- ---------- ----- Vali dAVCodes - ---------- ---------- ------ | |
| 55 | Authen ticate use r with Acc ess/Verify Codes or ASO token using | |
| 56 | an RPC call to ' XUS AV COD E' | |
| 57 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 58 | function V alidAVCode s(SLBroker : TRPCBrok er): boole an; | |
| 59 | begin | |
| 60 | Result : = False; | |
| 61 | try | |
| 62 | with S LBroker do | |
| 63 | begin | |
| 64 | Para m[0].Value := Encryp t(LogIn.Ac cessCode + ';' + Log In.VerifyC ode); | |
| 65 | Para m[0].PType := litera l; | |
| 66 | Remo teProcedur e := 'XUS AV CODE'; | |
| 67 | Call ; | |
| 68 | if R esults[0] > '0' then | |
| 69 | begi n | |
| 70 | Lo gin.DUZ := Results[0 ]; | |
| 71 | Lo gin.Prompt Division : = True; | |
| 72 | Re sult := Tr ue; | |
| 73 | end | |
| 74 | else | |
| 75 | begi n | |
| 76 | Re sult := Fa lse; | |
| 77 | if Results[2 ] = '1' th en Login.E rrorText : = 'Expired Verify Co de' //vcod e needs ch anging; | |
| 78 | el se if Resu lts[0] = ' 0' then Lo gin.ErrorT ext :='Inv alid Acces s/Verify C odes' //no valid DUZ returned; | |
| 79 | el se Login.E rrorText : = Results[ 3]; | |
| 80 | end; | |
| 81 | end; | |
| 82 | except | |
| 83 | raise | |
| 84 | end; | |
| 85 | end; //fun ction Vali dAVCodes | |
| 86 | ||
| 87 | ||
| 88 | {--------- ---------- ----- Vali dAppHandle --------- ---------- ------ | |
| 89 | Authen ticate use r with App lication H andle (CCO W Token) | |
| 90 | using an RPC cal l to 'XUS AV CODE' | |
| 91 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 92 | function V alidAppHan dle(SLBrok er: TRPCBr oker): boo lean; | |
| 93 | begin | |
| 94 | Result : = False; | |
| 95 | try | |
| 96 | with S LBroker do | |
| 97 | begin | |
| 98 | Para m[0].Value := SLBrok er.Login.L ogInHandle ; | |
| 99 | Para m[0].PType := litera l; | |
| 100 | Remo teProcedur e := 'XUS AV CODE'; | |
| 101 | Call ; | |
| 102 | if P os(Copy(SL Broker.Res ults[0],1, 1),'123456 789') > 0 then | |
| 103 | begi n | |
| 104 | Lo gin.DUZ := Results[0 ]; | |
| 105 | Lo gin.Prompt Division : = False; | |
| 106 | Re sult := Tr ue; | |
| 107 | end | |
| 108 | else if Result s[2] = '1' then Logi n.ErrorTex t := 'Expi red Verify Code' //v code needs changing; | |
| 109 | else if Result s[0] = '0' then Logi n.ErrorTex t :='Inval id Access/ Verify Cod es' //no v alid DUZ r eturned; | |
| 110 | else Login.Err orText := Results[3] ; | |
| 111 | end; | |
| 112 | except | |
| 113 | raise | |
| 114 | end; | |
| 115 | end; //fun ction Vali dAppHandle | |
| 116 | ||
| 117 | ||
| 118 | {--------- ---------- ----- Vali dNTToken - ---------- ---------- ------ | |
| 119 | Authen ticate use r with NT Kerberos t oken (not implemente d) | |
| 120 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 121 | //function ValidNTTo ken(SLBrok er: TRPCBr oker): boo lean; | |
| 122 | //begin | |
| 123 | // Result := False; | |
| 124 | //end; //f unction Va lidNTToken | |
| 125 | ||
| 126 | ||
| 127 | {--------- ---------- ----- Vali dSSOiToken --------- ---------- ------ | |
| 128 | Authen ticate use r with STS SAML Toke n from IAM using | |
| 129 | an RPC call to ' XUS ESSO V ALIDATE' | |
| 130 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 131 | function V alidSSOiTo ken(SLBrok er: TRPCBr oker): boo lean; | |
| 132 | var | |
| 133 | I,iStart ,iEnd: int eger; | |
| 134 | uToken: String; | |
| 135 | iTokenLe ngth: Inte ger; | |
| 136 | begin | |
| 137 | Result : = False; | |
| 138 | try | |
| 139 | with S LBroker do | |
| 140 | begin | |
| 141 | uTok en := Logi n.LogInHan dle; | |
| 142 | iTok enLength : = Length(u Token); | |
| 143 | Remo teProcedur e := 'XUS ESSO VALID ATE'; | |
| 144 | Para m[0].PType := global ; | |
| 145 | with Param[0] do | |
| 146 | begi n | |
| 147 | I :=0; | |
| 148 | iE nd := 0; | |
| 149 | wh ile (iEnd < iTokenLe ngth) do | |
| 150 | be gin | |
| 151 | //Build Pa ram[0] glo bal, 200 c hars per n ode | |
| 152 | iStart := (I * 200) + 1; | |
| 153 | iEnd := iS tart + 199 ; | |
| 154 | Mult[IntTo Str(I)] := AnsiStrin gs.AnsiMid Str(uToken , iStart, 200); | |
| 155 | I := I + 1 ; | |
| 156 | en d; | |
| 157 | end; | |
| 158 | Call ; | |
| 159 | if R esults[0] > '0' then | |
| 160 | begi n | |
| 161 | Lo gin.DUZ := Results[0 ]; | |
| 162 | Lo gin.Prompt Division : = True; | |
| 163 | Re sult := Tr ue; | |
| 164 | end | |
| 165 | else | |
| 166 | begi n | |
| 167 | Re sult := Fa lse; | |
| 168 | if Results[2 ] = '1' th en Login.E rrorText : = 'Expired Verify Co de' //vcod e needs ch anging; | |
| 169 | el se if Resu lts[0] = ' 0' then Lo gin.ErrorT ext :='Inv alid 2-Fac tor Authen tication' //no valid DUZ retur ned; | |
| 170 | el se Login.E rrorText : = Results[ 3]; | |
| 171 | end; | |
| 172 | end; | |
| 173 | except | |
| 174 | raise | |
| 175 | end; | |
| 176 | end; //fun ction Vali dSSOiToken | |
| 177 | ||
| 178 | ||
| 179 | {--------- ---------- ----- Sile ntLogIn -- ---------- ---------- --- | |
| 180 | Authen ticate use r with cre dentials p assed as p arameters. | |
| 181 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 182 | function S ilentLogIn (SLBroker: TRPCBroke r): boolea n; | |
| 183 | begin | |
| 184 | Result : = False; | |
| 185 | //determ ine if sig non is nee ded | |
| 186 | try | |
| 187 | with S LBroker do begin | |
| 188 | Remo teProcedur e := 'XUS SIGNON SET UP'; | |
| 189 | Para m[0].Value := ''; //No Ap pHandle fo r silent l ogin | |
| 190 | Para m[0].PType := litera l; | |
| 191 | Para m[1].Value := '1'; //Disab le Client Agent call back | |
| 192 | Para m[1].PType := litera l; | |
| 193 | Call ; | |
| 194 | SLBr oker.Login .IsProduct ionAccount := False; | |
| 195 | SLBr oker.Login .DomainNam e := ''; | |
| 196 | if S LBroker.Re sults.Coun t > 7 then | |
| 197 | begi n | |
| 198 | SL Broker.Log in.DomainN ame := SLB roker.Resu lts[6]; | |
| 199 | if SLBroker. Results[7] = '1' the n | |
| 200 | SLBroker.L ogin.IsPro ductionAcc ount := Tr ue; | |
| 201 | end; | |
| 202 | if R esults.Cou nt > 5 the n //Ser ver sent a uto signon info. | |
| 203 | if SLBroker. Results[5] = '1' the n //User already l ogged in | |
| 204 | be gin | |
| 205 | Result := True; | |
| 206 | GetUserInf o(SLBroker ); | |
| 207 | exit; | |
| 208 | en d; | |
| 209 | if L ogin.Mode = lmSSOi t hen // STS SAML t oken authe ntication | |
| 210 | if ValidSSOi Token(SLBr oker) then Result := True; | |
| 211 | if L ogin.Mode = lmAVCode s then // Access & V erify code s authenti cation | |
| 212 | if ValidAVCo des(SLBrok er) then R esult := T rue; | |
| 213 | if L ogin.Mode = lmAppHan dle then | |
| 214 | if ValidAppH andle(SLBr oker)then Result := True; | |
| 215 | if R esult and (SLBroker. Contextor = nil) and not (Logi n.Mode = l mSSOi) the n | |
| 216 | begi n | |
| 217 | // determine if user is multidivi sional - m akes calls to Seldiv . | |
| 218 | Lo gIn.MultiD ivision := MultDiv(S LBroker); | |
| 219 | if not LogIn .MultiDivi sion then | |
| 220 | begin | |
| 221 | Result : = True; | |
| 222 | exit; | |
| 223 | end; | |
| 224 | if LogIn.Pro mptDivisio n then | |
| 225 | Result := SelectDivi sion(LogIn .DivList, SLBroker) | |
| 226 | el se if Logi n.Division <> '' the n | |
| 227 | Result := SetDiv(Log in.Divisio n, SLBroke r) | |
| 228 | el se | |
| 229 | be gin | |
| 230 | Result := False; | |
| 231 | Login.Erro rText := ' No Divisio n Selected '; | |
| 232 | en d; | |
| 233 | if not Resul t then | |
| 234 | exit; | |
| 235 | end; | |
| 236 | end; | |
| 237 | except | |
| 238 | exit; | |
| 239 | end; | |
| 240 | end; //fun ction Sile ntLogIn | |
| 241 | ||
| 242 | ||
| 243 | {--------- ---------- ----- GetU serInfo -- ---------- ---------- --- | |
| 244 | Get in formation for TVista User class (Tobject) using | |
| 245 | RPC 'X US GET USE R INFO' | |
| 246 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 247 | procedure GetUserInf o(Connecte dBroker: T RPCBroker) ; | |
| 248 | begin | |
| 249 | with Con nectedBrok er do | |
| 250 | begin | |
| 251 | try | |
| 252 | Remo teProcedur e := 'XUS GET USER I NFO'; | |
| 253 | Call ; | |
| 254 | if R esults.Cou nt > 0 the n | |
| 255 | wi th Connect edBroker.U ser do | |
| 256 | be gin | |
| 257 | DU Z := Resul ts[0]; | |
| 258 | Na me := Resu lts[1]; | |
| 259 | St andardName := Result s[2]; | |
| 260 | Di vision := Results[3] ; | |
| 261 | Ti tle := Res ults[4]; | |
| 262 | Se rviceSecti on := Resu lts[5]; | |
| 263 | La nguage := Results[6] ; | |
| 264 | DT ime := Res ults[7]; | |
| 265 | if Results.C ount > 8 t hen | |
| 266 | Vpid := Re sults[8] | |
| 267 | el se | |
| 268 | Vpid := '' ; | |
| 269 | en d; | |
| 270 | except | |
| 271 | end; | |
| 272 | end; | |
| 273 | end; //pro cedure Get UserInfo | |
| 274 | ||
| 275 | ||
| 276 | {--------- ---------- ----- GetS essionInfo --------- ---------- ------ | |
| 277 | Get in formation for TVista Session cl ass (Tobje ct) using | |
| 278 | RPC 'X US GET SES SION INFO' | |
| 279 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 280 | procedure GetSession Info(Conne ctedBroker : TRPCBrok er); | |
| 281 | begin | |
| 282 | with Con nectedBrok er do | |
| 283 | begin | |
| 284 | try | |
| 285 | Remote Procedure := 'XWB GE T SESSION INFO'; | |
| 286 | Call; | |
| 287 | if Res ults.Count > 0 then | |
| 288 | begi n | |
| 289 | {Vis taSession. Create; | |
| 290 | with VistaSess ion do | |
| 291 | be gin | |
| 292 | DU Z := Resul ts[0] | |
| 293 | // other prop erties fol low | |
| 294 | en d;} | |
| 295 | end; | |
| 296 | except | |
| 297 | end; | |
| 298 | end; | |
| 299 | end; //pro cedure Get SessionInf o | |
| 300 | ||
| 301 | ||
| 302 | {--------- ---------- ----- Star tProgSLogi n -------- ---------- ------- | |
| 303 | This p rocedure c an be used to start a second a pplication and pass on the | |
| 304 | comman d line the data whic h would be needed to initiate a silent l ogin | |
| 305 | using a LoginHan dle value. It is as sumed that the comma nd line wo uld be | |
| 306 | read u sing the C heckCmdLin e procedur e or one s imilar to it as the form | |
| 307 | for th e new appl ication wa s loaded. This proc edure can also be us ed to | |
| 308 | start a non-RPCB roker appl ication. I f the valu e for Conn ectedBroke r is nil, | |
| 309 | the ap plication specified in ProgLin e will be started an d any comm and line | |
| 310 | includ ed in Prog Line will be passed to the app lication. | |
| 311 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 312 | procedure StartProgS Login(cons t ProgLine : String; ConnectedB roker: TRP CBroker; W indowType: Integer = SW_SHOWNO RMAL); | |
| 313 | var | |
| 314 | StartupI nfo: TStar tupInfo; | |
| 315 | ProcessI nfo: TProc essInforma tion; | |
| 316 | AppHandl e: String; | |
| 317 | CmndLine : String; | |
| 318 | currHand le1: THand le; | |
| 319 | begin | |
| 320 | currHand le1 := Get CurrentPro cess; | |
| 321 | FillChar (StartupIn fo, SizeOf (TStartupI nfo), 0); | |
| 322 | with Sta rtupInfo d o | |
| 323 | begin | |
| 324 | cb := SizeOf(TSt artupInfo) ; | |
| 325 | dwFlag s := START F_USESHOWW INDOW; | |
| 326 | WShowW indow := W indowType; | |
| 327 | end; | |
| 328 | CmndLine := ProgLi ne; | |
| 329 | if Conne ctedBroker <> nil th en | |
| 330 | begin | |
| 331 | AppHan dle := Get AppHandle( ConnectedB roker); | |
| 332 | CmndLi ne := Cmnd Line + ' s ='+Connect edBroker.S erver + ' p=' | |
| 333 | + Int ToStr(Conn ectedBroke r.Listener Port) + ' h=' | |
| 334 | + App Handle + ' d=' + Con nectedBrok er.User.Di vision; | |
| 335 | end; | |
| 336 | CreatePr ocess(nil, PChar(Cmn dLine), ni l, nil, Fa lse, | |
| 337 | NORM AL_PRIORIT Y_CLASS, n il, nil, S tartupInfo , ProcessI nfo); | |
| 338 | CommandB oxProcessH andle := P rocessInfo .hProcess; | |
| 339 | CommandB oxThreadHa ndle := Pr ocessInfo. hThread; | |
| 340 | SetActiv eWindow(cu rrHandle1) ; | |
| 341 | end; //pro cedure Sta rtProgSLog in | |
| 342 | ||
| 343 | ||
| 344 | {--------- ---------- ----- Chec kCmdLine - ---------- ---------- ----- | |
| 345 | This f unction ca n be used to check w hether the command l ine contai ns | |
| 346 | inform ation on t he broker settings a nd can set up for a S ilent Logi n using | |
| 347 | the Lo ginHandle value pass ed from an other appl ication. T his proced ure | |
| 348 | would normally b e called w ithin the code assoc iated with FormCreat e event. | |
| 349 | It ass umes the S erver, Lis tenerPort, Division, and Login Handle val ues | |
| 350 | (if pr esent) are indicated by s=, p= , d=, and h=, respec tively. T he | |
| 351 | argume nt is a re ference to the TRPCB roker inst ance to be used. | |
| 352 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 353 | function C heckCmdLin e(SLBroker : TRPCBrok er): Boole an; | |
| 354 | var | |
| 355 | j: Intege r; | |
| 356 | begin | |
| 357 | with SLB roker do | |
| 358 | begin | |
| 359 | for j := 1 to Pa ramCount d o // It erate thro ugh possib le command line argu ments | |
| 360 | begin | |
| 361 | if P os('p=',Pa ramStr(j)) > 0 then | |
| 362 | Li stenerPort := StrToI nt(Copy(Pa ramStr(j), | |
| 363 | (Pos( '=',ParamS tr(j))+1), length(Par amStr(j))) ); | |
| 364 | if P os('s=',Pa ramStr(j)) > 0 then | |
| 365 | Se rver := Co py(ParamSt r(j), | |
| 366 | (Pos( '=',ParamS tr(j))+1), length(Par amStr(j))) ; | |
| 367 | if P os('h=',Pa ramStr(j)) > 0 then | |
| 368 | begi n | |
| 369 | Lo gin.LoginH andle := C opy(ParamS tr(j), | |
| 370 | (Pos( '=',ParamS tr(j))+1), length(Par amStr(j))) ; | |
| 371 | if Login.Log inHandle < > '' then | |
| 372 | be gin | |
| 373 | KernelLogi n := False ; | |
| 374 | Login.Mode := lmAppH andle; | |
| 375 | en d; | |
| 376 | end; | |
| 377 | if P os('d=',Pa ramStr(j)) > 0 then | |
| 378 | Lo gin.Divisi on := Copy (ParamStr( j), | |
| 379 | (Pos( '=',ParamS tr(j))+1), length(Par amStr(j))) ; | |
| 380 | end; // for | |
| 381 | if Log in.Mode = lmAppHandl e then | |
| 382 | Conn ected := T rue; // Go ahea d and make the conne ction | |
| 383 | Result := False; | |
| 384 | if Con nected the n | |
| 385 | Resu lt := True ; | |
| 386 | end; // with SL Broker | |
| 387 | end; //fun ction Chec kCmdLine | |
| 388 | ||
| 389 | end. | |
| 390 | ||
| 391 |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.