title: Secure method using annotations
body: <p>I have a page with a form and want to know if it is possible to access it using GET, but only allow logged in users to POST to it.</p>
  
  <p>I know this can be done in security.yml, but am not sure how to do it with annotations. </p>
  
  <pre><code> /**
       * @param Request $request
       * @return Response
       * @Security("has_role('ROLE_USER')")
       * @Method(methods={"POST"})
       */
      public function calculatorAction(Request $request)
      {
  
          $form=$this-&gt;createForm(new CallRequestType(),$callReq=new CallRequest());
  
  
          $form-&gt;handleRequest($request);
  
          if($form-&gt;isValid()){
              //blabla
          }
  
  
          return $this-&gt;render('MyBundle:Pages:calculator.html.twig', array('form' =&gt; $form));
      }
  </code></pre>
  
  <p>This will secure the whole function, but I want to access it, just not POST to it without being logged in. An alternative would be to check if there is a logged in user in the $form->isValid() bracket. But I'm still wondering if it can be done with annotations.</p>