Skip to content

feat: api key authentication and management#20

Merged
ontehfritz merged 2 commits intomainfrom
feat-api-key-authn
Feb 14, 2026
Merged

feat: api key authentication and management#20
ontehfritz merged 2 commits intomainfrom
feat-api-key-authn

Conversation

@ontehfritz
Copy link
Copy Markdown
Contributor

No description provided.

Copy link
Copy Markdown
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 pull request implements API key authentication and management functionality for the BulwarkAuth service. It enables users to create, list, delete, and authenticate using API keys as an alternative to password-based authentication. The API keys follow a structured format (bwa_<random>_<secret>) where the prefix is stored for identification and the secret portion is hashed using bcrypt for secure storage.

Changes:

  • Added API key data model with MongoDB repository implementation supporting CRUD operations
  • Implemented API key service with token-based authorization for management operations and API key-based authentication
  • Added HTTP handlers and routes for API key creation, listing, and deletion with rate limiting support

Reviewed changes

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

Show a summary per file
File Description
internal/encryption/encryption.go Added GenerateRandomString function for generating API key prefixes
internal/authentication/apikey.go Core API key domain model, repository, and service implementation with authentication logic
internal/authentication/apikey_errors.go Custom error types for API key operations
internal/authentication/apikey_test.go Comprehensive repository-level tests covering CRUD operations and edge cases
internal/authentication/apikey_service_test.go Service-level tests including authentication flows and isolation testing
internal/accounts/accounts.go Added ID field to Account struct for API key association
api/authentication/apikey_handlers.go HTTP handlers for API key management endpoints
api/authentication/apikey_routes.go Route definitions for API key endpoints with rate limiting middleware
cmd/bulwarkauth/main.go Integration of API key service and handlers into the application

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

@ontehfritz ontehfritz merged commit 6a1e2d3 into main Feb 14, 2026
5 checks passed
@ontehfritz ontehfritz deleted the feat-api-key-authn branch February 14, 2026 19:22
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.

2 participants