Package io.objectbox.sync
Class SyncCredentials
- java.lang.Object
-
- io.objectbox.sync.SyncCredentials
-
- Direct Known Subclasses:
SyncCredentialsToken,SyncCredentialsUserPassword
public abstract class SyncCredentials extends java.lang.ObjectUse the static helper methods to build Sync credentials, for exampleSyncCredentials.sharedSecret("secret").
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSyncCredentials.CredentialsType
-
Field Summary
Fields Modifier and Type Field Description private SyncCredentials.CredentialsTypetype
-
Constructor Summary
Constructors Constructor Description SyncCredentials(SyncCredentials.CredentialsType type)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description (package private) abstract SyncCredentialscreateClone()Creates a copy of these credentials.SyncCredentials.CredentialsTypegetType()longgetTypeId()static SyncCredentialsgoogle(java.lang.String idToken)Authenticate with a Google account ID token obtained via Google Sign-In.static SyncCredentialsjwtAccessToken(java.lang.String jwtAccessToken)JSON Web Token (JWT): an access token that is used to access resources.static SyncCredentialsjwtCustomToken(java.lang.String jwtCustomToken)JSON Web Token (JWT): a token that is neither an ID, access, nor refresh token.static SyncCredentialsjwtIdToken(java.lang.String jwtIdToken)JSON Web Token (JWT): an ID token that typically provides identity information about the authenticated user.static SyncCredentialsjwtRefreshToken(java.lang.String jwtRefreshToken)JSON Web Token (JWT): a refresh token that is used to obtain a new access token.static SyncCredentialsnone()No authentication, unsecured.static SyncCredentialsobxAdminUser(java.lang.String user, java.lang.String password)ObjectBox admin users (username/password)static SyncCredentialssharedSecret(byte[] secret)Authenticate with a shared secret.static SyncCredentialssharedSecret(java.lang.String secret)Authenticate with a shared secret.static SyncCredentialsuserAndPassword(java.lang.String user, java.lang.String password)Generic credential type suitable for ObjectBox admin (and possibly others in the future)
-
-
-
Field Detail
-
type
private final SyncCredentials.CredentialsType type
-
-
Constructor Detail
-
SyncCredentials
SyncCredentials(SyncCredentials.CredentialsType type)
-
-
Method Detail
-
sharedSecret
public static SyncCredentials sharedSecret(java.lang.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(java.lang.String idToken)
Authenticate with a Google account ID token obtained via Google Sign-In.
-
obxAdminUser
public static SyncCredentials obxAdminUser(java.lang.String user, java.lang.String password)
ObjectBox admin users (username/password)
-
userAndPassword
public static SyncCredentials userAndPassword(java.lang.String user, java.lang.String password)
Generic credential type suitable for ObjectBox admin (and possibly others in the future)
-
jwtIdToken
public static SyncCredentials jwtIdToken(java.lang.String jwtIdToken)
JSON Web Token (JWT): an ID token that typically provides identity information about the authenticated user.
-
jwtAccessToken
public static SyncCredentials jwtAccessToken(java.lang.String jwtAccessToken)
JSON Web Token (JWT): an access token that is used to access resources.
-
jwtRefreshToken
public static SyncCredentials jwtRefreshToken(java.lang.String jwtRefreshToken)
JSON Web Token (JWT): a refresh token that is used to obtain a new access token.
-
jwtCustomToken
public static SyncCredentials jwtCustomToken(java.lang.String jwtCustomToken)
JSON Web Token (JWT): a token that is neither an ID, access, nor refresh token.
-
none
public static SyncCredentials none()
No authentication, unsecured. Use only for development and testing purposes.
-
getType
public SyncCredentials.CredentialsType getType()
-
getTypeId
public long getTypeId()
-
createClone
abstract SyncCredentials createClone()
Creates a copy of these credentials.This can be useful to use the same credentials when creating multiple clients or a server in combination with a client as some credentials may get cleared when building a client or server.
-
-