Mountain/Vine/Server/Notification/UnregisterAuthenticationProvider.rs
1#![allow(non_snake_case)]
2//! Cocoon → Mountain `unregister_authentication_provider` notification.
3//! Emitted by `Cocoon/.../AuthenticationNamespace.ts:43` when an extension
4//! disposes an authentication provider handle. Removes the matching
5//! `ProviderRegistrationDTO` so stale provider state doesn't pin memory
6//! or shadow a later re-register.
7
8use serde_json::Value;
9
10use crate::{Vine::Server::MountainVinegRPCService::MountainVinegRPCService, dev_log};
11
12pub async fn UnregisterAuthenticationProvider(Service:&MountainVinegRPCService, Parameter:&Value) {
13 let Handle = Parameter.get("handle").and_then(Value::as_u64).unwrap_or(0) as u32;
14
15 if Handle == 0 {
16 dev_log!("provider-register", "[ProviderUnregister] authentication skip: missing handle");
17
18 return;
19 }
20
21 Service
22 .RunTime()
23 .Environment
24 .ApplicationState
25 .Extension
26 .ProviderRegistration
27 .UnregisterProvider(Handle);
28
29 dev_log!("provider-register", "[ProviderUnregister] authentication handle={}", Handle);
30}