Skip to main content

reifydb_auth/method/
guest.rs

1// SPDX-License-Identifier: Apache-2.0
2// Copyright (c) 2026 ReifyDB
3
4use std::collections::{BTreeMap, HashMap};
5
6use reifydb_core::interface::auth::{AuthStep, AuthenticationProvider};
7use reifydb_runtime::context::rng::Rng;
8use reifydb_value::{Result, error::Error};
9
10use crate::error::AuthError;
11
12pub struct GuestProvider;
13
14impl AuthenticationProvider for GuestProvider {
15	fn method(&self) -> &str {
16		"guest"
17	}
18
19	fn create(&self, _rng: &Rng, _config: &HashMap<String, String>) -> Result<BTreeMap<String, String>> {
20		Err(Error::from(AuthError::GuestHasNoCredentials))
21	}
22
23	fn authenticate(
24		&self,
25		_stored: &BTreeMap<String, String>,
26		_credentials: &HashMap<String, String>,
27	) -> Result<AuthStep> {
28		Ok(AuthStep::Failed)
29	}
30}