public static class Auth.AuthOptions
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
Auth.TokenCallback |
authCallback
Called when a new token is required.
|
Param[] |
authHeaders
A set of key-value pair headers to be added to any request made to the authUrl.
|
java.lang.String |
authMethod
The HTTP verb to use for any request made to the authUrl, either GET or POST.
|
Param[] |
authParams
A set of key-value pair params to be added to any request made to the authUrl.
|
java.lang.String |
authUrl
A URL that the library may use to obtain a token string (in plain text format), or a signed
Auth.TokenRequest
or Auth.TokenDetails (in JSON format) from. |
java.lang.String |
key
The full API key string, as obtained from the Ably dashboard.
|
boolean |
queryTime
If true, the library queries the Ably servers for the current time when issuing
Auth.TokenRequest
instead of relying on a locally-available time of day. |
java.lang.String |
token
An authenticated token.
|
Auth.TokenDetails |
tokenDetails
An authenticated
Auth.TokenDetails object (most commonly obtained from an Ably Token Request response). |
boolean |
useTokenAuth
When true, forces token authentication to be used by the library.
|
| Constructor and Description |
|---|
AuthOptions()
Default constructor
|
AuthOptions(java.lang.String key)
Convenience constructor, to create an AuthOptions based
on the key string obtained from the application dashboard.
|
public Auth.TokenCallback authCallback
Auth.TokenRequest; a Auth.TokenDetails (in JSON format);
an Ably JWT.
See the authentication documentation
for details of the Ably Auth.TokenRequest format and associated API calls.
This callback is invoked on a background thread.
Spec: RSA4a, RSA4, TO3j5, AO2b
public java.lang.String authUrl
Auth.TokenRequest
or Auth.TokenDetails (in JSON format) from.
Spec: RSA4a, RSA4, RSA8c, TO3j6, AO2c
public java.lang.String authMethod
Spec: RSA8c, TO3j7, AO2d
public java.lang.String key
Auth.TokenRequest.
Read more about Basic authentication.
Spec: RSA11, RSA14, TO3j1, AO2a
public java.lang.String token
Auth.TokenDetails object, a Auth.TokenRequest object, or token string
(obtained from the token property of a Auth.TokenDetails component of an Ably Auth.TokenRequest response, or a
JSON Web Token satisfying the
Ably requirements for JWTs).
This option is mostly useful for testing: since tokens are short-lived,
in production you almost always want to use an authentication method that enables the
client library to renew the token automatically when the previous one expires, such as authUrl or authCallback.
Read more about Token authentication.
Spec: RSA4a, RSA4, TO3j2
public Auth.TokenDetails tokenDetails
Auth.TokenDetails object (most commonly obtained from an Ably Token Request response).
This option is mostly useful for testing: since tokens are short-lived,
in production you almost always want to use an authentication method that enables the
client library to renew the token automatically when the previous one expires, such as authUrl or authCallback.
Use this option if you wish to use Token authentication.
Read more about Token authentication.
Spec: RSA4a, RSA4, TO3j2
public Param[] authHeaders
Spec: RSA8c3, TO3j8, AO2e
public Param[] authParams
Spec: RSA8c3, RSA8c1, TO3j9, AO2f
public boolean queryTime
Auth.TokenRequest
instead of relying on a locally-available time of day.
Knowing the time accurately is needed to create valid signed Ably Auth.TokenRequest,
so this option is useful for library instances on auth servers where for some reason the server clock
cannot be kept synchronized through normal means, such as an NTP daemon.
The server is queried for the current time once per client library instance (which stores the offset from the local clock),
so if using this option you should avoid instancing a new version of the library for each request.
The default is false.
Spec: RSA9d, TO3j10, AO2a
public boolean useTokenAuth
ClientOptions or Auth.TokenParams,
then the Ably Token issued is anonymous.
Spec: RSA4, RSA14, TO3j4
public AuthOptions()
public AuthOptions(java.lang.String key)
throws AblyException
key - the full key string as obtained from the dashboardAblyException