Packages

Elixir-native, protocol-focused Language Server Protocol toolkit.

Current section

Files

Jump to
elixir_lsp lib elixir_lsp middleware auth.ex
Raw

lib/elixir_lsp/middleware/auth.ex

defmodule ElixirLsp.Middleware.Auth do
@moduledoc """
Example auth middleware.
Expects `ctx[:authorized?]` to be truthy when enabled by caller.
"""
def call(message, ctx, next) do
authorized? = Map.get(ctx, :authorized?, true)
next.(message, Map.put(ctx, :authorized?, authorized?))
end
end