title: Is there a good design pattern for checking permissions when running a method?
body: <p>I'm looking for a design pattern or a approach to tidy up my code. This is in the context of security and checking permissions for a given subject.
  Here is a simplified example:</p>
  
  <pre><code>public Pizza bakePizza() throws UnauthorizedException{
  if (subject.isPermitted("BAKE_PIZZA")){
          return new Pizza();
      } else {
          throw new UnauthorizedException();
      }
  }
  </code></pre>
  
  <p>Is there a way to make this a bit more clean because this can get quite messy when I have a lot of different kinds of methods like this.</p>