package Ġno . nav . yr k ess k ade . ek st ern . gateway . filter Ċ Ċ import Ġcom . nin jas quad . spring mock k . Mock k Bean Ċ import Ġio . mock k . every Ċ import Ġio . mock k . verify Ċ import Ġno . nav . security . token . support . core . context . Token Validation Context Ċ import Ġno . nav . security . token . support . core . jwt . Jwt Token Ċ import Ġno . nav . yr k ess k ade . ek st ern . gateway . Scope Validator Ċ import Ġno . nav . yr k ess k ade . ek st ern . gateway . apid oc Exchange Ċ import Ġno . nav . yr k ess k ade . ek st ern . gateway . kode ver k Exchange Ċ import Ġno . nav . yr k ess k ade . ek st ern . gateway . sk ade meld ing Exchange Ċ import Ġno . nav . yr k ess k ade . ek st ern . gateway . swagger Exchange Ċ import Ġno . nav . yr k ess k ade . ek st ern . gateway . token x . Token X Client Ċ import Ġorg . junit . jupiter . api . BeforeEach Ċ import Ġorg . junit . jupiter . api . Test Ċ import Ġorg . springframework . beans . factory . annotation . Autowired Ċ Ċ import Ġorg . springframework . boot . test . context . SpringBootTest Ċ import Ġorg . springframework . cloud . gateway . filter . Gateway FilterChain Ċ import Ġorg . springframework . test . context . Active Profiles Ċ import Ġreactor . core . publisher . Mono Ċ Ċ @ Active Profiles (" test ") Ċ @ SpringBootTest Ċ internal Ġclass ĠValidate And Exchange Token Filter Mock Test Ġ{ ĊĊĠĠĠ Ġ@ Mock k Bean ĊĠĠĠ Ġlateinit Ġvar Ġtoken X Client : ĠToken X Client ĊĊĠĠĠ Ġ@ Mock k Bean ĊĠĠĠ Ġlateinit Ġvar Ġvalidation Handler : ĠJwt Token Validation Handler ĊĊĠĠĠ Ġ@ Mock k Bean ĊĠĠĠ Ġlateinit Ġvar Ġscope Validator : ĠScope Validator ĊĊĠĠĠ Ġ@ Mock k Bean ĊĠĠĠ Ġlateinit Ġvar Ġtoken Validation Context : ĠToken Validation Context ĊĊĠĠĠ Ġ@ Autowired ĊĠĠĠ Ġlateinit Ġvar Ġtoken Filter : ĠValidate And Exchange Token Filter ĊĊĠĠĠ Ġval Ġtoken Ġ= ĠJwt Token (" ey J ra W QiOiJ tb 2 Nr LW 9 hd X Ro Mi 1 z ZXJ 2 ZX It a 2 V 5 Iiw id H lw Ijoi S ld UI i wi YW xn Ijoi Ul My N TY if Q . ey J hd W QiOiJ 3 a GF 0 ZX Zl ci IsIm 5 i Zi I 6 M TY 0 OT c 1 Mz Iw N iw ia XN z Ijo ia HR 0 c HM 6 XC 9 cL 2 Z ha 2 V ka W 5 n cy 5 k Z XY t Z 2 Nw Lm 5 ha XM ua W 9 cL 2 Z ha 2 Ui LCJ le HA i Oj E 2 NT Mz NT My MD Ys I ml hd CI 6 M TY 0 OT c 1 Mz Iw Ni wi Y 2 9 uc 3 Vt ZX Ii OiJ 7 XC J hd XR ob 3 J pd H lc Ij pc I ml z bz Y 1 Mj Mt Y WN 0 b 3 Jp ZC 1 1 c Gl z XC Is XC JJ RF wi Ol wi M DE 5 M jo 5 OTE 4 Mj U 4 Mj dc In 0 i LCJ qd G ki Oi Iy MT M 3 NT A 3 OS 1 k MD M 0 LT Qx Zm It Y mF h ZS 1 k OT gy NT g 1 O DB h Z TU if Q . MP AX Mo P 0 a H mm 8 Ob bb m 6 g B q 2 7 c Q aG z ui h Xa J 8 k hav G 0 K 3 h L fn z C 9 b X 6 6 X 6 sd HJ u Ri O 5 n 0 mu 7 fq P ok H 5 ve 4 0 dee FL _ dg kb Vm _ Ri WD lg GZ f QU g 6 Ts T 0 P lf M 4 l Z GS a ib Z 9 D _ d 9 0 ZS 9 ss - 6 B 6 JY D FO ti FI H _ R sb 6 QV Z IR d 2 G ob w M 7 j 5 9 5 x TN x 8 O IJ bcb 7 l 7 QQ Te Q 4 0 s 0 HT W SA u VI 4 jt WG 0 L q A 4 zy Uh X W fm Ng WL FJ USD n 6 WH Jo O a Zc 4 Ok SN l L 0 9 ls f Kh X ub JJ Iw Lo 7 p GU Wu RF ja V TW zd TT 1 AD Mm SE 7 Eq fj Xz rm xq 2 z 3 k 8 k 6 _ at BO Loc Z ra j 0 NI i O 8 z Ux OT Az g X 1 IH Za M _ k BQ ") ĊĠĠĠ Ġval Ġfilter Chain Ġ= ĠGateway FilterChain Ġ{ ĠMono . empty () Ġ} ĊĊĠĠĠ Ġ@ BeforeEach ĊĠĠĠ Ġfun ĠsetUp () Ġ{ ĊĠĠĠĠĠĠĠ Ġevery Ġ{ Ġtoken Validation Context . has Valid Token () Ġ} Ġanswers Ġ{ Ġtrue Ġ} ĊĠĠĠĠĠĠĠ Ġevery Ġ{ Ġtoken Validation Context . get Jwt Token ( any ()) Ġ} Ġanswers Ġ{ Ġtoken Ġ} ĊĠĠĠĠĠĠĠ Ġevery Ġ{ Ġvalidation Handler . get Validated Tokens ( any ()) Ġ} Ġanswers Ġ{ Ġtoken Validation Context Ġ} ĊĠĠĠĠĠĠĠ Ġevery Ġ{ Ġscope Validator . validate Scope ( any (), Ġany ()) Ġ} Ġanswers Ġ{ Ġtrue Ġ} ĊĠĠĠĠĠĠĠ Ġevery Ġ{ Ġtoken X Client . exchange ( any (), Ġany ()) Ġ} Ġanswers Ġ{ Ġtoken . token AsString Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` filter Ġon Ġsk ade meld ing Ġrequest Ġshould Ġperform Ġtoken X `() Ġ{ ĊĠĠĠĠĠĠĠ Ġtoken Filter . filter ( sk ade meld ing Exchange (), Ġfilter Chain ) ĊĠĠĠĠĠĠĠ Ġverify ( exact ly Ġ= Ġ 1 ) Ġ{ Ġtoken X Client . exchange ( any (), Ġany ()) Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` filter Ġon Ġswagger Ġrequest Ġshould Ġperform Ġtoken X `() Ġ{ ĊĠĠĠĠĠĠĠ Ġtoken Filter . filter ( swagger Exchange (), Ġfilter Chain ) ĊĠĠĠĠĠĠĠ Ġverify ( exact ly Ġ= Ġ 1 ) Ġ{ Ġtoken X Client . exchange ( any (), Ġany ()) Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` filter Ġon Ġap id oc Ġrequest Ġshould Ġperform Ġtoken X `() Ġ{ ĊĠĠĠĠĠĠĠ Ġtoken Filter . filter ( apid oc Exchange (), Ġfilter Chain ) ĊĠĠĠĠĠĠĠ Ġverify ( exact ly Ġ= Ġ 1 ) Ġ{ Ġtoken X Client . exchange ( any (), Ġany ()) Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` filter Ġon Ġk ode ver k Ġrequest Ġshould Ġnot Ġperform Ġtoken X `() Ġ{ ĊĠĠĠĠĠĠĠ Ġtoken Filter . filter ( kode ver k Exchange (), Ġfilter Chain ) ĊĠĠĠĠĠĠĠ Ġverify ( exact ly Ġ= Ġ 0 ) Ġ{ Ġtoken X Client . exchange ( any (), Ġany ()) Ġ} ĊĠĠĠ Ġ} Ċ }