public static bool IsInRole(this FunctionContext context, string role)
        {
            if (!context.IsAuthenticated())
            {
                return(false);
            }

            if (!context.Items.ContainsKey("identity"))
            {
                return(false);
            }
            if (context.Items["identity"] is not ClaimsPrincipal principal)
            {
                return(false);
            }

            return(principal.FindAll(c => c.Type == ClaimTypes.Role).Any(c => c.Value == role));
        }