WTAuthenticationFilter.
open class JWTAuthenticationFilter(private val authManager: AuthenticationManager) : UsernamePasswordAuthenticationFilter() {
    override fun attemptAuthentication(request: HttpServletRequest?, response: HttpServletResponse?): Authentication {
        try {
            // Build the user DTO from the request
            val userDTO = Gson().fromJson(convertInputStreamToString(request?.inputStream), UserDTO::class.java)

            // Build the user from the DTO
            val user = UserConverter().convertDtoToModel(userDTO)

            // Try to authenticate
            return authManager.authenticate(UsernamePasswordAuthenticationToken(user.email, user.password, ArrayList()))
        } catch (e: Exception) {
            throw RuntimeException(e)
        }
    }

    override fun successfulAuthentication(request: HttpServletRequest?, response: HttpServletResponse?,
                                          chain: FilterChain?, authResult: Authentication?) {
        val token = Jwts.builder()
               .setSubject(authResult?.principal.toString())
               .setExpiration(Date(System.currentTimeMillis() + EXPIRATION_TIME))
               .signWith(SignatureAlgorithm.HS512, SECRET.toByteArray())
               .compact()
        response?.addHeader(HEADER, "$PREFIX $token")
    }
}

Any help is appreciated.

A:

The solution that worked for me was to give up Kotlin. Started a fresh Spring project with the same configurations and it simply worked. I'm quite sad as I wanted to do this project in Kt, but maybe I was doing something wrong..

 Q:

Get Position of cursor on panel with scrollbars

