Table of Contents

Interface IConsentService

Namespace
Excalibur.Compliance
Assembly
Excalibur.Compliance.Abstractions.dll

Provides GDPR-compliant consent management capabilities.

public interface IConsentService

Remarks

This service manages the recording, querying, and withdrawal of data subject consent per GDPR Article 7. It maintains a complete audit trail of all consent lifecycle events.

Methods

GetConsentAsync(string, string, CancellationToken)

Gets the current consent status for a data subject and purpose.

Task<ConsentRecord?> GetConsentAsync(string subjectId, string purpose, CancellationToken cancellationToken)

Parameters

subjectId string

The data subject identifier.

purpose string

The processing purpose.

cancellationToken CancellationToken

Cancellation token.

Returns

Task<ConsentRecord>

The consent record, or null if no consent exists.

RecordConsentAsync(ConsentRecord, CancellationToken)

Records a consent grant for a data subject and purpose.

Task RecordConsentAsync(ConsentRecord record, CancellationToken cancellationToken)

Parameters

record ConsentRecord

The consent record to store.

cancellationToken CancellationToken

Cancellation token.

Returns

Task

A task representing the asynchronous operation.

Exceptions

ArgumentNullException

Thrown when record is null.

WithdrawConsentAsync(string, string, CancellationToken)

Withdraws consent for a data subject and purpose.

Task<bool> WithdrawConsentAsync(string subjectId, string purpose, CancellationToken cancellationToken)

Parameters

subjectId string

The data subject identifier.

purpose string

The processing purpose.

cancellationToken CancellationToken

Cancellation token.

Returns

Task<bool>

True if consent was withdrawn; false if no consent existed.