Skip to main content

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	if Handle == 0 {
15		dev_log!("provider-register", "[ProviderUnregister] authentication skip: missing handle");
16		return;
17	}
18	Service
19		.RunTime()
20		.Environment
21		.ApplicationState
22		.Extension
23		.ProviderRegistration
24		.UnregisterProvider(Handle);
25	dev_log!("provider-register", "[ProviderUnregister] authentication handle={}", Handle);
26}