package Ġuk . gov . just ice . digital . h mp ps . pr isoner search . security Ċ Ċ import Ġorg . springframework . security . core . Authentication Ċ import Ġorg . springframework . security . core . context . SecurityContext Holder Ċ import Ġorg . springframework . stereotype . Component Ċ import Ġuk . gov . just ice . digital . h mp ps . pr isoner search . config . Auth Aware Authentication Token Ċ Ċ @ Component Ċ class ĠAuthentication Holder Ġ{ ĊĠ Ġval Ġauthentication : ĠAuthentication ĊĠĠĠ Ġget () Ġ= ĠSecurity Context Holder . getContext (). authentication ĊĊĠ Ġfun Ġcurrent Username (): ĠString ? Ġ= ĊĠĠĠ Ġwhen Ġ( authentication ) Ġ{ ĊĠĠĠĠĠ Ġis ĠAuth Aware Authentication Token Ġ-> Ġ( authentication Ġas ĠAuth Aware Authentication Token ). userName ĊĠĠĠĠĠ Ġelse Ġ-> Ġ" anonymous " ĊĠĠĠ Ġ} ĊĊĠ Ġfun Ġcurrent ClientId (): ĠString ? Ġ= ĊĠĠĠ Ġwhen Ġ( authentication ) Ġ{ ĊĠĠĠĠĠ Ġis ĠAuth Aware Authentication Token Ġ-> Ġ( authentication Ġas ĠAuth Aware Authentication Token ). clientId ĊĠĠĠĠĠ Ġelse Ġ-> Ġ" anonymous " ĊĠĠĠ Ġ} Ċ } Ċ