title: ASP.NET MVC Assign Roles when using custom authentication
body: <p>I am using MongoDB to store users and passwords (instead of sql).  I have my own mechanism for assigning roles to users.  I would like to decorate my controller actions with roles, as follows:</p>
  
  <pre><code>[Authorize(Roles = "Administrators")]
  </code></pre>
  
  <p>My login code looks like this:</p>
  
  <pre><code>if (mongo.AuthenticateUser(model.UserName, model.Password))
  {
      FormsService.SignIn(model.UserName, model.RememberMe);
  }
  </code></pre>
  
  <p>What is the simplest way for me to 'stamp' a users roles onto the user when they first login (the database will provide me with the role names, I just need to set them within the users context).  I guess I'm looking for my code to look something like this:</p>
  
  <pre><code>if (mongo.AuthenticateUser(model.UserName, model.Password))
  {
      if ((mongo.IsAdmin)
      {
          // How do I grant the admin role???
          SomeSortOfUserContext.Add('Administrators');????????
      }
      FormsService.SignIn(model.UserName, model.RememberMe);
  }
  </code></pre>