Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Feature: Add API Key Authentication & Web-based Admin Dashboard #762

Copy link
Copy link
@djfaizp

Description

@djfaizp
Issue body actions

Problem / Motivation

First off, thank you for this fantastic project! Archon is a powerful and clean wrapper for the Bungie.net API.

Currently, the API endpoints provided by Archon appear to be open without any built-in authentication mechanism. While this is great for local development, it poses a significant security risk when deploying Archon to a server or using it in a production environment. Anyone who discovers the endpoint URL could potentially make requests, consume rate limits, and abuse the service.

To make Archon more robust and production-ready, it would be beneficial to add a layer of security.

Proposed Solution

I propose a two-part solution to address this, which covers both securing the API endpoints and providing a management interface.

Part 1: API Key Authentication for Endpoints

This is the core security feature. It would involve securing the Archon API endpoints so that they can only be accessed with a valid secret key.

  • Configuration: A new configuration key could be added to appsettings.json (or an environment variable), for example:
    "Archon": {
      "ApiKey": "your-super-secret-api-key-here"
    }
  • Implementation: A new middleware would check incoming requests for this key. Clients would be required to include the key in an HTTP header, for example: X-Archon-API-Key: your-super-secret-api-key-here.
  • Behavior: If a request arrives without a valid key, the API should immediately respond with a 401 Unauthorized or 403 Forbidden status.
  • Benefit: This simple mechanism would effectively secure the wrapper from unauthorized use and allow the owner to control who has access.

Part 2: Optional: Web-based Administrative Dashboard

This part addresses the "add login page" request in a way that fits the project's architecture. A simple, built-in web UI for managing Archon would be incredibly useful.

  • Login Page: The dashboard would be protected by a basic login page. The credentials could also be configured in appsettings.json.
    "ArchonAdmin": {
      "Username": "admin",
      "Password": "a-strong-password"
    }
  • Dashboard Features: This dashboard could provide:
    • A simple API endpoint tester.
    • A view of recent logs or errors.
    • A way to view current Bungie.net API rate limit status.
    • In the future, a UI to manage multiple API keys (if that feature is ever added).
  • Benefit: This would provide a secure, user-friendly way to monitor and interact with the Archon instance without needing to use third-party tools like Postman or curl for basic checks.

Alternatives Considered

  • Relying on a Reverse Proxy: One could use Nginx, Traefik, or Caddy to handle authentication in front of Archon. While this is a valid approach, it adds external complexity. Building authentication directly into Archon makes it more self-contained and easier to set up for users who aren't familiar with reverse proxies.

Additional Context

  • For the API Key authentication, ASP.NET Core has excellent built-in support for API key authentication middleware that could be leveraged.
  • For the admin dashboard, a minimalistic framework like Blazor or even simple Razor Pages would be a great fit within the .NET ecosystem and wouldn't add too much overhead to the project.

Thank you for considering this feature! I believe it would significantly increase Archon's value and make it suitable for a much wider range of use cases.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.