package Ġcom . example . spring boot . kotlin . components Ċ Ċ import Ġorg . springframework . security . core . Authentication Exception Ċ import Ġorg . springframework . security . web . authentication . www . Basic Authentication EntryPoint Ċ import Ġorg . springframework . stereotype . Component Ċ import Ġjavax . servlet . http . HttpServletRequest Ċ import Ġjavax . servlet . http . HttpServletResponse ĊĊ Ċ @ Component Ċ class ĠBasic Auth EntryPoint Component : ĠBasic Authentication EntryPoint () Ġ{ ĊĊĠĠĠ Ġoverride Ġfun Ġcomm ence ( request : ĠHttpServletRequest ?, Ġresponse : ĠHttpServletResponse ?, Ġauth Exception : ĠAuthentication Exception ?) Ġ{ ĊĠĠĠĠĠĠĠ Ġresponse ?. apply Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġadd Header (" WW W - Authenticate ", Ġ" Basic Ġrealm =\" $ realm Name \" ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġstatus Ġ= ĠHttpServletResponse . SC _ UN AUTHORIZ ED ĊĠĠĠĠĠĠĠĠĠĠĠ Ġwriter . println (" HTTP ĠStatus Ġ 4 0 1 ") ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġafter Properties Set () Ġ{ ĊĠĠĠĠĠĠĠ Ġrealm Name Ġ= Ġ" Test " ĊĠĠĠĠĠĠĠ Ġsuper . after Properties Set () ĊĠĠĠ Ġ} Ċ } Ċ