Build a CRM on ASP.NET Core Web API
This walkthrough builds a multi-tenant CRM on ASP.NET Core Web API, secured end to end with B5 Secure. By the end you’ll have credential authentication, email verification, and contact management authorized by activity-based, data-aware authorization (ADA).
Step 1 — Install & register
Add the B5 Secure packages for ASP.NET Core Web API and register the framework. Registration wires the security pipeline into the request lifecycle so every request is verified by default.
// Program.cs
services.AddB5SecurityKit(o => o.UseEntityFramework<AppDb>());
app.UseB5SecurityKit();Step 2 — Credential-based authentication
Authenticate a user with their credentials and issue an identity token. B5 Secure validates the identity, applies IP-firewall and origin checks, and establishes the security context for the request.
Authentication is only the first stage. Even an authenticated identity must still pass MFA, verification, suspension and authorization checks before reaching your code.
Step 3 — Email verification
Mark accounts unverified until they confirm their email. The pipeline blocks protected actions for unverified identities automatically; use VerificationNotRequired to exempt the verification endpoints themselves.
Step 4 — Contact management with ADA
Protect your CRUD operations. With ADA, the authenticated identity must possess an explicit permit for this action and be permitted on this record — with almost no application code.
[Protect]
[Permission("contact.update")]
[AuthEntity(typeof(Contact))]
[HttpPut]
public OpResult Update(UpdateContact req) { ... }Step 5 — Interaction recording
Add a child entity (interactions logged against a contact) and extend ADA to it. This reinforces least privilege: a user who can read a contact may not be permitted to record interactions unless granted that permit.
Done! You now have a Never Trust CRM where every request is verified and every action and record is authorized. Explore authentication schemes to add HMAC for API clients.
Talk to a human.
Get architecture guidance, Test Mode access, integration review, or help choosing the right B5 identity and authorization pattern.