Skip to content

Add comprehensive documentation and runnable sample applications#19

Merged
jeanlrnt merged 10 commits intomainfrom
copilot/document-minijwt-core-samples
Dec 19, 2025
Merged

Add comprehensive documentation and runnable sample applications#19
jeanlrnt merged 10 commits intomainfrom
copilot/document-minijwt-core-samples

Conversation

Copy link
Contributor

Copilot AI commented Dec 18, 2025

Documentation and Samples Implementation Plan

  • 1. Enable XML documentation generation in MiniJwt.Core.csproj
  • 2. Create docs directory structure
    • docs/getting-started.md
    • docs/configuration.md
    • docs/examples.md
    • docs/faq.md
  • 3. Create samples directory with runnable projects
    • samples/ConsoleMinimal/ (basic token create/validate)
    • samples/ASPNetCoreAuth/ (DI + authentication integration)
    • samples/WorkerService/ (BackgroundService example)
  • 4. Update README.md with links to docs and samples
  • 5. Update CI workflow to build samples
  • 6. Verify all samples build and run correctly
  • 7. Code review and security check

Summary

All requirements have been successfully implemented:

XML Documentation: Enabled in csproj, generates for all target frameworks, included in NuGet package
Documentation: 4 comprehensive markdown files covering getting started, configuration, examples, and FAQ
Samples: 3 runnable sample applications (Console, ASP.NET Core, Worker Service) with READMEs
README Updates: Links to docs and samples, improved structure
CI Workflow: Updated to build all samples
Testing: All 25 existing tests pass, samples build and run successfully
Code Review: All feedback addressed
Security: No vulnerabilities detected by CodeQL

The library remains minimal with no breaking changes to the existing API.

Original prompt

This section details on the original issue you should resolve

<issue_title>Document MiniJwt.Core and add integration samples (docs/ + samples/)</issue_title>
<issue_description>Background / MotivationMiniJwt.Core needs clear, runnable documentation and integration examples so that developers can quickly adopt it in different application types (Console, ASP.NET Core, WorkerService, etc.). The goal is to keep the package minimal and multi‑target compatible while providing easy-to-follow integration patterns.

Goals

• Add user-friendly documentation under docs/ (getting-started, configuration, FAQ).

• Add runnable samples under samples/ for common app types:

• Console (minimal create/validate token)

• ASP.NET Core (DI registration + authentication integration)

• WorkerService / BackgroundService

• Ensure samples build on the supported target frameworks (multi-target).

• Include XML docs in the NuGet package.

• Keep MiniJwt.Core minimal; push optional features into separate extension packages if needed.

Deliverables

• docs/getting-started.md

• docs/configuration.md

• docs/examples.md (links and short explanations)

• docs/faq.md (security best practices: key management, rotation)

• samples/ConsoleMinimal/Program.cs

• samples/ASPNetCoreAuth/ (Program.cs or Startup with AddMiniJwt usage and auth config)

• samples/WorkerService/ (IHostedService example)

• Update README.md to link to docs/ and samples/

• Add a light CI workflow that builds samples and the library across supported TFs

• Add XML doc generation setting and ensure XML file is included in nupkg

Proposed repo structure

• docs/

• getting-started.md

• configuration.md

• examples.md

• faq.md

• samples/

• ConsoleMinimal/

• ASPNetCoreAuth/

• WorkerService/

• src/

• MiniJwt.Core/

• tests/

• MiniJwt.Core.Tests/

• .github/workflows/ci.yml

• README.md

• CHANGELOG.md

Suggested minimal API snippets to include in docs (adjust to current codebase)

  1. Public API surface (recommended)public interface IJwtService{string CreateToken(object claimsOrPayload);ClaimsPrincipal ValidateToken(string token);}

public class JwtOptions{public string Issuer { get; set; }public string Audience { get; set; }public string SigningKey { get; set; } // encourage using IKeyProvider in advanced setupspublic TimeSpan TokenLifetime { get; set; } = TimeSpan.FromHours(1);}

public static class ServiceCollectionExtensions{public static IServiceCollection AddMiniJwt(this IServiceCollection services, Action configure){// register IJwtService and options}}

  1. Minimal Console sample (samples/ConsoleMinimal/Program.cs)var options = new JwtOptions { Issuer = “my”, Audience = “api”, SigningKey = “super-secret”, TokenLifetime = TimeSpan.FromHours(1) };var jwtService = new JwtService(options);var token = jwtService.CreateToken(new { sub = “user1”, role = “admin” });Console.WriteLine(“Token: “ + token);var principal = jwtService.ValidateToken(token);Console.WriteLine(“Principal: “ + principal?.Identity?.Name);

