title: How do I remove an existing claim from a ClaimsPrincipal?
body: <p>I am making a developer tool for impersonating <code>Roles</code> for an intranet site to allow developers to quickly act as any <code>Role</code> as needed.  Roles defined are <code>Developer, Team Lead, Team Member, Engineering, Marketing, Guest</code> and a tool on the web page makes a call to a Web Api to add or remove the <code>Claim</code>... well I can add but can't seem to find out where the <code>.RemoveClaim(claim)</code> or <code>.TryRemoveClaim(claim)</code> can be accessed to get this working.  Do I have to create a custom claims manager to get this functionality or am I missing something?</p>
  
  <p>I have been looking at <a href="http://msdn.microsoft.com/en-us/library/system.security.claims.claimsprincipal_methods%28v=vs.110%29.aspx" rel="noreferrer" title="MSDN Reference">System.Security.Claims</a> and almost everything else seems to work very straightforward and there is no reference as to needing extensive work to do what I need.</p>
  
  <p>I am using VS 2013/Web Api2 with .NET 4.5.1.</p>
  
  <p>The website side just uses a simple ajax call to <code>PUT</code> and <code>DELETE</code> functionality till I get this to work the way I want.  From the Controller, my cs code is as:</p>
  
  <pre><code>    public void Put(int id, [FromBody]string role)
      {
          if (FindClaim(role) != null) return;
  
          var user = HttpContext.Current.User as ClaimsPrincipal;
          if (user == null) return;
  
          var claimId = new ClaimsIdentity();
          claimId.AddClaim(new Claim(ClaimTypes.Role, role));
          user.AddIdentity(claimId);
      }
  
      // DELETE api/devroleadjuster/5
      public void Delete(int id, [FromBody]string role)
      {
          var claim = FindClaim(role);
          if (claim == null) return;
  
          var user = HttpContext.Current.User as ClaimsPrincipal;
          if (user == null)  return;
  
          // Why can't I do this????
          user.RemoveClaim(claim);
      }
  
      private Claim FindClaim(string role)
      {
          try
          {
              var user = HttpContext.Current.User as ClaimsPrincipal;
              var claim = (from c in user.Claims
                           where c.Value == role
                           select c).Single();
              return claim;
          }
          catch (InvalidOperationException)
          {
              return null;
          }
      }
  </code></pre>
  
  <p>The <code>Put</code> works just fine, the problem is with the <code>Delete</code> portion of my code... I want to use the <code>user.RemoveClaim(claim);</code> code or something like it... I can't see why I can't according to MSDN, and I can't find any example code for removing a claim.</p>