Zongsoft.Security.Captcha
2.4.0
dotnet add package Zongsoft.Security.Captcha --version 2.4.0
NuGet\Install-Package Zongsoft.Security.Captcha -Version 2.4.0
<PackageReference Include="Zongsoft.Security.Captcha" Version="2.4.0" />
<PackageVersion Include="Zongsoft.Security.Captcha" Version="2.4.0" />
<PackageReference Include="Zongsoft.Security.Captcha" />
paket add Zongsoft.Security.Captcha --version 2.4.0
#r "nuget: Zongsoft.Security.Captcha, 2.4.0"
#:package Zongsoft.Security.Captcha@2.4.0
#addin nuget:?package=Zongsoft.Security.Captcha&version=2.4.0
#tool nuget:?package=Zongsoft.Security.Captcha&version=2.4.0
Zongsoft.Security.Captcha Captcha Plugin Library
Overview
Zongsoft.Security.Captcha is a sub-plugin of the security plugin library for the Zongsoft open-source framework. It provides captcha-related functionality.
The built-in Authencode scheme generates a PNG challenge, stores the answer in IDistributedCache, and exchanges a correct answer for a short-lived, one-time confirmation token. It integrates with ICaptcha, the Security Web controller, and the X-Captcha response header.
Installation and Requirements
dotnet add package Zongsoft.Security.Captcha
Deploy Zongsoft.Security.Captcha.plugin; it depends on the main Security plugin. The host must provide IDistributedCache. In a multi-instance deployment the cache must be shared, otherwise a challenge issued by one node cannot be verified by another.
Browser/API Flow
- Request the
Authencodescheme through the Security CAPTCHA endpoint. - Display the returned
image/png; read its challenge token from theX-Captchaheader. - Submit the answer as
token:code(an equals sign is also accepted by the provider). - Receive a confirmation token and pass it to the protected security workflow.
- The final verification consumes the confirmation and original challenge entries.
The challenge expires after 10 minutes and a successful answer creates a confirmation valid for 5 minutes. Confirmation verification removes both cache entries, making the confirmation single-use.
💡
AuthencodeImager.Generate(code, width, height)can generate the image directly, but application flows should normally useICaptchaso caching, formatting, and scheme matching remain consistent.
Security and Accessibility
🚨 A visual CAPTCHA is only one abuse-control signal. Apply endpoint rate limits and monitoring, use TLS, do not log answers or tokens, and do not treat a CAPTCHA as identity proof. Provide an accessible alternative for users who cannot solve an image challenge.
Image rendering uses ImageSharp and its font/drawing packages, with a minimum size of 60 × 20 pixels. Verify that fonts are available and that image dimensions, proxy/header rules, and cache expiry behave consistently in the target environment.
References
Plugin-Based Integration
Compose this feature through the host; a package reference supplies compile-time APIs, while plugin loading also requires deployed manifests and runtime assets. See the complete plugin workflow.
Use a Web host with Security configured and a registered distributed-cache provider. Service discovery exposes Authencode and its formatter; do not register a second challenge implementation with the same scheme inadvertently.
| Runtime artifact | Source of truth |
|---|---|
Zongsoft.Security.Captcha |
Zongsoft.Security.Captcha.plugin |
| File copying and dependencies | Zongsoft.Security.Captcha.deploy |
Add this fragment to an existing host .deploy (retain Main and the host’s other base manifests; do not replace the whole file):
[plugins zongsoft data]
nuget:Zongsoft.Data
[plugins zongsoft security]
nuget:Zongsoft.Security
[plugins zongsoft security captcha]
nuget:Zongsoft.Security.Captcha
Run dotnet deploy against a test deployment as explained in the workflow, with the host's framework, platform, architecture and, where needed, site. Pin compatible versions in real deployments; application dependencies such as databases, caches or commercial runtimes are still separate prerequisites.
Additional artifacts listed by the deployment manifest include Zongsoft.Security.Captcha.plugin. Retain assemblies, dependencies and satellite resource directories as well. Restart the host after deployment, check plugin loading and service/driver registration, then verify the workflow above; copied files alone do not prove that the feature is active.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. 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. |
-
net10.0
- SixLabors.Fonts (>= 2.1.3)
- SixLabors.ImageSharp (>= 3.1.11)
- SixLabors.ImageSharp.Drawing (>= 2.1.7)
- Zongsoft.Core (>= 7.63.0)
- Zongsoft.Web (>= 7.18.0)
-
net8.0
- SixLabors.Fonts (>= 2.1.3)
- SixLabors.ImageSharp (>= 3.1.11)
- SixLabors.ImageSharp.Drawing (>= 2.1.7)
- Zongsoft.Core (>= 7.63.0)
- Zongsoft.Web (>= 7.18.0)
-
net9.0
- SixLabors.Fonts (>= 2.1.3)
- SixLabors.ImageSharp (>= 3.1.11)
- SixLabors.ImageSharp.Drawing (>= 2.1.7)
- Zongsoft.Core (>= 7.63.0)
- Zongsoft.Web (>= 7.18.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.