  2. ASP.NET Core integration (Program.cs)builder.Services.AddMiniJwt(opts =>{opts.Issuer = Configuration[“Jwt:Issuer”];opts.Audience = Configuration[“Jwt:Audience”];opts.SigningKey = Configuration[“Jwt:SigningKey”];});builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme).AddJwtBearer(options =>{// configure to use MiniJwt.Core validation or use IJwtService inside an events handler});

Checklist

• Create docs/ files (getting-started, configuration, examples, faq)

• Create samples/ ConsoleMinimal, ASPNetCoreAuth, WorkerService

• Add XML doc comments and enable XML generation in csproj

• Ensure src project is multi-targeted (e.g., netstandard2.0;net6.0;net8.0) or appropriate TFs

• Add tests project with basic create/validate tests and multi-target test matrix

• Add GitHub Actions workflow to build/test/pack across TFs and build samples

• Update README with links and badges (docs/CI)

• Document public stable API surface in docs

• Optionally split optional features into extension packages

Acceptance criteria

• docs/getting-started.md explains installation and includes a working example

• At least 3 runnable samples are present and build locally via dotnet run

• CI validates builds for the supported target frameworks

• README contains links to docs and samples

• NuGet package contains XML docs

Labels

• documentation

• enhancement

• good first issue (if splitting into subtasks)

• help wanted

Assignees / Milestone

• Suggested assignee: @jeanlrnt (or leave unassigned to accept community contributions)

• Milestone: “Docs & Samples”

Notes for implementer

• Keep MiniJwt.Core minimal; avoid adding heavy dependencies. If a dependency is needed, move it to an extension package (e.g., MiniJwt.Extensions.Json).

• Prefer System.* APIs and dependency injection friendly patterns.

• Show best practices for key management and rotation in the docs.

• Multi-target the project to cover older and newer consumers.</issue_descr...


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits December 18, 2025 17:54
- Enable XML documentation generation in MiniJwt.Core.csproj
- Create docs/ directory with getting-started, configuration, examples, and faq
- Add three runnable sample applications:
  - ConsoleMinimal: Basic token generation/validation
  - ASPNetCoreAuth: Full ASP.NET Core API with JWT auth
  - WorkerService: Background service with periodic token generation
- Update README.md with links to docs and samples
- Update CI workflow to build samples
- All samples build and run successfully

Co-authored-by: jeanlrnt <63308635+jeanlrnt@users.noreply.github.com>
- Update launchUrl to root endpoint instead of weatherforecast
- Replace ASPNetCoreAuth.http with complete API test scenarios
- Fix Windows Service deployment instructions in WorkerService README
- Use more specific Docker image tag for reproducibility

Co-authored-by: jeanlrnt <63308635+jeanlrnt@users.noreply.github.com>
Copilot AI changed the title [WIP] Document MiniJwt.Core and add integration samples Add comprehensive documentation and runnable sample applications Dec 18, 2025
Copilot AI requested a review from jeanlrnt December 18, 2025 18:02
The NoWarn line was suppressing CS1591 warnings for missing XML comments.
Removing it to keep warnings visible for proper documentation coverage.

Co-authored-by: jeanlrnt <63308635+jeanlrnt@users.noreply.github.com>
Copilot AI requested a review from jeanlrnt December 18, 2025 22:02
@jeanlrnt jeanlrnt marked this pull request as ready for review December 18, 2025 22:06
Copilot AI review requested due to automatic review settings December 18, 2025 22:06
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds comprehensive documentation and runnable sample applications to the MiniJwt.Core library, addressing issue #18. The implementation provides developers with clear getting-started guides, configuration documentation, practical examples, and three different sample applications demonstrating integration patterns.

Key Changes

  • XML Documentation: Enabled documentation file generation in MiniJwt.Core.csproj for inclusion in the NuGet package
  • Documentation Suite: Added four comprehensive markdown files (getting-started.md, configuration.md, examples.md, faq.md) covering installation, usage, and best practices
  • Sample Applications: Created three runnable sample projects demonstrating console, ASP.NET Core, and worker service integration scenarios

Reviewed changes

Copilot reviewed 24 out of 24 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
src/MiniJwt.Core/MiniJwt.Core.csproj Enables XML documentation generation for NuGet package inclusion
docs/getting-started.md Installation guide and quick start examples with common troubleshooting
docs/configuration.md Detailed configuration options and environment-specific setup patterns
docs/examples.md Code examples for various integration scenarios with runnable sample links
docs/faq.md Comprehensive FAQ covering general, security, integration, and troubleshooting topics
samples/ConsoleMinimal/ Minimal console application demonstrating basic token generation and validation
samples/ASPNetCoreAuth/ Full ASP.NET Core web API with JWT authentication, protected endpoints, and role-based authorization
samples/WorkerService/ Background service example with periodic token generation and validation
README.md Updated with documentation links, sample application descriptions, and improved support section
.github/workflows/ci.yml Added sample project builds to CI pipeline for validation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

jeanlrnt and others added 4 commits December 19, 2025 07:45
Updated HTTPS application URL for the 'https' profile.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…mple

Changed from `_tokenCount++` to `Interlocked.Increment(ref _tokenCount) - 1`
to demonstrate thread-safe practices in sample code. While BackgroundService
typically runs on a single thread, this shows best practices for scenarios
where the pattern might be adapted for concurrent use.

Co-authored-by: jeanlrnt <63308635+jeanlrnt@users.noreply.github.com>
@jeanlrnt jeanlrnt merged commit 924b137 into main Dec 19, 2025
15 checks passed
@jeanlrnt jeanlrnt deleted the copilot/document-minijwt-core-samples branch December 19, 2025 07:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Document MiniJwt.Core and add integration samples (docs/ + samples/)

2 participants

Comments