Class SyncCredentials

java.lang.Object
io.objectbox.sync.SyncCredentials
Direct Known Subclasses:
SyncCredentialsToken, SyncCredentialsUserPassword

public abstract class SyncCredentials extends Object
Use the static helper methods to build Sync credentials, for example SyncCredentials.sharedSecret("secret").
  • Method Details

    • sharedSecret

      public static SyncCredentials sharedSecret(String secret)
      Authenticate with a shared secret. This could be a passphrase, big number or randomly chosen bytes. The string is expected to use UTF-8 characters.
    • sharedSecret

      public static SyncCredentials sharedSecret(byte[] secret)
      Authenticate with a shared secret. This could be a passphrase, big number or randomly chosen bytes.
    • google

      public static SyncCredentials google(String idToken)
      Authenticate with a Google account ID token obtained via Google Sign-In.
    • obxAdminUser

      public static SyncCredentials obxAdminUser(String user, String password)
      ObjectBox Admin user (username and password).
    • userAndPassword

      public static SyncCredentials userAndPassword(String user, String password)
      Generic credentials type suitable for ObjectBox Admin (and possibly others in the future).
    • jwtIdToken

      public static SyncCredentials jwtIdToken(String jwtIdToken)
      Authenticate with a JSON Web Token (JWT) that is an ID token.

      An ID token typically provides identity information about the authenticated user.

      Use this and the other JWT methods that accept a token to configure JWT auth for a Sync client or server peer. To configure Sync server auth options, use the server variants, like jwtIdTokenServer(), instead.

      See the JWT authentication documentation for details.

    • jwtAccessToken

      public static SyncCredentials jwtAccessToken(String jwtAccessToken)
      Authenticate with a JSON Web Token (JWT) that is an access token.

      An access token is used to access resources.

      See jwtIdToken(String) for some common remarks.

    • jwtRefreshToken

      public static SyncCredentials jwtRefreshToken(String jwtRefreshToken)
      Authenticate with a JSON Web Token (JWT) that is a refresh token.

      A refresh token is used to obtain a new access token.

      See jwtIdToken(String) for some common remarks.

    • jwtCustomToken

      public static SyncCredentials jwtCustomToken(String jwtCustomToken)
      Authenticate with a JSON Web Token (JWT) that is neither an ID, access, nor refresh token.

      See jwtIdToken(String) for some common remarks.

    • jwtIdTokenServer

      public static SyncCredentials jwtIdTokenServer()
      Enable authentication using a JSON Web Token (JWT) that is an ID token.

      An ID token typically provides identity information about the authenticated user.

      Use this and the other JWT server credentials types to configure a Sync server. For Sync clients, use the ones that accept a token, like jwtIdToken(String), instead.

      See the JWT authentication documentation for details.

    • jwtAccessTokenServer

      public static SyncCredentials jwtAccessTokenServer()
      Enable authentication using a JSON Web Token (JWT) that is an access token.

      An access token is used to access resources.

      See jwtIdTokenServer() for some common remarks.

    • jwtRefreshTokenServer

      public static SyncCredentials jwtRefreshTokenServer()
      Enable authentication using a JSON Web Token (JWT) that is a refresh token.

      A refresh token is used to obtain a new access token.

      See jwtIdTokenServer() for some common remarks.

    • jwtCustomTokenServer

      public static SyncCredentials jwtCustomTokenServer()
      Enable authentication using a JSON Web Token (JWT) that is neither an ID, access, nor refresh token.

      See jwtIdTokenServer() for some common remarks.

    • none

      public static SyncCredentials none()
      No authentication, unsecured. Use only for development and testing purposes.
    • getType

    • getTypeId

      public long getTypeId()