Electric.Client.Authenticator behaviour (Electric Client v0.7.0)

View Source

Behaviour to authenticate a Electric.Client.Fetch.Request.

The assumption here is that authentication is per ShapeDefinition not per request.

Summary

Callbacks

Update the given Request struct with authentication headers.

Get authentication headers for the given ShapeDefinition

Types

headers()

Callbacks

authenticate_request(t, config)

@callback authenticate_request(Electric.Client.Fetch.Request.t(), config :: term()) ::
  Electric.Client.Fetch.Request.authenticated()

Update the given Request struct with authentication headers.

Independent of the actual authentication mechanism, implementations of this Behaviour MUST set the authenticated field in the Request to true.

authenticate_shape(t, config)

@callback authenticate_shape(Electric.Client.ShapeDefinition.t(), config :: term()) ::
  headers()

Get authentication headers for the given ShapeDefinition