package Ġcom . catch er . base . config . security Ċ Ċ import Ġcom . catch er . base . service . security . App UserDetails Service Ċ import Ġorg . springframework . beans . factory . annotation . Autowired Ċ import Ġorg . springframework . context . annotation . Bean Ċ import Ġorg . springframework . context . annotation . Configuration Ċ import Ġorg . springframework . security . authentication . Authentication Manager Ċ import Ġorg . springframework . security . authentication . dao . Dao Authentication Provider Ċ 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 . bcrypt . BC rypt Password Encoder Ċ import Ġorg . springframework . security . crypto . password . Password Encoder ĊĊ Ċ @ Configuration Ċ @ Enable Web Security Ċ class ĠSecurity Config (@ Autowired Ġval Ġuser Details Service : ĠApp UserDetails Service ) Ġ: ĠWeb Security Configurer Adapter () Ġ{ ĊĊĠĠĠ Ġoverride Ġfun Ġconfigure ( auth : ĠAuthentication Manager Builder ) Ġ{ ĊĠĠĠĠĠĠĠ Ġauth . authentication Provider ( authentication Provider ()) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġconfigure ( http : ĠHttp Security ) Ġ{ ĊĠĠĠĠĠĠĠ Ġhttp . csrf (). disable () ĊĠĠĠĠĠĠĠ Ġhttp . authorize Requests () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. ant Matchers (" /** ", Ġ"/ login ** ", Ġ"/ oauth / error "). permit All () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. any Request (). authenticated () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Bean ĊĠĠĠ Ġoverride Ġfun Ġauthentication Manager Bean (): ĠAuthentication Manager Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġsuper . authentication Manager Bean () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Bean ĊĠĠĠ Ġfun Ġauthentication Provider (): ĠDao Authentication Provider Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġauth Provider Ġ= ĠDao Authentication Provider () ĊĠĠĠĠĠĠĠ Ġauth Provider . setUser Details Service ( user Details Service ) ĊĠĠĠĠĠĠĠ Ġauth Provider . set Password Encoder ( encoder ()) ĊĠĠĠĠĠĠĠ Ġauth Provider . is Force Principal AsString Ġ= Ġtrue ĊĠĠĠĠĠĠĠ Ġreturn Ġauth Provider ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Bean ĊĠĠĠ Ġfun Ġencoder (): ĠPassword Encoder Ġ= ĠBC rypt Password Encoder ( 1 1 ) Ċ }