swarm-queue-client: request the bearer-authz scope when minting an agent token
`swarm-logs query` got a bare nginx 401 from the swarm log store on every query. The agent OIDC client is registered for `authelia.bearer.authz` (`swarm-authelia.nix`'s `agentClients` sets `bearerAuthz`), but registration is not issuance: the token request asked for no scope, so the token came back carrying none, and authelia's `/api/authz/auth-request` refuses that exactly as it refuses an unauthenticated caller. The same failure is already recorded in `swarm-otel.nix` against the collector's client, on the same scope string — prometheus asks for no scopes unless told to, and every scrape was refused at introspection. This is that bug one layer down, so it gets the same shape of fix. `scope` becomes an opt-in parameter alongside `audience`, not a hardcoded value or a config field: the two travel together (registered ≠ requested applies to both) and only the destination decides whether either is needed. `None` keeps every other caller byte-identical — the NATS connect callback, `auth.rs`'s bridge client and the OTLP push client all pass it. Refs #4464
This commit is contained in:
parent
42dcf10064
commit
d8f6d99bf9
5 changed files with 118 additions and 28 deletions
|
|
@ -98,7 +98,7 @@ impl AuthBridge {
|
|||
// configured CA, if any) — deliberately not `self.http`, which is
|
||||
// the bridge's own client and has nothing to do with authelia's
|
||||
// token endpoint's trust anchors.
|
||||
let token = swarm_queue_client::mint_token_for(&self.queue_cfg, None)
|
||||
let token = swarm_queue_client::mint_token_for(&self.queue_cfg, None, None)
|
||||
.await
|
||||
.context("minting a bearer token for swarm-authelia-bridge")?;
|
||||
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ impl HttpClient for AuthenticatedHttpClient {
|
|||
/// why this specific caller deliberately runs on a thread with nothing
|
||||
/// to yield to.
|
||||
async fn send_bytes(&self, mut request: Request<Bytes>) -> Result<Response<Bytes>, HttpError> {
|
||||
let token = mint_token_for_blocking(&self.cfg, Some(&self.audience))?;
|
||||
let token = mint_token_for_blocking(&self.cfg, Some(&self.audience), None)?;
|
||||
request.headers_mut().insert(
|
||||
http::header::AUTHORIZATION,
|
||||
http::HeaderValue::from_str(&format!("Bearer {token}"))?,
|
||||
|
|
|
|||
Loading…
Reference in a new issue