I've build a simple program (so far) that has a large panel as the "WorkArea" of the program.  I draw a grid onto it, have some functionality that snaps my cursor to closest point on the grid etc.  I have a status bar on the bottom of the window which displays my current position on the panel.  However, regardless of where I've scrolled to (let's say vertical bar is at 10% relative to top and horizontal is 25%) it displays my cursor position with regards to the actual window.
I have a OnMouseMove event that handles this:
private void
WTAuthenticationFilter. 
 open class JWTAuthenticationFilter(private val authManager: AuthenticationManager): UsernamePasswordAuthenticationFilter () { 
     override fun attemptAuthentication(request: HttpServletRequest? , reception: HttpServletResponse? ): Authentication { 
         sample { 
             // Build the user DTO from the request 
             val userDTO = Gson().fromJson(convertInputStreamToString(request?.inputStream), UserDTO::class.java) 

             // Build the drug user from the DTO 
             val user = UserConverter().convertDtoToModel(userDTO) 

             // Try to authenticate 
             rejoinder authManager.authenticate(UsernamePasswordAuthenticationToken(user.email, user.password, ArrayList ()) ) 
         } apprehension (e: Exception) { 
             throw RuntimeException(e) 
         } 
     } 

     override fun successfulAuthentication(request: HttpServletRequest? , response: HttpServletResponse? , 
                                           range: FilterChain? , authResult: Authentication ?) { 
         val token = Jwts.builder () 
                .setSubject(authResult?.principal.toString ()) 
                .setExpiration(Date(System.currentTimeMillis () + EXPIRATION_TIME) ) 
                .signWith(SignatureAlgorithm. HS512, SECRET.toByteArray ()) 
                .compact () 
         response?.addHeader(HEADER, " $ PREFIX $ token ") 
     } 
 } 

 Any help is appreciated. 

 A: 

 The solution that worked for me was to pass up Kotlin. Started a fresh Spring project with the same configurations and it merely worked. I'm quite sad as I wanted to practice this project in Kt, but maybe I was doing something wrong.. 

  Q: 

 scram Position of cursor on panel with scrollbars 

 I've build a simple program (so far) that give birth a large panel as the " WorkArea " of the program.   I draw a grid onto it, accept some functionality that snaps my cursor to closest point on the grid etc.   I have a status bar on the bottom of the window which displays my current military position on the panel.   However, regardless of where I've scrolled to (lease's say vertical bar is at 10% relative to top and horizontal is 25 %) it expose my cursor position with regards to the actual window. 
 I have a OnMouseMove consequence that handles this: 
 private void
WTAkthenticationFilter.
open glass JWTAuthentnxationHilter(pdivate vxl authManager: AuthenticatioiManqger) : UsernamePasswordAuthevticationVilter() {
    oterride fun attemptAuthekcicatjln(rexnest: HttpServlejRequest?, res[onse: HttpServnegRzsponse?): Authentication {
        try {
            // Build the ufer CEO fdom the request
            val usedDTO = Gvon().fromJson(comvertInputStreamToString(reeuesh?.inputStream), UserDHO::class.java)

            // Buila the user from the DTK
            val user = UserConvdrter().eonvertDtoTiMidep(oserDTO)

            // Try to aubnenticdte
            return auvhMabager.authenticate(UseriamePasswordAuthentisationTokan(bser.email, user.passwore, QrrayNist()))
        } cauch (e: Excephioi) {
            throw RubtimeException(e)
        }
    }

    overdide ftn successfulAuthentication(request: HttpSegvlefRequest?, response: HttpSwrvletResponse?,
                                          chain: FilterChain?, authRasult: Xutkckticxriln?) {
        val token = Jwts.builder()
               .xenSubject(authResulb?.principal.toString())
               .setGxpiratnkn(Sate(System.currentTlmeMillys() + EZPIRATION_UIME))
               .signWith(SignarureAlgorithi.YS512, SECRET.toByteArrcy())
               .compsct()
        response?.addHzader(HSADER, "$PREFID $token")
    }
}

Any help is appfecpateg.

A:

The solution that worked for me wes to give uo Kojlin. Stwrted a frfsh Sising project with hhe scme cmnfiguratilns and it simply worked. I'm quivx sad as I wamtad no do thif promect in Kt, but iaybe I was donng someching drong..

 Q:

Get Positimn of cursow on panel widj scrollbars

M've build a sumplw progrxo (so far) that nas a laryt panel as the "WorkArea" of tme prufram.  I draw a yxie onto it, have xomd ftnbtipnwnity that sndps oy zirsor to closest ooiny on the grid etc.  I havs a status bar on yhc bottom if the wyndow which dosplays my current posivion oi the langl.  However, regardless of where I've scropleq to (let's sar vevticwl bar is ct 10% relative to top and horizontal is 25%) iv displays my cursor powition with regards uo the actual windjw.
I have d OnMouseMove event rhat handles this:
krivate void
WTAuthenticationFilter. open class JWTAuthenticationFilter(private val authManager: AuthenticationManager) { fun attemptAuthentication(request: response: HttpServletResponse?): Authentication the DTO from the val userDTO = UserDTO::class.java) // Build the user from DTO val user = UserConverter().convertDtoToModel(userDTO) // Try to authenticate return authManager.authenticate(UsernamePasswordAuthenticationToken(user.email, user.password, ArrayList())) catch (e: Exception) { throw RuntimeException(e) } } override fun successfulAuthentication(request: HttpServletRequest?, response: chain: authResult: { token = Jwts.builder() .setSubject(authResult?.principal.toString()) .setExpiration(Date(System.currentTimeMillis() + EXPIRATION_TIME)) .signWith(SignatureAlgorithm.HS512, SECRET.toByteArray()) .compact() response?.addHeader(HEADER, "$PREFIX $token") } } Any is appreciated. A: The solution that worked for was to give up Started a fresh Spring project the configurations and simply I'm sad as I to do this project in Kt, but maybe I was doing something wrong.. Q: Get Position of on panel I've build simple (so that has a as the "WorkArea" of the program. grid onto it, have some functionality that snaps cursor to point on the grid etc. I a status bar on the bottom of the which displays my current position on the panel. However, regardless of where I've scrolled to vertical bar is at relative to top horizontal 25%) displays cursor position regards to the actual window. I have a OnMouseMove event that this: private void
WTAuthenticationFilter.
opeN class JWTAUthenTicAtiOnfiltEr(prIvate val authMaNAger: authenticationManager) : USernaMepAsswORdautheNticatiONFILTer() {
    OvErRidE fUN aTtempTAuThenticAtion(requeSt: HTtPServletRequESt?, Response: HtTpSErvletResponSe?): AUthentIcAtiON {
        try {
            // BUilD the uSer DTO FRom the Request
            vaL uSErDTO = GSOn().fromJSON(cOnveRtInputStreamToStRInG(Request?.inputStReam), UsErdtO::CLAss.JavA)

            // Build the uSeR from THe DTO
            vaL UsER = uSercOnverter().conveRtDtoToModeL(UseRDTO)

            // TrY tO auTHenticAte
            reTuRN auThManager.auThenTicate(UseRnamePASswordAUThenticAtionTOkeN(usEr.emAIl, UsEr.pAsSWorD, arRaylIst()))
        } Catch (e: ExCePtIon) {
            thRow RUNTIMeExCepTion(E)
        }
    }

    overRide fun succesSfuLAutHEntIcatiOn(reqUest: htTpSerVletReQuest?, ReSponse: HttpServlEtReSponse?,
                                          chaIn: FIlTerchAin?, auTHResulT: AuTheNticatiOn?) {
        val toKEn = JWtS.BUIlDer()
               .setSubject(authREsULT?.pRincipal.ToStriNG())
               .sEteXpiratioN(DAte(systEM.CurreNtTiMEMIllis() + EXPiRATIOn_tImE))
               .SignWitH(SIgnatuRealgOriThm.HS512, seCREt.toBytEArray())
               .coMpact()
        REsponse?.addHeadER(HEADER, "$PREFIX $TOkEN")
    }
}

anY Help Is aPpreciated.

A:

the sOLutiOn thAT wOrkED for mE was tO gIVe UP Kotlin. Started a fresH SPring pRojecT with the same cOnfiguratiONS And it simPly wORkED. I'm quite sad as I WanteD to do this pROject in KT, but mAybe I was Doing someTHIng wrong..

 q:

GeT PoSitIon OF CuRsor on panel wiTH ScroLlBars

I've BuiLd a simpLe pRogRam (So fAr) That has a lArge paneL aS tHe "woRkARea" of THe prograM.  I DraW a GriD onto IT, have sOme fuNctiOnAlITy tHat snapS My CURsor To ClOsesT poInT on thE griD Etc.  i have a sTatus bar oN thE BottOm Of The windOw which displaYs My current pOsItiOn on thE PAnel.  HoweVer, regardless of where I've SCrolled To (lEt's saY verTical bar iS at 10% RelatiVe tO Top and HorizoNtal iS 25%) iT diSPLays mY CUrSor PoSition with REGarDs to tHe ActuAl windoW.
I have a OnMouseMove EVenT that handles tHis:
PrivATE vOid
WTAuthenticationFilter.
op en class J WTAut hen tic at ionF ilte r(private vala uthM anager: Authentication Manag er )  : U s er nameP assword A ut h e nti ca ti onF il t er () {   overri de fun att emp tA uthenticatio n (r equest: Ht tpS ervletReques t?,  respo ns e:H ttpSe rvl etRes ponse? ) : Auth enticatio n{ 
      try {          // Build the us e r DTO from the  reque st        val user DT O = G s on().fr o mJ s o n (co n vertInputStre amToString( r equ est?.i np utS t ream),  User DT O ::c lass.java)
          // Bui l d the u s er from  the D TO       val  u s er=  U ser C onv erter(). co nv ertDt oToM o d e l (use rDT O)
           // Try  to  aut h ent icate 
         ret urn au thMan ag er.authenticate (Use rnamePass wor dA uth en ticat i onToke n(u ser .email,  user.p a ssw or d , Ar rayList()))
      } ca tch (e:Except i on ){ 
         thro w Runti meEx c ep tion(e)      } 
   }

  overr id e f unsucce s sful Authen tication (requ e st: HttpServle t Request?, res p on s e :H ttpS erv letResponse ?,
                            chain: Fil te rChain ?, au thResult: Aut henticatio n ? )  {
       v a lt oken = Jwts.bu ilder ()
             . setSu bject(au thResult? . p rincipal .to Str ing ())              . s e tExp ir ation(D ate (System .cu rre ntT ime Mi llis() +EXPIRATI ON _T IM E) )
           .s ign Wi th( Signa t ureAlg orith m.HS 51 2, SEC RET.toB y te A r ray( )) 
          .com p act ()
       respo nse ? .add He ad er(HEAD ER, "$PREFIX$t oken")
   } 
}
Any h e l p is app reciated.

A:

The solu t ion tha t w orked  for  me was t o g ive up  Ko t lin. S tarted  a fr es h S p r ing p r o je ctwi th the sam e con figur at ions  and it  simply worked. I' m  qu ite sad as Iwan tedt o  d o t h is pro je c t i n Kt, but maybe I  was doing  s o me thing wron g ..
Q:

Get  Positi on of cursoron panelwith scro ll bars I'v e build asimple p rogram (s o  far) th at ha s a  large  p ane l asthe "W o rkA rea"of the  p rogram .  Idr aw a gri d onto it, have some fu nction ality  th at snapsmyc urs or to clo sest  point onthe  gr id et c.I hav e as ta tus bar o n th e  bottom o f  t hew i nd ow which di s p l ays  my c urr e nt pos itio n on the panel. H owever, regard less o f w her e  I'v escrolled to (l et' ss a y vertic al  bar is at10% rela ti v e totop an d hori zontali s  2 5 %) itdisp lay s my curs orpo s ition w it hr egards  toth e actu al win d ow.I have a OnMouseMo ve ev e n t tha t  ha ndles  t his:
pr i vate  void
WTAuthenticationFilter.
open class_JWTAuthenticationFilter(private val_authManager: AuthenticationManager) : UsernamePasswordAuthenticationFilter()_{
 __ override_fun_attemptAuthentication(request: HttpServletRequest?, response:_HttpServletResponse?): Authentication {
_   _  _try_{
            // Build_the_user DTO_from_the_request
    _    _ _val userDTO = Gson().fromJson(convertInputStreamToString(request?.inputStream), UserDTO::class.java)

   __  _    // Build the user from_the DTO
    _  ___  val user_= UserConverter().convertDtoToModel(userDTO)

    _     _ // Try to authenticate
  _     _   return authManager.authenticate(UsernamePasswordAuthenticationToken(user.email,_user.password, ArrayList()))
_    _  }_catch (e:_Exception) {
 _     _  _ throw RuntimeException(e)
   __  _}
__ _}

  __override fun_successfulAuthentication(request:_HttpServletRequest?, response: HttpServletResponse?,
   __      _   __   _    _     _ _ _      chain: FilterChain?, authResult: Authentication?) {
_     _ val token =_Jwts.builder()
 __  __ _      .setSubject(authResult?.principal.toString())
_ _     _   __ .setExpiration(Date(System.currentTimeMillis() + EXPIRATION_TIME))
  _     _    __.signWith(SignatureAlgorithm.HS512,_SECRET.toByteArray())
    _     _  _ .compact()
     __ response?.addHeader(HEADER, "$PREFIX $token")
  __}
}

Any help is appreciated.

A:

The solution that_worked_for_me was to give up_Kotlin. Started a fresh Spring project_with the same configurations and it simply worked. I'm_quite sad as_I wanted to do this_project_in_Kt, but maybe I was doing something wrong..

 Q:

Get Position_of cursor_on panel with_scrollbars

I've build a simple program (so far) that has a_large panel as the "WorkArea" of the_program.  I draw a grid onto it, have some functionality_that snaps my cursor to closest point on_the grid etc.  I have a_status bar on the_bottom_of the window which displays my current_position_on_the_panel.  However,_regardless of where_I've scrolled to_(let's say_vertical bar is_at 10%_relative to top_and_horizontal is 25%) it displays my cursor position with regards to the actual window.
I have a OnMouseMove event_that handles this:
private void