Allow disabling automatic creation of clients

This may be useful in multi-user deployment scenarios where some
external administrative tools are used to create new clients.
This commit is contained in:
Dustin J. Mitchell 2025-07-10 21:49:57 -04:00
parent 4de5c9a345
commit 3a794341ce
No known key found for this signature in database
8 changed files with 117 additions and 26 deletions

View file

@ -32,6 +32,7 @@ pub(crate) const SNAPSHOT_REQUEST_HEADER: &str = "X-Snapshot-Request";
pub(crate) struct ServerState {
pub(crate) server: Server,
pub(crate) client_id_allowlist: Option<HashSet<Uuid>>,
pub(crate) create_clients: bool,
}
impl ServerState {
@ -87,6 +88,7 @@ mod test {
let state = ServerState {
server: Server::new(Default::default(), InMemoryStorage::new()),
client_id_allowlist: None,
create_clients: true,
};
let req = actix_web::test::TestRequest::default()
.insert_header((CLIENT_ID_HEADER, client_id.to_string()))
@ -101,6 +103,7 @@ mod test {
let state = ServerState {
server: Server::new(Default::default(), InMemoryStorage::new()),
client_id_allowlist: Some([client_id_ok].into()),
create_clients: true,
};
let req = actix_web::test::TestRequest::default()
.insert_header((CLIENT_ID_HEADER, client_id_ok.to_string()))