package Ġdev . ced rick ring . auth . service Ċ Ċ import Ġdev . ced rick ring . auth . logger For Ċ import Ġdev . ced rick ring . auth . repository . UserRepository Ċ import Ġorg . springframework . beans . factory . annotation . Autowired Ċ import Ġorg . springframework . security . core . user details . User Ċ import Ġorg . springframework . security . core . user details . UserDetails Service Ċ import Ġorg . springframework . security . core . user details . Username NotFoundException Ċ import Ġorg . springframework . stereotype . Service Ċ Ċ @ Service Ċ class ĠUser Details ServiceImpl Ġ: ĠUser Details Service Ġ{ ĊĊĠĠĠ Ġprivate Ġval Ġlog Ġ= Ġlogger For < UserDetails ServiceImpl >() ĊĊĠĠĠ Ġ@ Autowired ĊĠĠĠ Ġlateinit Ġvar Ġuser Repository : ĠUser Repository ĊĊĠĠĠ Ġoverride Ġfun Ġload User By Username ( username : ĠString ): ĠUser Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġfound Users Ġ= Ġuser Repository . find User By Username ( username ) ĊĊĠĠĠĠĠĠĠ Ġif Ġ( found Users . isEmpty ()) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġthrow ĠUsername NotFoundException ( username ) ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġlog . debug (" Found Ġuser Ġfor Ġusername Ġ$ username ") ĊĊĠĠĠĠĠĠĠ Ġval Ġuser Ġ= Ġfound Users [ 0 ] ĊĠĠĠĠĠĠĠ Ġreturn ĠUser ( user . username , Ġuser . password , Ġmutable ListOf ()) ĊĠĠĠ Ġ} Ċ Ċ } Ċ