title: ASP.NET MVC Authorize attribute with a parameter
body: <p>I am beginning to decorate my controller classes with</p>
  
  <p><code>[Authorize(Roles = @"DOMAIN\ADGroup")]</code></p>
  
  <p>What would be the best method to change that explicit string to a parameter that collects the role assignment from a database, thus allowing flexibility in role assignment that an Admin area can sit on top off.</p>
  
  <p>For example say I have three roles, for arguments sake</p>
  
  <ul>
  <li>ReadOnly</li>
  <li>ReadandWrite</li>
  <li>Admin</li>
  </ul>
  
  <p>And I want to map those roles to Multiple AD groups</p>
  
  <p>For example</p>
  
  <ul>
  <li>ReadOnly -->  DOMAIN\Group1,   DOMAIN\Group2,   DOMAIN\Group3 </li>
  <li>ReadandWrite--> DOMAIN\GroupWrite, DOMAIN\GroupManagers</li>
  <li>Admin --> DOMAIN\DomainAdmins</li>
  </ul>
  
  <p>This will be editable, I can modify the mapping from role to any AD group I choose in the Admin area of my application.</p>
  
  <p>How can my Authorize attributes take advantage of this?</p>