package Ġbr . com . kafka utils . security . user . controller Ċ Ċ import Ġbr . com . kafka utils . http . Default Error Responses Ċ import Ġbr . com . kafka utils . security . user . controller . dto . Update User Password Dto Ċ import Ġbr . com . kafka utils . security . user . controller . dto . User Dto Ċ import Ġbr . com . kafka utils . security . user . service . UserService Ċ import Ġio . mic ronaut . http . annotation . Body Ċ import Ġio . mic ronaut . http . annotation . Controller Ċ import Ġio . mic ronaut . http . annotation . Get Ċ import Ġio . mic ronaut . http . annotation . Put Ċ import Ġio . mic ronaut . security . annotation . Sec ured Ċ import Ġio . mic ronaut . security . rules . Security Rule Ċ import Ġio . mic ronaut . security . utils . Security Service Ċ import Ġreactor . core . publisher . Mono Ċ import Ġjavax . validation . Valid Ċ Ċ @ Controller ("/ current - user ") Ċ @ Sec ured ( Security Rule . IS _ AUTHENT IC ATED ) Ċ open Ġclass ĠCurrent UserController ( ĊĠĠĠ Ġprivate Ġval ĠuserService : ĠUserService , ĊĠĠĠ Ġprivate Ġval Ġuser Mapper : ĠUser Mapper , ĊĠĠĠ Ġprivate Ġval Ġsecurity Service : ĠSecurity Service Ċ ) Ġ{ ĊĊĠĠĠ Ġ@ Get ("/") ĊĠĠĠ Ġ@ Default Error Responses ĊĠĠĠ Ġopen Ġfun Ġget (): ĠMono < User Dto > Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġid Ġ= ĠgetCurrent UserId () ĊĠĠĠĠĠĠĠ Ġreturn ĠuserService . get ( id ). map Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġuser Mapper . to Dto ( it ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Put ("/ password ") ĊĠĠĠ Ġ@ Default Error Responses ĊĠĠĠ Ġopen Ġfun Ġupdate Password ( ĊĠĠĠĠĠĠĠ Ġ@ Valid Ġ@ Body Ġdto : ĠUpdate User Password Dto ĊĠĠĠ Ġ): ĠMono < Void > Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġid Ġ= ĠgetCurrent UserId () ĊĠĠĠĠĠĠĠ Ġreturn ĠuserService . update Password ( id , Ġdto . password ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun ĠgetCurrent UserId (): ĠInt Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġsecurity Service . authentication . get (). attributes [" id "]. toString (). toInt () ĊĠĠĠ Ġ} Ċ } Ċ