Class DefaultConsentService
- Namespace
- Fdyay.IdentityServer.Services
- Assembly
- Fdyay.IdentityServer.AspNetCore.dll
Supports all classes in the .NET class hierarchy and provides low-level services to derived classes. This is the ultimate base class of all .NET classes; it is the root of the type hierarchy.
public sealed class DefaultConsentService : IConsentService
- Inheritance
-
DefaultConsentService
- Implements
- Inherited Members
Constructors
DefaultConsentService(IUserConsentStore, TimeProvider)
Creates the service, as the container resolves it.
public DefaultConsentService(IUserConsentStore store, TimeProvider time)
Parameters
storeIUserConsentStoreWhere remembered consent is kept.
timeTimeProviderThe clock a remembered decision's creation time and expiry are computed from.
Methods
RequiresConsentAsync(string, Client, IEnumerable<ParsedScopeValue>, CancellationToken)
Whether the user must be asked before this request can be answered.
public Task<bool> RequiresConsentAsync(string subjectId, Client client, IEnumerable<ParsedScopeValue> parsedScopes, CancellationToken cancellationToken = default)
Parameters
subjectIdstringThe signed-in user.
clientClientThe client whose request is waiting.
parsedScopesIEnumerable<ParsedScopeValue>The scopes the request asked for, as the scope parser read them — Duende's type, so a parameterized scope can be told from a plain one. Enumerated once and not held, so a caller can hand over the request's own collection rather than copying it.
cancellationTokenCancellationTokenCancels the lookup.
Returns
Remarks
False for a client that does not require consent, or for a request with no scopes. True, without reading the store,
for a client that does not allow consent to be remembered, or for a request with a parameterized scope or
offline_access. Otherwise true unless a remembered consent covers every requested scope.
Exceptions
- ArgumentNullException
clientorparsedScopesis null.
UpdateConsentAsync(string, Client, ConsentResponse, CancellationToken)
Records the user's decision, so far as it is to outlive the request that prompted it.
public Task UpdateConsentAsync(string subjectId, Client client, ConsentResponse consent, CancellationToken cancellationToken = default)
Parameters
subjectIdstringclientClientconsentConsentResponsecancellationTokenCancellationToken
Returns
Remarks
A grant the user chose to remember, for a client that allows it, is stored with the scopes consented and an expiry
of Client.ConsentLifetime seconds (none when it is null). Anything else removes whatever was remembered.
Exceptions
- ArgumentNullException
clientorconsentis null.