Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow specifying multiple API keys with different authorizations #216

Closed
jander-msft opened this issue Apr 21, 2021 · 1 comment
Closed
Labels
enhancement New feature or request
Milestone

Comments

@jander-msft
Copy link
Member

It appears that Prometheus does support authorization: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#scrape_config

This means we can allow securing the /metrics endpoint with API key authorization. However, we would likely want to configure a separate API key for metrics that is different than the API key used for the other routes.

Configuration could look like:

{
    "ApiAuthentication": {
        "Hashes": [{
            "Name": "MyKey",
            "Value": "<Base 64 Encoded Hash of Key>",
            "Algorithm": "SHA256",
            "Authorizations": [
                "all"
            ]
        },{
            "Name": "PrometheusKey",
            "Value": "<Base 64 Encoded Hash of Key>",
            "Algorithm": "SHA256",
            "Authorizations": [
                "metrics"
            ]
        }]
    }
}

This allows for multiple scenarios:

  • Securing the /metrics endpoint from unauthorized access.
  • Allowing finer grained preconfigured authorizations. For example, could have authorizations for each route, for different types of egress, etc.
  • Ability to log the name of the key that was used for each access to a route.
@jander-msft
Copy link
Member Author

.NET Monitor does not currently support authorization scopes except for in the case of Entra ID authentication where a single scope is necessary to allow the use of .NET Monitor for each user. Additionally, there is no plan to add support for multiple API keys as there has not been any customer feedback for this. If fine-grained authorization is added and customers ask for multiple API keys, this can be revisited.

@jander-msft jander-msft closed this as not planned Won't fix, can't repro, duplicate, stale Dec 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant