title: Passing a password for methods for Spring MVC Controller - AOP or Spring Security?
body: <p>I have been using Spring MVC for a short while now with annotated controllers for JSP pages. I have a class similar to this:</p>
  
  <pre><code>import org.springframework.stereotype.Controller;
  import org.springframework.web.bind.annotation.*;
  
  @Controller
  public class AdminController {
  
     @RequestMapping(value = "/doStuff1.htm", method = RequestMethod.POST)
     public void doStuff1(@RequestParam("password")String password) {
  
          // do some stuff
  
     }
  
     @RequestMapping(value = "/doStuff2.htm", method = RequestMethod.POST)    
     public void doStuff2(
         @RequestParam("password")String password,
         @RequestParam("foo")String foo{
  
          // do some stuff
  
     }    
  }   
  </code></pre>
  
  <p>As you can see, every call will have a password param passed in. The password is read from a dialog and passed into every call that is submitted.</p>
  
  <p>I would like to get rid of the password parameter from the method calls to have 'cleaner' code.</p>
  
  <p>I had a quick look at Spring security for this purpose but it seemed a bit heavyweight. Maybe AOP can be used?</p>
  
  <p>Is there an obvious solution I'm missing?</p>
  
  <p>Many thanks,
  - Scott</p>