Connection and authentication

    The Login method returns a token required for all interactions with the server.

    Under the hood, during login, a token is being retrieved from the server, stored in memory and reused for subsequent operations.

    The state is internally used for doing verified operations (such as verifiedSet or verifiedGet).

    1. // Setting the "store" where the internal states are being persisted.
    2. FileImmuStateHolder stateHolder = FileImmuStateHolder.newBuilder()
    3. .withStatesFolder("immu_states")
    4. .build();
    5. // Creating an new ImmuClient instance.
    6. ImmuClient immuClient = ImmuClient.newBuilder()
    7. .withStateHolder(stateHolder)
    8. .withServerUrl("localhost")
    9. .withServerPort(3322)
    10. .build();
    11. // Login with default credentials.
    12. immuClient.login("immudb", "immudb");

    This feature is not yet supported or not documented. Do you want to make a feature request or help out? Open an issue on Python sdk github project (opens new window)

    This feature is not yet supported or not documented. Do you want to make a feature request or help out? Open an issue on

    If you’re using another development language, please read up on our immugw (opens new window) option.

    To enable mutual authentication, a certificate chain must be provided to both the server and client. That will cause each to authenticate with the other simultaneously. In order to generate certs, use the openssl tool: .

    This generates a list of folders containing certificates and private keys to set up a mTLS connection.

    1. client, err := c.NewImmuClient(
    2. c.DefaultOptions().WithMTLsOptions(
    3. c.MTLsOptions{}.WithCertificate("{path-to-immudb-src-folder}/tools/mtls/4_client/certs/localhost.cert.pem").
    4. WithPkey("{path-to-immudb-src-folder}/tools/mtls/4_client/private/localhost.key.pem").
    5. WithClientCAs("{path-to-immudb-src-folder}/tools/mtls/2_intermediate/certs/ca-chain.cert.pem").
    6. WithServername("localhost"),
    7. ).
    8. WithMTLs(true),
    9. )
    10. if err != nil {
    11. ctx := context.Background()
    12. // login with default username and password
    13. lr , err := client.Login(ctx, []byte(`immudb`), []byte(`immudb`))

    This feature is not yet supported or not documented. Do you want to make a feature request or help out? Open an issue on Java sdk github project (opens new window)

    This feature is not yet supported or not documented. Do you want to make a feature request or help out? Open an issue on

    If you’re using another development language, please read up on our immugw (opens new window) option.

    Disable authentication

    You also have the option to run immudb with authentication disabled. However, without authentication enabled, it’s not possible to connect to a server already configured with databases and user permissions. If a valid token is present, authentication is enabled by default.

    1. client, err := c.NewImmuClient(
    2. c.DefaultOptions().WithAuth(false),
    3. )
    4. if err != nil {
    5. log.Fatal(err)
    6. }
    7. vi, err := client.VerifiedSet(ctx, []byte(`immudb`), []byte(`hello world`))
    8. if err != nil {
    9. }

    This feature is not yet supported or not documented. Do you want to make a feature request or help out? Open an issue on Python sdk github projectConnection and authentication - 图10 (opens new window)

    This feature is not yet supported or not documented. Do you want to make a feature request or help out? Open an issue on

    This feature is not yet supported or not documented. Do you want to make a feature request or help out? Open an issue on .Net sdk github projectConnection and authentication - 图12 (opens new window)