BccCode.Privacy.Hosting 0.5.4

There is a newer version of this package available.
See the version list below for details.
dotnet add package BccCode.Privacy.Hosting --version 0.5.4
                    
NuGet\Install-Package BccCode.Privacy.Hosting -Version 0.5.4
                    
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.Hosting" Version="0.5.4" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="BccCode.Privacy.Hosting" Version="0.5.4" />
                    
Directory.Packages.props
<PackageReference Include="BccCode.Privacy.Hosting" />
                    
Project file
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.Hosting --version 0.5.4
                    
#r "nuget: BccCode.Privacy.Hosting, 0.5.4"
                    
#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.Hosting@0.5.4
                    
#: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.Hosting&version=0.5.4
                    
Install as a Cake Addin
#tool nuget:?package=BccCode.Privacy.Hosting&version=0.5.4
                    
Install as a Cake Tool

BccCode.Privacy.Hosting

One call that installs BCC Privacy in an application, and pushes the application's processes to the Privacy API when it is deployed. Part of the BCC Privacy package family: it brings the core, EntityFrameworkCore, AspNetCore, Wolverine and BccCode.Privacy.Client.

builder.Services.AddDbContext<AppDbContext>(o => o.UseNpgsql(connectionString).UsePrivacy());
builder.Services.AddBccPrivacyClient(PrivacyApiScopes.CatalogueRead, PrivacyApiScopes.ProcessesWrite, PrivacyApiScopes.ItemsWrite);
builder.Services.AddPrivacy<AppDbContext>(o => o.Application = "events");
// ...
app.UseAuthentication();
app.UsePrivacy();
app.MapPrivacyDocument();                    // GET /.well-known/bcc-privacy

Definitions: processes and items

A process declared in code (rules.Process(3, new("registration"))) needs a definition: its purpose, legal basis and texts. Its code in Privacy is {application}-{key}, dots as hyphens: events-registration. Definitions come from any of these, as one JSON contract (the document of PUT /api/processes/{code} and PUT /api/items/{code}):

Source Example
Files: privacy/processes/<code>.md Markdown with YAML frontmatter, as Privacy's admin import reads it (texts per language under ## EN / ### Purpose)
Files: privacy/processes/<code>.json or .yml The same fields as JSON or YAML
Files: privacy/items/<code>.json or .yml name, classification, scopes, names, dataSource
Configuration BccPrivacy:Processes:<code>:..., BccPrivacy:Items:<code>:...
Code o.Process("events-registration", new() { ... }), o.Item(...)

A process names its data items by item code (defined by the application) or by name in Privacy's catalogue; they are resolved to ids when pushed. Set BccPrivacy:DataControllerId for processes that do not name their data controller.

A process may also declare its data subjects and retention, in any of the sources above:

dataSubjects:
  - name: Members              # code from the name when left out: members
    translations:              # in .json, configuration and code: names: { NO: Medlemmer }
      - language: NO
        name: Medlemmer
retention:                     # or: whileThePurposeLasts: true
  period: 5
  unit: years                  # months or years
  from: relationshipEnds       # collection, lastUse, relationshipEnds or other
  # fromText: [{ language: EN, text: after the last event attended }]   only with from: other

They are checked like the other fields: a group without a name, a code used twice, or a retention period without its unit or what it is counted from is a definition problem. They are sent with the process, like its other fields.

Privacy notices

An application may also declare its data controller's privacy notice, in the same sources (privacy/notices/<name>.json or .yml, BccPrivacy:Notices:<name>:..., or o.Notice("<name>", new() { ... })):

name: Privacy policy
url: https://example.org/privacy
names: { NO: Personvernerklæring }        # its name in other languages
urls: { NO: https://example.org/personvern }
# dataControllerId: ...                   # default BccPrivacy:DataControllerId

It is pushed after the processes as the controller's notice, owned by the application. A data controller has one notice: two declared for the same controller is a definition problem. When the controller's notice already belongs to another application or the administrators, it is left alone and a warning is logged.

Ownership

Privacy records the owner of what the application pushes by its AppUID, the app_uid claim of its token, as Core API does. Ask for the AppUID to be added to the client's machine claims in sign-on; a push without it is refused (403). Only the application that created a process, item or notice can change it.

Per environment

The defaults follow the BCC platform environment: BccPlatform:HostingEnvironment (Prod, Dev, Local) when set, otherwise BccPlatform:Environment. ASP.NET Core's environment name does not count.

Dev, Local (or Environment Dev, Emulator) Sandbox, Staging Prod
Definitions checked against the code Yes, logged Yes, logged Yes; a problem stops start-up
Pushed to Privacy at start-up (once per content hash) No Yes Yes; a failure stops start-up

With neither setting, start-up stops and names them, unless BccPrivacy:Push and BccPrivacy:FailOnError are both set. In Prod, a missing setting stops start-up: a process without a definition, a process without a data controller (and no BccPrivacy:DataControllerId), an item the catalogue does not know, or no Privacy client to push with.

Override with BccPrivacy:Push and BccPrivacy:FailOnError. Pushing needs the client registered with the write scopes; Privacy keeps a version per change and ignores an unchanged document.

Version 0.x. Licence: Apache 2.0. Source: bcc-code/bcc-privacy, libraries/dotnet.

Product 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.

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
0.13.3 59 11/19/2026
0.13.2 49 11/19/2026
0.13.1 51 11/19/2026
0.13.0 52 11/19/2026
0.12.0 54 11/19/2026
0.11.0 50 11/19/2026
0.10.0 48 11/18/2026
0.9.2 47 11/18/2026
0.9.1 51 11/18/2026
0.9.0 51 11/18/2026
0.8.1 45 11/18/2026
0.8.0 53 11/18/2026
0.7.0 50 11/18/2026
0.6.2 51 11/18/2026
0.6.1 51 11/18/2026
0.6.0 47 11/18/2026
0.5.7 52 11/18/2026
0.5.6 55 11/18/2026
0.5.5 52 11/18/2026
0.5.4 55 11/17/2026
Loading failed