IUserClaimStore<TUser> Interface

Provides an abstraction for a store of claims for a user.

Namespace
Microsoft.AspNetCore.Identity
Assemblies
  • Microsoft.AspNetCore.Identity

Syntax

public interface IUserClaimStore<TUser> : IUserStore<TUser>, IDisposable where TUser : class
interface Microsoft.AspNetCore.Identity.IUserClaimStore<TUser>

Methods

AddClaimsAsync(TUser, System.Collections.Generic.IEnumerable<System.Security.Claims.Claim>, System.Threading.CancellationToken)

Add claims to a user as an asynchronous operation.

Arguments:
  • user (TUser) – The user to add the claim to.
  • claims (System.Collections.Generic.IEnumerable<System.Security.Claims.Claim>) – The collection of System.Security.Claims.Claims to add.
  • cancellationToken (System.Threading.CancellationToken) – The System.Threading.CancellationToken used to propagate notifications that the operation should be canceled.
Return type:

System.Threading.Tasks.Task

Returns:

The task object representing the asynchronous operation.

Task AddClaimsAsync(TUser user, IEnumerable<Claim> claims, CancellationToken cancellationToken)
GetClaimsAsync(TUser, System.Threading.CancellationToken)

Gets a list of System.Security.Claims.Claims to be belonging to the specified <em>user</em> as an asynchronous operation.

Arguments:
  • user (TUser) – The role whose claims to retrieve.
  • cancellationToken (System.Threading.CancellationToken) – The System.Threading.CancellationToken used to propagate notifications that the operation should be canceled.
Return type:

System.Threading.Tasks.Task<System.Collections.Generic.IList<System.Security.Claims.Claim>>

Returns:

A System.Threading.Tasks.Task`1 that represents the result of the asynchronous query, a list of System.Security.Claims.Claims.

Task<IList<Claim>> GetClaimsAsync(TUser user, CancellationToken cancellationToken)
GetUsersForClaimAsync(System.Security.Claims.Claim, System.Threading.CancellationToken)

Returns a list of users who contain the specified System.Security.Claims.Claim.

Arguments:
  • claim (System.Security.Claims.Claim) – The claim to look for.
  • cancellationToken (System.Threading.CancellationToken) – The System.Threading.CancellationToken used to propagate notifications that the operation should be canceled.
Return type:

System.Threading.Tasks.Task<System.Collections.Generic.IList<TUser>>

Returns:

A System.Threading.Tasks.Task`1 that represents the result of the asynchronous query, a list of <em>TUser</em> who contain the specified claim.

Task<IList<TUser>> GetUsersForClaimAsync(Claim claim, CancellationToken cancellationToken)
RemoveClaimsAsync(TUser, System.Collections.Generic.IEnumerable<System.Security.Claims.Claim>, System.Threading.CancellationToken)

Removes the specified <em>claims</em> from the given <em>user</em>.

Arguments:
  • user (TUser) – The user to remove the specified <em>claims</em> from.
  • claims (System.Collections.Generic.IEnumerable<System.Security.Claims.Claim>) – A collection of System.Security.Claims.Claims to remove.
  • cancellationToken (System.Threading.CancellationToken) – The System.Threading.CancellationToken used to propagate notifications that the operation should be canceled.
Return type:

System.Threading.Tasks.Task

Returns:

The task object representing the asynchronous operation.

Task RemoveClaimsAsync(TUser user, IEnumerable<Claim> claims, CancellationToken cancellationToken)
ReplaceClaimAsync(TUser, System.Security.Claims.Claim, System.Security.Claims.Claim, System.Threading.CancellationToken)

Replaces the given <em>claim</em> on the specified <em>user</em> with the <em>newClaim</em>

Arguments:
  • user (TUser) – The user to replace the claim on.
  • claim (System.Security.Claims.Claim) – The claim to replace.
  • newClaim (System.Security.Claims.Claim) – The new claim to replace the existing <em>claim</em> with.
  • cancellationToken (System.Threading.CancellationToken) – The System.Threading.CancellationToken used to propagate notifications that the operation should be canceled.
Return type:

System.Threading.Tasks.Task

Returns:

The task object representing the asynchronous operation.

Task ReplaceClaimAsync(TUser user, Claim claim, Claim newClaim, CancellationToken cancellationToken)