BccCode.Privacy.AspNetCore
1.0.0
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package BccCode.Privacy.AspNetCore --version 1.0.0
NuGet\Install-Package BccCode.Privacy.AspNetCore -Version 1.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="BccCode.Privacy.AspNetCore" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="BccCode.Privacy.AspNetCore" Version="1.0.0" />
<PackageReference Include="BccCode.Privacy.AspNetCore" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add BccCode.Privacy.AspNetCore --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: BccCode.Privacy.AspNetCore, 1.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package BccCode.Privacy.AspNetCore@1.0.0
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=BccCode.Privacy.AspNetCore&version=1.0.0
#tool nuget:?package=BccCode.Privacy.AspNetCore&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
BccCode.Privacy.AspNetCore
BCC Privacy for ASP.NET Core, minimal APIs and MVC. Part of the BCC Privacy package family; depends
on BccCode.Privacy only, not on EF Core. Hosting's AddPrivacy
registers it.
builder.Services.AddPrivacyAspNetCore(o => o.OrganisationClaimType = "org"); // a scoped PrivacyContext per request
// ...
app.UseAuthentication();
app.UsePrivacy();
app.MapGet("/members", [PrivacyProcess<MembersRegister>] (AppDbContext db) => db.Members.ToListAsync());
app.MapGroup("/register").WithPrivacyProcess<MembersRegister>(); // a group, or .WithPrivacyProcess<T>() on one endpoint
[PrivacyProcess<MembersRegister>] // MVC: on the controller or the action
public sealed class MembersController : ControllerBase { /* ... */ }
| Behaviour | |
|---|---|
| Organisation | From the signed-in user's org claim (configurable, or a function of the request). None: no personal rows |
| Organisation claim contract | The claim is issued by sign-on (or the application's own authentication) and names one organisation the user may act for; the package trusts its issuer for that. Where users choose an organisation, or the claim may name one the user does not belong to, set o.Authorise = (http, org) => ...: a false answer refuses the request with 403 before the endpoint runs. Single-controller mode (LIB-18) needs no claim |
| Process | From the endpoint: [PrivacyProcess<T>] or .WithPrivacyProcess<T>(). The EF adapter takes the org and the process on first use; an endpoint that sets the PrivacyContext itself (Use(orgs, processId)) first keeps its own |
| An endpoint without a process | Sees no personal rows |
A refusal of the privacy rules (PrivacyViolationException) |
403 application/problem+json with the message, also when EF wraps it |
| A message sent from the request | Carries its org, process and person (with BccCode.Privacy.Wolverine) |
Consent at login and on first need (c10)
builder.Services.AddAuthentication(...).AddOpenIdConnect(...)
.RequestConsentAtLogin<NewsletterProcess>(); // every sign-in asks this consent (a sub-process: its parent's)
await HttpContext.ChallengeAsync(new AuthenticationProperties { RedirectUri = "/" }
.WithPrivacyLogin(org, ["register"], optional: ["newsletter"])); // or name processes on one challenge
The OpenID Connect authorize request then carries processes, optional_processes and org; sign-in asks the consent
and returns. The org is the one passed, else the request's org; a challenge without an org is refused.
| Behaviour | |
|---|---|
| Person | From the claim https://login.bcc.no/claims/personUid (o.PersonClaimType) |
| A person saving their own row under a consent process without that consent | The EF adapter throws PrivacyConsentRequiredException. Staff saving other persons' rows, and reads, are never asked |
| ... on a GET | The middleware challenges the default scheme with the consent request, and returns to the request's URL |
| ... on another method | 403 application/problem+json (RFC 9457), type urn:bcc-privacy:consent-required, with process, org and signIn. The client sends the person to signIn with &returnUrl=<local URL> and retries. signIn (o.ConsentSignInPath, default /privacy/consent) starts sign-in with the consent request; it returns only to a local URL |
| Without a sign-in scheme | 403 consent-required problem without signIn |
Version 0.x. Licence: Apache 2.0. Source: bcc-code/bcc-privacy, libraries/dotnet.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- BccCode.Privacy (>= 1.0.0)
- BccCode.Privacy.Vocabulary (>= 1.0.20)
- Microsoft.AspNetCore.Authentication.OpenIdConnect (>= 10.0.15)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 8.0.1 | 45 | 11/26/2026 |
| 8.0.0 | 43 | 11/26/2026 |
| 7.1.0 | 43 | 11/26/2026 |
| 7.0.0 | 47 | 11/26/2026 |
| 6.0.2 | 48 | 11/26/2026 |
| 6.0.1 | 49 | 11/26/2026 |
| 6.0.0 | 45 | 11/26/2026 |
| 5.0.1 | 46 | 11/26/2026 |
| 5.0.0 | 45 | 11/26/2026 |
| 4.0.0 | 52 | 11/26/2026 |
| 3.0.0 | 46 | 11/26/2026 |
| 2.0.0 | 49 | 11/26/2026 |
| 1.0.0 | 50 | 11/26/2026 |
| 0.30.7 | 47 | 11/26/2026 |
| 0.30.6 | 48 | 11/26/2026 |
| 0.30.5 | 52 | 11/26/2026 |
| 0.30.4 | 42 | 11/26/2026 |
| 0.30.3 | 46 | 11/26/2026 |
| 0.30.2 | 52 | 11/26/2026 |
| 0.30.1 | 53 | 11/25/2026 |
Loading failed