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).
// Setting the "store" where the internal states are being persisted.
FileImmuStateHolder stateHolder = FileImmuStateHolder.newBuilder()
.withStatesFolder("immu_states")
.build();
// Creating an new ImmuClient instance.
ImmuClient immuClient = ImmuClient.newBuilder()
.withStateHolder(stateHolder)
.withServerUrl("localhost")
.withServerPort(3322)
.build();
// Login with default credentials.
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.
client, err := c.NewImmuClient(
c.DefaultOptions().WithMTLsOptions(
c.MTLsOptions{}.WithCertificate("{path-to-immudb-src-folder}/tools/mtls/4_client/certs/localhost.cert.pem").
WithPkey("{path-to-immudb-src-folder}/tools/mtls/4_client/private/localhost.key.pem").
WithClientCAs("{path-to-immudb-src-folder}/tools/mtls/2_intermediate/certs/ca-chain.cert.pem").
WithServername("localhost"),
).
WithMTLs(true),
)
if err != nil {
ctx := context.Background()
// login with default username and password
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.
client, err := c.NewImmuClient(
c.DefaultOptions().WithAuth(false),
)
if err != nil {
log.Fatal(err)
}
vi, err := client.VerifiedSet(ctx, []byte(`immudb`), []byte(`hello world`))
if err != nil {
}
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
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 project (opens new window)