// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Collections.Generic; using System.Security.Claims; using System.Threading; using System.Threading.Tasks; namespace Microsoft.AspNetCore.Identity { /// /// Provides an abstraction for a store of claims for a user. /// /// The type encapsulating a user. public interface IUserClaimStore : IUserStore where TUser : class { /// /// Gets a list of s to be belonging to the specified as an asynchronous operation. /// /// The role whose claims to retrieve. /// The used to propagate notifications that the operation should be canceled. /// /// A that represents the result of the asynchronous query, a list of s. /// Task> GetClaimsAsync(TUser user, CancellationToken cancellationToken); /// /// Add claims to a user as an asynchronous operation. /// /// The user to add the claim to. /// The collection of s to add. /// The used to propagate notifications that the operation should be canceled. /// The task object representing the asynchronous operation. Task AddClaimsAsync(TUser user, IEnumerable claims, CancellationToken cancellationToken); /// /// Replaces the given on the specified with the /// /// The user to replace the claim on. /// The claim to replace. /// The new claim to replace the existing with. /// The used to propagate notifications that the operation should be canceled. /// The task object representing the asynchronous operation. Task ReplaceClaimAsync(TUser user, Claim claim, Claim newClaim, CancellationToken cancellationToken); /// /// Removes the specified from the given . /// /// The user to remove the specified from. /// A collection of s to remove. /// The used to propagate notifications that the operation should be canceled. /// The task object representing the asynchronous operation. Task RemoveClaimsAsync(TUser user, IEnumerable claims, CancellationToken cancellationToken); /// /// Returns a list of users who contain the specified . /// /// The claim to look for. /// The used to propagate notifications that the operation should be canceled. /// /// A that represents the result of the asynchronous query, a list of who /// contain the specified claim. /// Task> GetUsersForClaimAsync(Claim claim, CancellationToken cancellationToken); } }