title: Spring security java config basic authentication filter
body: <p>I am trying to add basic authentication for my APIs where the users will be authenticated based on their credential stored in MongoDB. I want to use java config instead of XML based config. So far what I have learnt is I have to create <code>@Configuration</code> by extending <code>WebSecurityConfigurerAdapter</code> and override <code>configure</code> method. In that I can add a custom filter by <code>addFilterBefore()</code>. </p>
  
  <p>But how can I get a <code>Authentication</code> header information in the filter, how to proceed if the user is authenticated. I have been googling a lot but didn't find any good example that will help a novice like me whose been into spring just for 1 week.</p>
  
  <p>Does any one have a good tutorial or sample that can help me get started with this? Thanks in advance.</p>