package Ġnetwork . pi ction . tracker . api . config Ċ Ċ import Ġnetwork . pi ction . tracker . common . entities . User Entity Ċ import Ġnetwork . pi ction . tracker . common . repositories . UserRepository Ċ 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 Detail ServiceImpl ( val Ġuser Repository : ĠUser Repository ) Ġ: ĠUser Details Service Ġ{ ĊĊĠĠĠ Ġ@ Throws ( Username NotFoundException :: class ) ĊĠĠĠ Ġoverride Ġfun Ġload User By Username ( user an me : ĠString ) Ġ= ĊĠĠĠĠĠĠĠ Ġuser Repository . findBy Username ( user an me )?. let Ġ{ Ġcreate User ( it ) Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ?: Ġthrow ĠUsername NotFoundException (" Username NotFound Ġ[$ user an me ]") ĊĊĠĠĠ Ġprivate Ġfun Ġcreate User ( user : ĠUser Entity ) Ġ= ĠUser Principal ( user ) Ċ } Ċ