mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-13 23:11:40 +00:00
feat(ai-gateway): KeyAuthenticator.verify takes model for model-access enforcement
This commit is contained in:
parent
d7059c6c58
commit
d767ae7750
1 changed files with 9 additions and 3 deletions
|
|
@ -34,7 +34,13 @@ pub enum AuthError {
|
|||
#[axum::async_trait]
|
||||
pub trait KeyAuthenticator: Send + Sync {
|
||||
/// Resolve `key` for the given `route` (the gateway's own request path, e.g.
|
||||
/// `/v1/realtime`). The route is forwarded so route/model restrictions on the
|
||||
/// key are evaluated against the route it's actually being used on.
|
||||
async fn verify(&self, key: &str, route: &str) -> Result<UserApiKeyAuth, AuthError>;
|
||||
/// `/v1/realtime`) and the requested `model` (if any). Both are forwarded so
|
||||
/// the backend enforces the key/team's route AND model permissions against
|
||||
/// what's actually being requested — not just that the key exists.
|
||||
async fn verify(
|
||||
&self,
|
||||
key: &str,
|
||||
route: &str,
|
||||
model: Option<&str>,
|
||||
) -> Result<UserApiKeyAuth, AuthError>;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue