package Ġcom . four th wall . movies api . config Ċ Ċ import Ġorg . springframework . beans . factory . annotation . Autowired Ċ import Ġorg . springframework . http . HttpMethod Ċ import Ġorg . springframework . security . config . annotation . method . configuration . Enable Global Method Security Ċ 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 . config . http . Session Creation Policy Ċ import Ġorg . springframework . security . web . authentication . www . Basic Authentication Filter ĊĊ Ċ @ Enable Web Security Ċ @ Enable Global Method Security ( ĊĠĠĠ Ġsec ured Enabled Ġ= Ġtrue , ĊĠĠĠ Ġjsr 2 5 0 Enabled Ġ= Ġtrue , ĊĠĠĠ Ġpre Post Enabled Ġ= Ġtrue Ċ ) Ċ class ĠSecurity Configuration Ġ: ĠWeb Security Configurer Adapter () Ġ{ ĊĊĠĠĠ Ġ@ Autowired ĊĠĠĠ Ġlateinit Ġvar Ġjwt Filter : ĠJwt Filter ĊĊĠĠĠ Ġoverride Ġfun Ġconfigure ( http : ĠHttp Security ) Ġ{ ĊĠĠĠĠĠĠĠ Ġhttp ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. cors (). and (). csrf (). disable () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. add Filter Before ( jwt Filter , ĠBasic Authentication Filter :: class . java ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. authorize Requests () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. ant Matchers ( HttpMethod . POST , Ġ"/ v 1 / user "). permit All () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. ant Matchers ( HttpMethod . POST , Ġ"/ v 1 / auth "). permit All () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. ant Matchers ( HttpMethod . GET , Ġ"/ health "). permit All () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. any Request (). authenticated () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. and () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. session Management () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. session Creation Policy ( Session Creation Policy . STATE LESS ) ĊĠĠĠ Ġ} Ċ Ċ }