package Ġcom . github . vh rom ada . book case . web Ċ Ċ import Ġcom . github . vh rom ada . common . account . Account Configuration Ċ import Ġcom . github . vh rom ada . common . account . service . Account Service Ċ import Ġorg . springframework . beans . factory . annotation . Autowired Ċ import Ġorg . springframework . context . annotation . Configuration Ċ import Ġorg . springframework . context . annotation . Import Ċ import Ġorg . springframework . security . config . annotation . authentication . builders . Authentication Manager Builder Ċ import Ġorg . springframework . security . config . annotation . web . builders . Http Security Ċ import Ġorg . springframework . security . config . annotation . web . configuration . Enable Web Security Ċ import Ġorg . springframework . security . config . annotation . web . configuration . Web Security Configurer Adapter Ċ import Ġorg . springframework . security . crypto . password . Password Encoder Ċ Ċ /** Ċ Ġ* ĠA Ġclass Ġrepresents ĠSpring Ġconfiguration Ġfor Ġsecurity . Ċ Ġ* Ċ Ġ* Ġ@ author ĠV lad im ir ĠH rom ada Ċ Ġ*/ Ċ @ Configuration Ċ @ Enable Web Security Ċ @ Import ( Account Configuration :: class ) Ċ class ĠBook case Security Configuration Ġ: ĠWeb Security Configurer Adapter () Ġ{ ĊĊĠĠĠ Ġ@ Autowired ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġservice : ĠAccount Service ĊĊĠĠĠ Ġ@ Autowired ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġencoder : ĠPassword Encoder ĊĊĠĠĠ Ġoverride Ġfun Ġconfigure ( auth : ĠAuthentication Manager Builder ) Ġ{ ĊĠĠĠĠĠĠĠ Ġauth . user Details Service ( service ). password Encoder ( encoder ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġconfigure ( http : ĠHttp Security ) Ġ{ ĊĠĠĠĠĠĠĠ Ġhttp . authorize Requests () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. ant Matchers ("/ login ", Ġ"/ login / error ", Ġ"/ registration "). permit All () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. ant Matchers ("/ css /** ", Ġ"/ js /** "). permit All () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. ant Matchers ("/ logout "). authenticated () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. ant Matchers ("/ accounts ", Ġ"/ accounts /", Ġ"/ accounts / list ", Ġ"/ accounts /** / roles /** "). has Any Role (" ADMIN ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. any Request (). has Any Role (" ADMIN ", Ġ" USER ") ĊĠĠĠĠĠĠĠ Ġhttp . form Login () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. login Page ("/ login ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. failure Url ("/ login / error ") ĊĠĠĠĠĠĠĠ Ġhttp . exception Handling () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. access Denied Page ("/ access - den ied ") ĊĠĠĠ Ġ} Ċ Ċ } Ċ