fedn.network.grpc package

Submodules

fedn.network.grpc.auth module

class fedn.network.grpc.auth.JWTInterceptor[source]

Bases: ServerInterceptor

__init__()[source]
intercept_service(continuation, handler_call_details)[source]

Intercepts incoming RPCs before handing them over to a handler.

State can be passed from an interceptor to downstream interceptors via contextvars. The first interceptor is called from an empty contextvars.Context, and the same Context is used for downstream interceptors and for the final handler call. Note that there are no guarantees that interceptors and handlers will be called from the same thread.

Parameters:
  • continuation – A function that takes a HandlerCallDetails and proceeds to invoke the next interceptor in the chain, if any, or the RPC handler lookup logic, with the call details passed as an argument, and returns an RpcMethodHandler instance if the RPC is considered serviced, or None otherwise.

  • handler_call_details – A HandlerCallDetails describing the RPC.

Returns:

An RpcMethodHandler with which the RPC may be serviced if the interceptor chooses to service this RPC, or None otherwise.

fedn.network.grpc.auth.check_role_claims(payload, endpoint)[source]

fedn.network.grpc.server module

class fedn.network.grpc.server.Server(servicer, modelservicer, config: ServerConfig)[source]

Bases: object

Class for configuring and launching the gRPC server.

__init__(servicer, modelservicer, config: ServerConfig)[source]
start()[source]

Start the gRPC server.

stop()[source]

Stop the gRPC server.

class fedn.network.grpc.server.ServerConfig[source]

Bases: TypedDict

certificate: str
key: str
logfile: str
port: int
secure: bool
verbosity: str