Skip to content

struct flake::AuthenticationSink

Callback interface for authentication during connection setup. More...

#include <platform/flake/Connection.h>

Public Functions

Name
AuthenticationSink(constAuthenticationSink & ) =deleted
AuthenticationSink &operator=(constAuthenticationSink & ) =deleted
AuthenticationSink(AuthenticationSink && ) =deleted
AuthenticationSink &operator=(AuthenticationSink && ) =deleted
virtual voidonAuthChallengeReceived(constchar * challenge_type, uint8_t * challenge, int challenge_len, uint8_t * response[], int * response_len) =0
Called on the client (or router-as-client) when a challenge is received from the peer.
virtual intonAuthChallengeRequested(void * wire, char * challenge_type[], uint8_t * challenge[], int * challenge_len) =0
Called on the router when a new client connects on a wire, to generate a challenge.
virtual intonAuthResponseReceived(constchar * challenge_type, uint8_t * challenge, int challenge_len, uint8_t * response, int response_len) =0
Called on the router after the client has responded to the challenge.
virtual intonConnect(constPropArray & props) =0
Called when the authentication type is flakeAuthType::atInteractive.
virtual flakeAuthTypeauthenticationType() =0
Return the desired authentication type for this sink.

Protected Functions

Name
virtual~AuthenticationSink() =default
AuthenticationSink() =default

Detailed Description

cpp
struct flake::AuthenticationSink;

Callback interface for authentication during connection setup.

Note: Non-copyable, non-movable.

Provide an implementation of this interface when authentication is required between a client and the router. The exact methods called depend on the role (client vs. router) and the chosen authentication type.

Public Functions Documentation

function AuthenticationSink

cpp
AuthenticationSink(
    constAuthenticationSink & 
) =deleted

function operator=

cpp
AuthenticationSink & operator=(
    constAuthenticationSink & 
) =deleted

function AuthenticationSink

cpp
AuthenticationSink(
    AuthenticationSink && 
) =deleted

function operator=

cpp
AuthenticationSink & operator=(
    AuthenticationSink && 
) =deleted

function onAuthChallengeReceived

cpp
virtual void onAuthChallengeReceived(
    constchar * challenge_type,
    uint8_t * challenge,
    int challenge_len,
    uint8_t * response[],
    int * response_len
) =0

Called on the client (or router-as-client) when a challenge is received from the peer.

Parameters:

  • challenge_type Null-terminated string identifying the authentication scheme.
  • challenge Raw challenge bytes sent by the peer.
  • challenge_len Length of challenge in bytes.
  • response Pointer to a buffer allocated by the callee containing the response.
  • response_len Length of the response buffer.

The implementation must populate response and response_len with the appropriate reply.

function onAuthChallengeRequested

cpp
virtual int onAuthChallengeRequested(
    void * wire,
    char * challenge_type[],
    uint8_t * challenge[],
    int * challenge_len
) =0

Called on the router when a new client connects on a wire, to generate a challenge.

Parameters:

  • wire Opaque pointer identifying the wire.
  • challenge_type Null-terminated string describing the scheme (allocated by callee; freed in onAuthResponseReceived()).
  • challenge Raw challenge bytes (allocated by callee).
  • challenge_len Length of the challenge.

Return: 0 if a challenge was generated, -1 if no authentication is desired for this wire.

function onAuthResponseReceived

cpp
virtual int onAuthResponseReceived(
    constchar * challenge_type,
    uint8_t * challenge,
    int challenge_len,
    uint8_t * response,
    int response_len
) =0

Called on the router after the client has responded to the challenge.

Parameters:

  • challenge_type The scheme string from the challenge phase.
  • challenge The original challenge bytes.
  • challenge_len Length of the challenge.
  • response The client's response bytes.
  • response_len Length of the response.

Return: 0 if authentication succeeds, non-zero on failure.

The callee should free challenge_type and challenge that were allocated in onAuthChallengeRequested().

function onConnect

cpp
virtual int onConnect(
    constPropArray & props
) =0

Called when the authentication type is flakeAuthType::atInteractive.

Parameters:

  • props Properties sent by the connecting client.

Return: 0 to accept the connection, non-zero to reject.

The router receives the client's connection properties and decides whether to accept.

function authenticationType

cpp
virtual flakeAuthType authenticationType() =0

Return the desired authentication type for this sink.

Return: One of the flakeAuthType enumerators.

Protected Functions Documentation

function ~AuthenticationSink

cpp
virtual ~AuthenticationSink() =default

function AuthenticationSink

cpp
AuthenticationSink() =default