Skip to content

format: Allow credentials to be supplied via a callback #4231

@CurtHagenlocher

Description

@CurtHagenlocher

What feature or improvement would you like to see?

Credentials are increasingly of limited duration, which introduces the possibility of them expiring in the middle of an operation. While one approach is to give the driver enough information so that it can refresh the credential on its own, there are systems where such delegation is difficult or impossible. For these cases, it would be nice for the driver to call back into the host to ask for an updated credential.

One possible approach:

/// \brief A credential handler function.
///
/// The handler must not call any ADBC functions other than the
/// ConnectionSetOption functions and releasing the warning.
///
/// There are no requirements on ordering or concurrency of calls to the
/// handler; the driver may call the handler at any time from any thread,
/// including calling the handler concurrently.
///
/// \param[in] details Additional details about the credential required.
///   The application is responsible for releasing the details, but the
///   pointer itself will not be valid after the handler returns.
/// \param[in] user_data The user_data pointer.
typedef void (*AdbcCredentialHandler)(const struct AdbcError* details, void* user_data);


  AdbcStatusCode (*ConnectionSetCredentialHandler)(struct AdbcConnection*,
                                                   AdbcCredentialHandler handler,
                                                   void* user_data, struct AdbcError*);```

Metadata

Metadata

Assignees

No one assigned

    Labels

    No fields configured for Feature.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions