Interface IPersistedGrantService
- Namespace
- Fdyay.IdentityServer.Services
- Assembly
- Fdyay.IdentityServer.AspNetCore.dll
Reads and revokes a subject's grants, for a caller that names the subject.
public interface IPersistedGrantService
Remarks
The counterpart to IIdentityServerInteractionService's grant members, which read the subject
off the ambient HttpContext. That is right for the account screen they exist for and wrong for
everything else: an administration tool disconnecting an application on a user's behalf, or a background job
revoking what a deactivated user still holds, has a subject id and no request. Until 0.24.0 those callers had
nothing to call — the list came back empty and the revocation did nothing, both silently.
Every method takes the subject, and none of them will accept an empty one: an empty subject on a PersistedGrantFilter matches every row, so the difference between revoking one user's grants and revoking everyone's is one unchecked string.
Methods
GetAllGrantsAsync(string, CancellationToken)
The consent this subject has given, one row per client.
Task<IReadOnlyCollection<Grant>> GetAllGrantsAsync(string subjectId, CancellationToken cancellationToken = default)
Parameters
subjectIdstringcancellationTokenCancellationToken
Returns
RemoveAllGrantsAsync(string, string?, string?, CancellationToken)
Removes this subject's grants, optionally narrowed to one client or one session.
Task RemoveAllGrantsAsync(string subjectId, string? clientId = null, string? sessionId = null, CancellationToken cancellationToken = default)
Parameters
subjectIdstringclientIdstringsessionIdstringcancellationTokenCancellationToken
Returns
Remarks
Every grant type, not only the tokens: withdrawing consent while leaving a refresh token alive would let a client the user has just disconnected keep acting for them until the token expired, which is not what "revoke" means to the person who asked for it.
Narrowing to a session is what makes one method serve both callers. A consent row belongs to a subject and a client and to no session, so a session-scoped removal cannot match one — ending a browser's session takes that session's tokens and leaves the consent standing, which is the difference between signing out and disconnecting.